PetCaseFinder

Peer-reviewed veterinary case report

Machine learning for detection of subclinical mastitis: A Bayesian approach incorporating diagnostic test properties.

Journal:
Preventive veterinary medicine
Year:
2026
Authors:
Olofsson, Charlott et al.
Affiliation:
Department of Production Animal Clinical Sciences

Abstract

The large amount of data collected through automatic milking systems (AMS) may be used for early detection of intramammary infections and become instrumental for monitoring udder health in dairy herds. Machine learning (ML) techniques can aid in improving diagnostic test properties of current indicators of subclinical mastitis (SCM). In this study, we present novel customized ML models for predicting SCM from AMS data. We show how results from several diagnostic tests can be incorporated into ML model training by explicitly accounting for their sensitivity and specificity. The underlying infection status was modeled as a latent variable derived from bacteriological culture (BC) and polymerase chain reaction (PCR) results on milk samples. Model performance was evaluated using a customized log-likelihood (CLL) function, addressing uncertainty in prediction target, and compared with traditional metrics using simulated data. Our study demonstrates that incorporating prior knowledge of sensitivity and specificity of the tests directly into the likelihood function during model training enables reliable ML even in scenarios with an imperfect target variable. The customized models achieved the highest CLL scores on real data and demonstrated significantly better calibration on simulated data. At the same time, all models showed similarly near-perfect area under the curve (AUC) on simulated data. Further validation across herds is needed, but our approach shows promise for robust SCM prediction from AMS data using ML. The framework is applicable to other scenarios in veterinary epidemiology with imperfectly measured outcomes.

Find similar cases for your pet

PetCaseFinder finds other peer-reviewed reports of pets with the same symptoms, plus a plain-English summary of what was tried across them.

Search related cases →

Original publication: https://pubmed.ncbi.nlm.nih.gov/41666665/