Machine learning-based prediction of subclinical mastitis in large-scale dairy herds using a locally established somatic cell count threshold
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.
Fields of Study & Subjects
Milk Quality and Mastitis in Dairy Cows
Animal Behavior and Welfare Studies
Effects of Environmental Stressors on Livestock
Publication details
- Journal / source
- Scientific Reports
- Publisher
- Springer Science and Business Media LLC
- Volume
- 16
- Issue
- 1
- Publication date
- 28 April 2026
- Language
- EN