Detecting subclinical mastitis in dairy cattle by using machine learning techniques to analyse automated milking system data
Background Early detection of subclinical mastitis in dairy cattle is essential to aid pattern diagnosis and the implementation of control strategies to reduce new infection rates. This observational cross‐sectional study aimed to evaluate the ability of machine learning techniques to detect subclinical mastitis in dairy cattle using production and health indicators. Methods Six machine learning algorithms were evaluated: support vector machine, logistic regression, decision tree, random forest, XGBoost and multilayer perceptron neural network. Three response classifications were tested. Data were partitioned by cow, with 80% of cows used for development and hyperparameter tuning through 30 repeated cow‐grouped holdouts and 20% of cows used for independent testing. SHAP (SHapley Additive exPlanations) analysis identified influential variables in development data. Results The random forest model, using positive microbiological culture and/or somatic cell count ≥200 × 10 3 cells/mL to define affected quarters, performed the best, achieving a sensitivity of 0.6322, balanced accuracy of 0.6177, F1‐score of 0.5729 and ROC‐AUC of 0.6774 in the independent test dataset. Electrical conductivity, milk yield and mastitis detection index showed the greatest mean absolute SHAP contributions. Limitations Most models showed modest sensitivity, and the single‐herd design limited external generalisability. Conclusion Routinely recorded automatic milking system variables showed potential to support mammary‐quarter‐level classification of subclinical mastitis.
Authors
- Larissa Cristina Brassolatti (ORCID: https://orcid.org/0000-0002-7336-4214)
- Debora Pompilio
- Teresa Cristina Alves (ORCID: https://orcid.org/0000-0002-2462-3996)
- Luiz Francisco Zafalon (ORCID: https://orcid.org/0000-0002-4645-3588)
- Simone Cristina Méo Niciura (ORCID: https://orcid.org/0000-0003-0046-0050)
- Anderson Ara
- Arthur Hideio Noguti (ORCID: https://orcid.org/0009-0008-9462-3984)
- Maria Laura da Silva Soarde
- Mariana Massoni Fraga (ORCID: https://orcid.org/0009-0000-1476-2012)
- Alan Vitor Lima Silva
- Mateus Galli da Silva
- Marcos Veiga dos Santos
Institutions
- Universidade de São Paulo (BR)
- Centro Universitário Central Paulista (BR)
- Embrapa Pecuária Sudeste (BR)
- Universidade Federal do Paraná (BR)
- Universidade Estadual Paulista (Unesp) (BR)
Publication Details
- Journal
- Veterinary Record
- Published
- 2026-11-27
- DOI
- https://doi.org/10.1002/vetr.71376
- Primary Topic
- Milk Quality and Mastitis in Dairy Cows
- Type
- article
- Field-Weighted Citation Impact
- 0.00