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

Institutions

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
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
NOV
article

Detecting subclinical mastitis in dairy cattle by using machine learning techniques to analyse automated milking system data

Larissa Cristina Brassolatti, Debora Pompilio, Teresa Cristina Alves, Luiz Francisco Zafalon et al.
Veterinary Record
Milk Quality and Mastitis in Dairy Cows
article

Detecting subclinical mastitis in dairy cattle by using machine learning techniques to analyse automated milking system data

Larissa Cristina Brassolatti, Debora Pompilio, Teresa Cristina Alves, Luiz Francisco Zafalon, Simone Cristina Méo Niciura, Anderson Ara, Arthur Hideio Noguti, Maria Laura da Silva Soarde, Mariana Massoni Fraga, Alan Vitor Lima Silva, Mateus Galli da Silva, Marcos Veiga dos Santos
article en

Abstract

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.

Veterinary Record
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)
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.

Laika access coming soon