Application of Machine Learning Models for the Early Detection of Metritis in Dairy Cows Based on Physiological, Behavioural and Milk Quality Indicators

  • 0Animal Clinic, Veterinary Academy, Lithuania University of Health Sciences, Tilžės Str. 18, LT-47181 Kaunas, Lithuania.
Animals : an open access journal from MDPI +

|

Abstract

Metritis is one of the most common postpartum diseases in dairy cows, associated with impaired reproductive performance and substantial economic losses. In this study, we investigated the potential of machine learning (ML) techniques applied to physiological, behavioural, and milk quality parameters for the early detection of metritis in dairy cows during the postpartum period. A total of 2707 daily observations were collected from 94 cows in early lactation, of which 11 cows (275 records) were diagnosed with metritis. The dataset included daily measurements of body weight, rumination time, milk yield, milk composition (fat, protein, lactose), somatic cell count (SCC), and feed intake. Five classification models-partial least squares discriminant analysis (PLS-DA), random forest (RF), support vector machine (SVM), neural network (NN), and an Ensemble model-were developed using standardised features and stratified 80/20 training/test splits. To address class imbalance, model loss functions were adjusted using class weights. Models were evaluated based on accuracy, sensitivity, specificity, positive and negative predictive values (PPV, NPV), area under the receiver operating characteristic (ROC) area under the curve (AUC), and Matthews correlation coefficient (MCC). The NN model demonstrated the highest overall performance (accuracy = 96.1%, AUC = 96.3%, MCC = 0.79), indicating strong capability in distinguishing both healthy and diseased animals. The SVM achieved the highest sensitivity (90.9%), while RF and Ensemble models showed high specificity (>98%) and PPV. This study provides novel evidence that ML methods can effectively detect metritis using routinely collected, non-invasive on-farm data. Our findings support the integration of neural and Ensemble learning models into automated health monitoring systems to enable earlier disease detection and improved animal welfare. Although external validation was not performed, internal cross-validation demonstrated consistent performance across models, suggesting suitability for application in multi-farm settings. To the best of our knowledge, this is among the first studies to apply ML for early metritis detection based exclusively only automated herd data.

Related Concept Videos