Please login first
Farm-specific effects in predicting mastitis by applying machine learning models to automatic milking system (AMS) data
* 1 , 2 , 3 , 4 , 4 , 1
1  Institute of Veterinary Epidemiology & Biostatistics, School of Veterinary Medicine, Free University of Berlin, Germany. Könogsweg 67, 14163, Berlin, Germany
2  Joint-Lab Artificial Intelligence and Data Science, University Osnabrück, Hamburger Straße 24, 49084, Osnabrück, Germany
3  Institute for Animal Hygiene and Environmental Health, School of Veterinary Medicine, Freie Universität Berlin, Robert-Von-Ostertag-Str. 13-17, Building 35, 14163, Berlin, Germany.
4  Department of Sensors and Modelling, Leibniz Institute for Agricultural Engineering and Bioeconomy e.V. (ATB), Max-Eyth-Allee 100, 14469, Potsdam, Germany.
Academic Editor: Colin Scanes

Abstract:

Introduction

Mastitis, a prevalent and costly disease in dairy farming, significantly impacts milk production and quality. Early and accurate prediction of mastitis is crucial for effective herd management and minimizing economic losses. This study investigated the effects of farm-specific factors on the accuracy of mastitis predictions by applying machine learning (ML) models to AMS data.

Methods

We collected and analyzed a large dataset consisting of 2.73 million observations over the period of 2019–2022, from two dairy farms in Germany. Six ML algorithms, i.e., Logistic Regression, Support Vector Machines, Decision Tree, Random Forest, Multi-Layer Perceptron Neural Networks and Gradient Boosting Decision Tree, were applied to predict mastitis occurrence, with a focus on understanding how farm-specific factors like herd size, management practices, and farm environment influence prediction accuracy.

Results

For training and testing on both farms combined, the accuracy, sensitivity and specificity were estimated at 0.89–0.93, 0.79–0.92 and 0.89–0.93, respectively. When training and testing both individual farms separately, the accuracy, sensitivity and specificity estimates were (i) 0.85–0.93, 0.73–0.91 and 0.85–0.93 for the large farm, and (ii) 0.89–0.96, 0.63–0.89 and 0.89–0.96 for the small farm, respectively. However, after training the models on the combined dataset over a period of three years (2019–2021) and testing on each farm individually for year 2022, the accuracy, sensitivity and specificity estimates were (i) 0.78-0.94, 0.85–0.98 and 0.78–0.94 (large farm), and (ii) 0.92–0.98, 0.70–0.96 and 0.92–0.98 (small farm), respectively. The analysis determined that sensitivity scores for the large farm and accuracy, sensitivity and specificity scores for the small farm improved significantly by training models on combined data but testing each farm separately.

Conclusion

Our findings suggest that training ML models on a combined database and testing with an approach tailored to each farm’s unique characteristics seem to be a feasible approach to improve mastitis prediction.

Keywords: farm-specific effects; mastitis prediction; automatic milking systems; machine learning models; time series data modeling
Top