Machine learning-based prediction of subclinical mastitis in large-scale dairy herds using a locally established somatic cell count threshold

This study aims to establish a somatic cell count threshold to identify cows with subclinical mastitis (SCM) and to develop a machine learning model to predict the incidence of SCM using individual cow data, milk production and composition data. Milk samples were collected from a total of 2420 lactating cows from three large scale dairy herds (A: n = 1002; B: n = 898; and C: n = 520), for California Mastitis Test (CMT), Somatic Cell Count (SCC) determination, and milk composition analysis. Information on individual cows and their milk production was obtained from farm records. The diagnostic SCC threshold was identified on the basis of CMT scores using the Youden’s index. Two methodological approaches were employed: Method one with all variables (M1) and Method two with four selected variables (M2) to select the most appropriate models for predicting SCM. The SCC threshold yielding the highest Youden’s index was 353,000 cells/mL. For M1, XGBoost, an efficient gradient boosting ML algorithm that handles complex, nonlinear relationships in data, showed the highest accuracy (77.3%). Milk conductivity consistently emerged as the most influential predictor across nearly all the algorithms, followed by lactation number (Lac. No.), and milk density. In M2, the overall performance decreased, with CatBoost, a gradient boosting algorithm which handles categorical variables efficiently, achieving the highest accuracy (70.8%). Lac. No. and testday milk yield (Testday MY) were the most important predictors in M2. Overall, the results show that integrating a SCC threshold of 353,000 cells/mL together with key predictors such as milk conductivity enables machine learning models to support practical and reliable basis for early detection of subclinical mastitis in dairy herds.

Authors

Institutions

Publication Details

Journal
Scientific Reports
Published
2026-04-28
DOI
https://doi.org/10.1038/s41598-026-50467-5
Primary Topic
Milk Quality and Mastitis in Dairy Cows
Type
article
Field-Weighted Citation Impact
0.00

Funders

Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Machine learning-based prediction of subclinical mastitis in large-scale dairy herds using a locally established somatic cell count threshold

R.M.S.B.K. Ranasinghe, R.M.C. Deshapriya, A. P. Ajitha, M. P. Saiju et al.
Scientific Reports
Milk Quality and Mastitis in Dairy Cows
article

Machine learning-based prediction of subclinical mastitis in large-scale dairy herds using a locally established somatic cell count threshold

R.M.S.B.K. Ranasinghe, R.M.C. Deshapriya, A. P. Ajitha, M. P. Saiju, K. M. Devindi, R. M. C. O. Rathnayaka, K. Kaniyamattam
article en

Abstract

This study aims to establish a somatic cell count threshold to identify cows with subclinical mastitis (SCM) and to develop a machine learning model to predict the incidence of SCM using individual cow data, milk production and composition data. Milk samples were collected from a total of 2420 lactating cows from three large scale dairy herds (A: n = 1002; B: n = 898; and C: n = 520), for California Mastitis Test (CMT), Somatic Cell Count (SCC) determination, and milk composition analysis. Information on individual cows and their milk production was obtained from farm records. The diagnostic SCC threshold was identified on the basis of CMT scores using the Youden’s index. Two methodological approaches were employed: Method one with all variables (M1) and Method two with four selected variables (M2) to select the most appropriate models for predicting SCM. The SCC threshold yielding the highest Youden’s index was 353,000 cells/mL. For M1, XGBoost, an efficient gradient boosting ML algorithm that handles complex, nonlinear relationships in data, showed the highest accuracy (77.3%). Milk conductivity consistently emerged as the most influential predictor across nearly all the algorithms, followed by lactation number (Lac. No.), and milk density. In M2, the overall performance decreased, with CatBoost, a gradient boosting algorithm which handles categorical variables efficiently, achieving the highest accuracy (70.8%). Lac. No. and testday milk yield (Testday MY) were the most important predictors in M2. Overall, the results show that integrating a SCC threshold of 353,000 cells/mL together with key predictors such as milk conductivity enables machine learning models to support practical and reliable basis for early detection of subclinical mastitis in dairy herds.

Scientific Reports
University of Peradeniya (LK), Sustainable Innovation (Sweden) (SE), Informatics Institute of Technology (LK)
University of Peradeniya
Openalex Percentile: Top 5%
Milk Quality and Mastitis in Dairy Cows
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.