# A Literature Review of Modeling Approaches Applied to Data Collected in Automatic Milking Systems

^{*}

## Abstract

**:**

## Simple Summary

## Abstract

## 1. Introduction

## 2. Review Methodology and Results

## 3. Machine Learning Algorithms and Performance Metrics

## 4. Application of Modeling Approaches in AMS

#### 4.1. Health

#### 4.1.1. Mastitis

#### Variables Used to Detect Mastitis

#### Mastitis Alert List

#### Mastitis Indicators

#### Comparison between Modeling Approaches to Detect Mastitis

#### Presence of Mastitis Pathogens

#### 4.1.2. Other Diseases

#### 4.2. Cow Behaviour and Hard Management

- a full CNN that detects the landmarks in the image;
- a CNN that works with the probability map produced by the first CNN as input to detect the cows and their orientations.

#### 4.3. Production

## 5. Conclusions and Future Directions

## Supplementary Materials

## Author Contributions

## Funding

## Institutional Review Board Statement

## Informed Consent Statement

## Data Availability Statement

## Conflicts of Interest

## References

- Vijayakumar, M.; Park, J.H.; Ki, K.S.; Lim, D.H.; Kim, S.B.; Park, S.M.; Jeong, H.Y.; Park, B.Y.; Kim, T.I. The Effect of Lactation Number, Stage, Length, and Milking Frequency on Milk Yield in Korean Holstein Dairy Cows Using Automatic Milking System. Asian-Australas. J. Anim. Sci.
**2017**, 30, 1093. [Google Scholar] [CrossRef] [PubMed] - Tse, C.; Barkema, H.W.; DeVries, T.J.; Rushen, J.; Pajor, E.A. Impact of Automatic Milking Systems on Dairy Cattle Producers’ Reports of Milking Labour Management, Milk Production and Milk Quality. Animal
**2018**, 12, 2649–2656. [Google Scholar] [CrossRef] [PubMed] - Österman, S.; Redbo, I. Effects of Milking Frequency on Lying Down and Getting Up Behaviour in Dairy Cows. Appl. Anim. Behav. Sci.
**2001**, 70, 167–176. [Google Scholar] [CrossRef] [PubMed] - Jacobs, J.A.; Siegford, J.M. The Impact of Automatic Milking Systems on Dairy Cow Management, Behavior, Health, and Welfare. J. Dairy Sci.
**2012**, 95, 2227–2247. [Google Scholar] [CrossRef] - Miguel-Pacheco, G.G.; Kaler, J.; Remnant, J.; Cheyne, L.; Abbott, C.; French, A.P.; Bollard, N.J.; Mason, C.S.; Huxley, J.N. Behavioural Changes in Dairy Cows with Lameness in an Automatic Milking System. Appl. Anim. Behav. Sci.
**2014**, 150, 1–8. [Google Scholar] [CrossRef] - Gargiulo, J.I.; Lyons, N.A.; Kempton, K.; Armstrong, D.A.; Garcia, S.C. Physical and Economic Comparison of Pasture-Based Automatic and Conventional Milking Systems. J. Dairy Sci.
**2020**, 103, 8231–8240. [Google Scholar] [CrossRef] - Bonora, F.; Benni, S.; Barbaresi, A.; Tassinari, P.; Torreggiani, D. A Cluster-Graph Model for Herd Characterisation in Dairy Farms Equipped with an Automatic Milking System. Biosyst. Eng.
**2018**, 167, 1–7. [Google Scholar] [CrossRef] - Wolfert, S.; Ge, L.; Verdouw, C.; Bogaardt, M.J. Big Data in Smart Farming—A Review. Agric. Syst.
**2017**, 153, 69–80. [Google Scholar] [CrossRef] - Cockburn, M. Application and Prospective Discussion of Machine Learning for the Management of Dairy Farms. Animals
**2020**, 10, 1690. [Google Scholar] [CrossRef] - Nayeri, S.; Sargolzaei, M.; Tulpan, D. A Review of Traditional and Machine Learning Methods Applied to Animal Breeding. Anim. Health Res. Rev.
**2019**, 20, 31–46. [Google Scholar] [CrossRef] - Rebala, G.; Ravi, A.; Churiwala, S. Machine Learning Definition and Basics. In An Introduction to Machine Learning; Springer: Cham, Switzerland, 2019; pp. 1–17. [Google Scholar]
- Garcia, R.; Aguilar, J.; Toro, M.; Pinto, A.; Rodriguez, P. A Systematic Literature Review on the Use of Machine Learning in Precision Livestock Farming. Comput. Electron. Agric.
**2020**, 179, 105826. [Google Scholar] [CrossRef] - Wang, Z.; Shadpour, S.; Chan, E.; Rotondo, V.; Wood, K.M.; Tulpan, D. ASAS-NANP SYMPOSIUM: Applications of Machine Learning for Livestock Body Weight Prediction from Digital Images. J. Anim. Sci.
**2021**, 99, skab022. [Google Scholar] [CrossRef] - Brock, J.; Lange, M.; Tratalos, J.A.; More, S.J.; Graham, D.A.; Guelbenzu-Gonzalo, M.; Thulke, H.H. Combining Expert Knowledge and Machine-Learning to Classify Herd Types in Livestock Systems. Sci. Rep.
**2021**, 11, 2989. [Google Scholar] [CrossRef] - Rao, Y.; Jiang, M.; Wang, W.; Zhang, W.; Wang, R. On-Farm Welfare Monitoring System for Goats Based on Internet of Things and Machine Learning. Int. J. Distrib. Sens. Netw.
**2020**, 16, 1550147720944030. [Google Scholar] [CrossRef] - Carslake, C.; Vázquez-Diosdado, J.A.; Kaler, J. Machine Learning Algorithms to Classify and Quantify Multiple Behaviours in Dairy Calves Using a Sensor: Moving Beyond Classification in Precision Livestock. Sensors
**2021**, 21, 88. [Google Scholar] [CrossRef] - Higaki, S.; Miura, R.; Suda, T.; Andersson, L.M.; Okada, H.; Zhang, Y.; Ninomiya, S.; Oishi, K.; Yoshioka, K. Estrous Detection by Continuous Measurements of Vaginal Temperature and Conductivity with Supervised Machine Learning in Cattle. Theriogenology
**2019**, 123, 90–99. [Google Scholar] [CrossRef] - Bovo, M.; Agrusti, M.; Benni, S.; Torreggiani, D.; Tassinari, P. Random Forest Modelling of Milk Yield of Dairy Cows under Heat Stress Conditions. Animals
**2021**, 11, 1305. [Google Scholar] [CrossRef] - Gorczyca, M.T.; Gebremedhin, K.G. Ranking of Environmental Heat Stressors for Dairy Cows Using Machine Learning Algorithms. Comput. Electron. Agric.
**2020**, 168, 105124. [Google Scholar] [CrossRef] - Ren, K.; Bernes, G.; Hetta, M.; Karlsson, J. Tracking and Analysing Social Interactions in Dairy Cattle with Real-Time Locating System and Machine Learning. J. Syst. Archit.
**2021**, 116, 102139. [Google Scholar] [CrossRef] - Lokhorst, C.; De Mol, R.M.; Kamphuis, C. Invited Review: Big Data in Precision Dairy Farming. Animal
**2019**, 13, 1519–1528. [Google Scholar] [CrossRef] [Green Version] - Slob, N.; Catal, C.; Kassahun, A. Application of Machine Learning to Improve Dairy Farm Management: A Systematic Literature Review. Prev. Vet. Med.
**2021**, 187, 105237. [Google Scholar] [CrossRef] [PubMed] - Samuel, A.L. Some studies in machine learning using the game of checkers. IBM J. Res. Dev.
**2000**, 44, 206–226. [Google Scholar] [CrossRef] - Sharma, R.; Kamble, S.S.; Gunasekaran, A.; Kumar, V.; Kumar, A. A Systematic Literature Review on Machine Learning Applications for Sustainable Agriculture Supply Chain Performance. Comput. Oper. Res.
**2020**, 119, 104926. [Google Scholar] [CrossRef] - Sharma, D.; Kumar, N. A Review on Machine Learning Algorithms, Tasks and Applications. Int. J. Adv. Res.
**2017**, 6, 1548–1552. [Google Scholar] - Tarca, A.L.; Carey, V.J.; Chen, X.W.; Romero, R.; Drăghici, S. Machine Learning and Its Applications to Biology. PLoS Comput. Biol.
**2007**, 3, e116. [Google Scholar] [CrossRef] [Green Version] - Jordan, M.I.; Mitchell, T.M. Machine Learning: Trends, Perspectives, and Prospects. Science
**2015**, 349, 255–260. [Google Scholar] [CrossRef] - Kaelbling, L.P.; Littman, M.L.; Moore, A.W. Reinforcement Learning: A Survey. J. Artif. Intell. Res.
**1996**, 4, 237–285. [Google Scholar] [CrossRef] [Green Version] - Shalev-Shwartz, S.; Ben-David, S. Understanding Machine Learning: From Theory to Algorithms; Cambridge University Press: Cambridge, UK, 2014. [Google Scholar] [CrossRef]
- Ramsey, F.; Schafer, D. The Statistical Sleuth: A Course in Methods of Data Analysis, 1st ed.; Wadsworth Publishing Company: Belmont, CA, USA, 1996. [Google Scholar]
- Kingsford, C.; Salzberg, S.L. What are decision trees? Nat. Biotechnol.
**2008**, 26, 1011–1013. [Google Scholar] [CrossRef] - Biau, G.; Scornet, E. A Random Forest Guided Tour. Test
**2016**, 25, 197–227. [Google Scholar] [CrossRef] [Green Version] - Cielen, D.; Meysman, A.D.B.; Ali, M. Introducing Data Science: Big Data, Machine Learning, and More, Using Python Tools; Manning Publications Co.: New York, NY, USA, 2016. [Google Scholar]
- Vapnik, V.; Izmailov, R. Knowledge Transfer in SVM and Neural Networks. Ann. Math. Artif. Intell.
**2017**, 81, 3–19. [Google Scholar] [CrossRef] - Jensen, F.V.; Nielsen, T.D. Bayesian Networks and Decision Graphs; Springer: New York, NY, USA, 2007; Volume 2. [Google Scholar]
- Schmidhuber, J. Deep Learning in Neural Networks: An Overview. Neural Netw.
**2015**, 61, 85–117. [Google Scholar] [CrossRef] [Green Version] - Zadeh, L.A. Fuzzy Sets. Inf. Control
**1965**, 8, 338–353. [Google Scholar] [CrossRef] [Green Version] - Goldberg, D.E. Genetic Algorithms in Search Optimization and Machine Learning; Addison-Wesley: Reading, MA, USA, 1989. [Google Scholar]
- Shapiro, J. Genetic algorithms in machine learning. In Advanced Course on Artificial Intelligence; Springer: Berlin/Heidelberg, Germany, 1999; pp. 146–168. [Google Scholar]
- Benos, L.; Tagarakis, A.C.; Dolias, G.; Berruto, R.; Kateris, D.; Bochtis, D. Machine Learning in Agriculture: A Comprehensive Updated Review. Sensors
**2021**, 21, 3758. [Google Scholar] [CrossRef] - Melchior, M.B.; Vaarkamp, H.; Fink-Gremmels, J. Biofilms: A role in recurrent mastitis infections? Vet. J.
**2006**, 171, 398–407. [Google Scholar] [CrossRef] - Ebrahimie, E.; Ebrahimi, F.; Ebrahimi, M.; Tomlinson, S.; Petrovski, K.R. A large-scale study of indicators of sub-clinical mastitis in dairy cattle by attribute weighting analysis of milk composition features: Highlighting the predictive power of lactose and electrical conductivity. J. Dairy Res.
**2018**, 85, 193–200. [Google Scholar] [CrossRef] - Cavero, D.; Tölle, K.H.; Buxadé, C.; Krieter, J. Mastitis detection in dairy cows by application of fuzzy logic. Livest. Sci.
**2006**, 105, 207–213. [Google Scholar] [CrossRef] - Steeneveld, W.; van der Gaag, L.C.; Ouweltjes, W.; Mollenhorst, H.; Hogeveen, H. Discriminating between true-positive and false-positive clinical mastitis alerts from automatic milking system. J. Dairy Sci.
**2010**, 93, 2559–2568. [Google Scholar] [CrossRef] [Green Version] - Sharma, N.; Singh, N.K.; Bhadwal, M.S. Relationship of somatic cell count and mastitis: An overview. Asian-Australas. J. Anim. Sci.
**2011**, 24, 429–438. [Google Scholar] [CrossRef] - Zecconi, A.; Dell’Orco, F.; Vairani, D.; Rizzi, N.; Cipolla, M.; Zanini, L. Differential somatic cell count as a marker for changes of milk composition in cows with very low somatic cell count. Animals
**2020**, 10, 604. [Google Scholar] [CrossRef] [Green Version] - Bobbo, T.; Biffani, S.; Taccioli, C.; Penasa, M.; Cassandro, M. Comparison of machine learning methods to predict udder health status based on somatic cell counts in dairy cows. Sci. Rep.
**2021**, 11, 13642. [Google Scholar] [CrossRef] - Ebrahimie, E.; Ebrahimi, F.; Ebrahimi, M.; Tomlinson, S.; Petrovski, K.R. Hierarchical pattern recognition in milking parameters predicts mastitis prevalence. Comput. Electron. Agric.
**2018**, 147, 6–11. [Google Scholar] [CrossRef] - Norberg, E.; Hogeveen, H.; Korsgaard, I.R.; Friggens, N.C.; Sloth, K.H.M.N.; Løvendahl, P. Electrical conductivity of milk: Ability to predict mastitis status. J. Dairy Sci.
**2004**, 87, 1099–1107. [Google Scholar] [CrossRef] [PubMed] [Green Version] - Kamphuis, C.; Sherlock, R.; Jago, J.; Mein, G.; Hogeveen, H. Automatic detection of clinical mastitis is improved by in-line monitoring of somatic cell count. J. Dairy Sci.
**2008**, 91, 4560–4570. [Google Scholar] [CrossRef] [PubMed] [Green Version] - Mollenhorst, H.; Van der Tol, P.P.J.; Hogeveen, H. Somatic cell count assessment at the quarter or cow milking level. J. Dairy Sci.
**2010**, 93, 3358–3364. [Google Scholar] [CrossRef] [Green Version] - Khatun, M.; Clark, C.E.; Lyons, N.A.; Thomson, P.C.; Kerrisk, K.L.; García, S.C. Early detection of clinical mastitis from electrical conductivity data in an automatic milking system. Anim. Prod. Sci.
**2017**, 57, 1226–1232. [Google Scholar] [CrossRef] - Sun, Z.; Samarasinghe, S.; Jago, J. Detection of Mastitis and Its Stage of Progression by Automatic Milking Systems Using Artificial Neural Networks. J. Dairy Res.
**2010**, 77, 168–175. [Google Scholar] [CrossRef] [Green Version] - Hovinen, M.; Aisla, A.M.; Pyörälä, S. Accuracy and Reliability of Mastitis Detection with Electrical Conductivity and Milk Colour Measurement in Automatic Milking. Acta Agric. Scand. A Anim. Sci.
**2006**, 56, 121–127. [Google Scholar] [CrossRef] - Kamphuis, C.; Pietersma, D.; Van der Tol, R.; Wiedemann, M.; Hogeveen, H. Using sensor data patterns from an automatic milking system to develop predictive variables for classifying clinical mastitis and abnormal milk. Comput. Electron. Agric.
**2008**, 62, 169–181. [Google Scholar] [CrossRef] - Altay, Y.; Kılıç, B.; Aytekin, İ.; Keskin, İ. Determination of factors affecting mastitis in Holstein Friesian and Brown Swiss by using logistic regression analysis. Selcuk J. Agric. Food Sci.
**2019**, 33, 194–197. [Google Scholar] [CrossRef] - Chagunda, M.G.G.; Friggens, N.C.; Rasmussen, M.D.; Larsen, T. A model for detection of individual cow mastitis based on an indicator measured in milk. J. Dairy Sci.
**2006**, 89, 2980–2998. [Google Scholar] [CrossRef] [Green Version] - Friggens, N.C.; Chagunda, M.G.G.; Bjerring, M.; Ridder, C.; Hojsgaard, S.; Larsen, T. Estimating degree of mastitis from time-series measurements in milk: A test of a model based on lactate dehydrogenase measurements. J. Dairy Sci.
**2007**, 90, 5415–5427. [Google Scholar] [CrossRef] [Green Version] - Ankinakatte, S.; Norberg, E.; Løvendahl, P.; Edwards, D.; Højsgaard, S. Predicting mastitis in dairy cows using neural networks and generalized additive models: A comparison. Comput. Electron. Agric.
**2013**, 99, 1–6. [Google Scholar] [CrossRef] - Zank, W.; Schlatterer, B. Assessment of Subacute Mammary Inflammation by Soluble Biomarkers in Comparison to Somatic Cell Counts in Quarter Milk Samples from Dairy Cows. J. Vet. Med. Ser. A
**1998**, 45, 41–51. [Google Scholar] [CrossRef] - Nyman, A.K.; Emanuelson, U.; Waller, K.P. Diagnostic test performance of somatic cell count, lactate dehydrogenase, and N-acetyl-β-d-glucosaminidase for detecting dairy cows with intramammary infection. J. Dairy Sci.
**2016**, 99, 1440–1448. [Google Scholar] [CrossRef] [Green Version] - Penry, J.F.; Crump, P.M.; Ruegg, P.L.; Reinemann, D.J. Cow-and quarter-level milking indicators and their associations with clinical mastitis in an automatic milking system. J. Dairy Sci.
**2017**, 100, 9267–9272. [Google Scholar] [CrossRef] [Green Version] - Naqvi, S.A.; King, M.T.; Matson, R.D.; DeVries, T.J.; Deardon, R.; Barkema, H.W. Mastitis detection with recurrent neural networks in farms using automated milking systems. Comput. Electron. Agric.
**2022**, 192, 106618. [Google Scholar] [CrossRef] - Naqvi, S.A.; King, M.T.; DeVries, T.J.; Barkema, H.W.; Deardon, R. Data considerations for developing deep learning models for dairy applications: A simulation study on mastitis detection. Comput. Electron. Agric.
**2022**, 196, 106895. [Google Scholar] [CrossRef] - Bonestroo, J.; van der Voort, M.; Hogeveen, H.; Emanuelson, U.; Klaas, I.C.; Fall, N. Forecasting chronic mastitis using automatic milking system sensor data and gradient-boosting classifiers. Comput. Electron. Agric.
**2022**, 198, 107002. [Google Scholar] [CrossRef] - Mollenhorst, H.; Rijkaart, L.J.; Hogeveen, H. Mastitis alert preferences of farmers milking with automatic milking systems. J. Dairy Sci.
**2012**, 95, 2523–2530. [Google Scholar] [CrossRef] [Green Version] - De Mol, R.M.; Ouweltjes, W. Detection model for mastitis in cows milked in an automatic milking system. Prev. Vet. Med.
**2001**, 49, 71–82. [Google Scholar] [CrossRef] - de Mol, R.D.; Woldt, W.E. Application of fuzzy logic in automated cow status monitoring. J. Dairy Sci.
**2001**, 84, 400–410. [Google Scholar] [CrossRef] [PubMed] [Green Version] - Khamaysa Hajaya, M.; Samarasinghe, S.; Kulasiri, G.D.; Lopez Benavides, M. Detection of dairy cattle Mastitis: Modelling of milking features using deep neural networks. In Proceedings of the 23rd International Congress on Modelling and Simulation, Canberra, ACT, Australia, 1–6 December 2019; pp. 1656–1662. [Google Scholar]
- Steeneveld, W.; van der Gaag, L.C.; Barkema, H.W.; Hogeveen, H. Simplify the interpretation of alert lists for clinical mastitis in automatic milking systems. Comput. Electron. Agric.
**2010**, 71, 50–56. [Google Scholar] [CrossRef] - Kamphuis, C.; Mollenhorst, H.; Heesterbeek, J.A.P.; Hogeveen, H. Data Mining to Detect Clinical Mastitis with Automatic Milking. In Proceedings of the 5th IDF Mastitis Conference: Mastitis Research into Practice, Christchurch, New Zealand, 21–24 March 2010; pp. 568–572. [Google Scholar]
- Kamphuis, C.; Mollenhorst, H.; Heesterbeek, J.A.P.; Hogeveen, H. Detection of clinical mastitis with sensor data from automatic milking systems is improved by using decision-tree induction. J. Dairy Sci.
**2010**, 93, 3616–3627. [Google Scholar] [CrossRef] [PubMed] [Green Version] - Bausewein, M.; Mansfeld, R.; Doherr, M.G.; Harms, J.; Sorge, U.S. Sensitivity and Specificity for the Detection of Clinical Mastitis by Automatic Milking Systems in Bavarian Dairy Herds. Animals
**2022**, 12, 2131. [Google Scholar] [CrossRef] [PubMed] - Højsgaard, S.; Friggens, N.C. Quantifying degree of mastitis from common trends in a panel of indicators for mastitis in dairy cows. J. Dairy Sci.
**2020**, 93, 582–592. [Google Scholar] [CrossRef] [Green Version] - Sørensen, L.P.; Bjerring, M.; Løvendahl, P. Monitoring individual cow udder health in automated milking systems using online somatic cell counts. J. Dairy Sci.
**2016**, 99, 608–620. [Google Scholar] [CrossRef] [Green Version] - Cavero, D.; Tölle, K.H.; Henze, C.; Buxadé, C.; Krieter, J. Mastitis detection in dairy cows by application of neural networks. Livest. Sci.
**2008**, 114, 280–286. [Google Scholar] [CrossRef] - Krieter, J.; Cavero, D.; Henze, C. Mastitis detection in dairy cows using neural networks. In Agrarinformatik im Spannungsfeld zwischen Regionalisierung und Globalen Wertschöpfungsketten–Referate der 27; GIL Jahrestagung: Bonn, Germany, 2017. [Google Scholar]
- Mammadova, N.; Keskin, I. Application of the support vector machine to predict subclinical mastitis in dairy cattle. Sci. World J.
**2013**, 2013, 603897. [Google Scholar] [CrossRef] [Green Version] - Mammadova, N.M.; Keskin, I. Application of neural network and adaptive neuro-fuzzy inference system to predict subclinical mastitis in dairy cattle. Indian J. Anim. Res.
**2015**, 49, 671–679. [Google Scholar] [CrossRef] [Green Version] - Mammadova, N.M.; Keskin, I. Subclinical mastitis prediction in dairy cattle by application of Fuzzy Logic. Pak. J. Agric. Sci.
**2015**, 52, 1101–1107. [Google Scholar] - Anglart, D.; Hallén-Sandgren, C.; Emanuelson, U.; Rönnegård, L. Comparison of methods for predicting cow composite somatic cell counts. J. Dairy Sci.
**2020**, 103, 8433–8442. [Google Scholar] [CrossRef] - Ebrahimi, M.; Mohammadi-Dehcheshmeh, M.; Ebrahimie, E.; Petrovski, K.R. Comprehensive analysis of machine learning models for prediction of sub-clinical mastitis: Deep Learning and Gradient-Boosted Trees outperform other models. Comput. Biol. Med.
**2019**, 114, 103456. [Google Scholar] [CrossRef] - Tian, F.; Wang, Z.; Yu, S.; Xiong, B.; Wang, S. Clinical mastitis detection by on-line measurements of milk yield, electrical conductivity and deep Learn. J. Phys. Conf. Ser.
**2020**, 1635, 012046. [Google Scholar] [CrossRef] - Ghafoor, A.N.; Sitkowska, B. MasPA: A Machine Learning Application to Predict Risk of Mastitis in Cattle from AMS Sensor Data. AgriEngineering
**2021**, 3, 575–583. [Google Scholar] [CrossRef] - Kamphuis, C.; Mollenhorst, H.; Hogeveen, H. Sensor Measurements Revealed: Predicting the Gram-Status of Clinical Mastitis Causal Pathogens. Comput. Electron. Agric.
**2011**, 77, 86–94. [Google Scholar] [CrossRef] [Green Version] - Hassan, K.J.; Samarasinghe, S.; Lopez-Benavides, M.G. Use of neural networks to detect minor and major pathogens that cause bovine mastitis. J. Dairy Sci.
**2009**, 92, 1493–1499. [Google Scholar] [CrossRef] - Horpiencharoen, W.; Thongratsakul, S.; Poolkhet, C. Risk factors of clinical mastitis and antimicrobial susceptibility test results of mastitis milk from dairy cattle in western Thailand: Bayesian network analysis. Prev. Vet. Med.
**2019**, 164, 49–55. [Google Scholar] [CrossRef] - Steeneveld, W.; van der Gaag, L.C.; Barkema, H.W.; Hogeveen, H. Providing probability distributions for the causal pathogen of clinical mastitis using naive Bayesian networks. J. Dairy Sci.
**2009**, 92, 2598–2609. [Google Scholar] [CrossRef] [Green Version] - Castro, A.; Pereira, J.M.; Amiama, C.; Bueno, J. Mastitis diagnosis in ten Galician dairy herds (NW Spain) with automatic milking systems. Span. J. Agric. Res.
**2015**, 13, e0504. [Google Scholar] [CrossRef] [Green Version] - Liberati, P.; Zappavigna, P. Improving the automated monitoring of dairy cows by integrating various data acquisition systems. Comput. Electron. Agric.
**2009**, 68, 62–67. [Google Scholar] [CrossRef] - Steensels, M.; Antler, A.; Bahr, C.; Berckmans, D.; Maltz, E.; Halachmi, I. A decision-tree model to detect post-calving diseases based on rumination, activity, milk yield, BW and voluntary visits to the milking robot. Animal
**2016**, 10, 1493–1500. [Google Scholar] [CrossRef] [PubMed] [Green Version] - Zhou, X.; Xu, C.; Wang, H.; Xu, W.; Zhao, Z.; Chen, M.; Jia, B.; Huang, B. The Early Prediction of Common Disorders in Dairy Cows Monitored by Automatic Systems with Machine Learning Algorithms. Animals
**2022**, 12, 1251. [Google Scholar] [CrossRef] [PubMed] - Scott, V.E.; Thomson, P.C.; Kerrisk, K.L.; Garcia, S.C. Influence of provision of concentrate at milking on voluntary cow traffic in a pasture-based automatic milking system. J. Dairy Sci.
**2014**, 97, 1481–1490. [Google Scholar] [CrossRef] [PubMed] - Adamczyk, K.; Cywicka, D.; Herbut, P.; Trześniowska, E. The application of cluster analysis methods in assessment of daily physical activity of dairy cows milked in the Voluntary Milking System. Comput. Electron. Agric.
**2017**, 141, 65–72. [Google Scholar] [CrossRef] - Tscharke, M.; Banhazi, T.M. A brief review of the application of machine vision in livestock behaviour analysis. J. Agric. Inform.
**2016**, 7, 23–42. [Google Scholar] [CrossRef] [Green Version] - Guzhva, O.; Ardö, H.; Herlin, A.; Nilsson, M.; Åström, K.; Bergsten, C. Feasibility study for the implementation of an automatic system for the detection of social interactions in the waiting area of automatic milking stations by using a video surveillance system. Comput. Electron. Agric.
**2016**, 127, 506–509. [Google Scholar] [CrossRef] - Guzhva, O.; Ardö, H.; Nilsson, M.; Herlin, A.; Tufvesson, L. Now you see me: Convolutional neural network based tracker for dairy cows. Front. Robot. AI
**2018**, 6, 107. [Google Scholar] [CrossRef] [Green Version] - Jensen, D.B.; van der Voort, M.; Hogeveen, H. Dynamic forecasting of individual cow milk yield in automatic milking systems. J. Dairy Sci.
**2018**, 101, 10428–10439. [Google Scholar] [CrossRef] - Jensen, D.B.; Hogeveen, H.; De Vries, A. Bayesian integration of sensor information and a multivariate dynamic linear model for prediction of dairy cow mastitis. J. Dairy Sci.
**2016**, 99, 7344–7361. [Google Scholar] [CrossRef] [Green Version] - Ghiasi, H.; Piwczyński, D.; Khaldari, M.; Kolenda, M. Application of classification trees in determining the impact of phenotypic factors on conception to first service in Holstein cattle. Anim. Prod. Sci.
**2015**, 56, 1061–1069. [Google Scholar] [CrossRef] - Piwczyński, D.; Sitkowska, B.; Kolenda, M.; Brzozowski, M.; Aerts, J.; Schork, P.M. Forecasting the milk yield of cows on farms equipped with automatic milking system with the use of decision trees. Anim. Sci. J.
**2020**, 91, e13414. [Google Scholar] [CrossRef] - Kliś, P.; Sawa, A.; Piwczyński, D.; Sitkowska, B.; Bogucki, M. Prediction of cow’s fertility based on data recorded by automatic milking system during the periparturient period. Reprod. Dom. Anim.
**2021**, 56, 1227–1234. [Google Scholar] [CrossRef] - Breiman, L.; Friedman, J.H.; Olshen, R.A.; Stone, C.J. Classification and Regression Trees; Wadsworth S: Pacific Grove, CA, USA, 1984. [Google Scholar]
- Kliś, P.; Piwczyński, D.; Sawa, A.; Sitkowska, B. Prediction of lactational milk yield of cows based on data recorded by AMS during the periparturient period. Animals
**2021**, 11, 383. [Google Scholar] [CrossRef] - Kadzere, C.T.; Murphy, M.R.; Silanikove, N.; Maltz, E. Heat stress in lactating dairy cows: A review. Livest. Prod. Sci.
**2002**, 77, 59–91. [Google Scholar] [CrossRef] - Fuentes, S.; Gonzalez Viejo, C.; Cullen, B.; Tongson, E.; Chauhan, S.S.; Dunshea, F.R. Artificial intelligence applied to a robotic dairy farm to model milk productivity and quality based on cow data and daily environmental parameters. Sensors
**2020**, 20, 2975. [Google Scholar] [CrossRef] - Ji, B.; Banhazi, T.; Phillips, C.J.; Wang, C.; Li, B. A machine learning framework to predict the next month’s daily milk yield, milk composition and milking frequency for cows in a robotic dairy farm. Biosyst. Eng.
**2022**, 216, 186–197. [Google Scholar] [CrossRef]

**Figure 1.**Geographical distribution of the 60 contributing studies in modeling approaches in farms equipped with AMS, considering the location of the dataset collection.

**Figure 3.**Types of supervised and unsupervised machine learning. Problems are grouped into four main classes: classification, clustering, regression, and dimensionality reduction based on data type (discrete or continuous) and learning style (supervised or unsupervised) (adapted from [10]).

**Table 1.**Modeling techniques used in the studies reviewed (adapted from [24]).

Algorithm | Description |
---|---|

Regression analysis | Regression analysis is a statistical technique used to describe the relationships between variables. It allows predicting certain characteristics of output values based on input values [30]. It includes classical models such as simple and multiple linear regression, logistic regression, Generalized Linear Models (GLM), Generalized Additive Models (GAM), linear mixed models, polynomial regression, and time series. |

Decision Tree (DT) | A decision tree (DT) is a predictor that associates the features values with a label of a data instance by traveling from a root node to a leaf of a tree structure. Each node represents the splitting of the input space [29]. The feature or the value to be used for this splitting depends on the problem. A common splitting rule is the maximization of the Information Gain, which is the reduction in information entropy on split groups. When used for regression problems, it is called CART, an acronym for Classification and Regression Trees. |

Random Forest (RF) | Random Forest (RF) is an ensemble classification model that combines several randomized decision trees. These decision trees are models that classify random subsets of the data where each subset contains responses of one class (either “yes” or “no”) [31]. Additionally, different trees can also use different sets of features to be trained or different random subsets of the data. For the RF outcome, the decision trees predictions are combined in a disambiguation method, for example, averaging [32] in the case of regression problems or major |

AdaBoost | AdaBoost stands for Adaptive Boosting. It is also referred to generically as Gradient Boosting. It combines sequentially the result of many weak decision trees. The first decision tree takes the raw data as input. The others receive as input the data weighted by the prediction errors of the previous classifier. Thus, each decision tree will adjust the prediction of the previous classifier. |

k-Nearest Neighbors (k-NN) | The k-Nearest Neighbors (k-NN) algorithm examines labeled points in proximity to an unlabeled point, utilizing this information to predict the appropriate label [33]. Therefore, the learning strategy of k-NN is memorizing instead of finding relationships among features. |

Support Vector Machine (SVM) | The objective of the Support Vector Machine (SVM) algorithm is to find the boundaries that maximize the distance of a multi-dimensional plane that separates the classes to be modeled. It uses the geometrical properties of the data to build these multi-dimensional boundaries between data points in the feature space belonging to different classes [34]. |

Bayesian Networks (BN) | Bayesian networks (BN) are a form of probabilistic graphical model that utilizes Bayesian inference for probability calculations. The primary objective of Bayesian networks is to capture conditional dependence and, consequently, causation by representing conditional dependence by edges in a directed graph [35]. The Naïve version assumes independence amongst the features, while the Tree-Augmented version also allows modeling the dependency amongst the features themselves. |

Neural Networks (NN) | A Neural Network (NN) is a computational model that consists of three types of layers: an input layer, hidden layers, and an output layer. Each layer is comprised of nodes, also known as neurons. The outputs of each neuron are transformed using a nonlinear function and then passed to the subsequent layers through weighted connections between neurons. The input layer receives numerical data representation, while the output layer generates predictions. The hidden layers carry out nonlinear transformations on the data [36]. Various types of NN include Multilayer Perceptron (MLP), Back Propagation Neural Network (BPNN or NN for short, since this is the most used neural network), Probabilistic Neural Network (PNN), Recurrent Neural Network (RNN), Convolutional Neural Network (CNN). A CNN is a Deep Learning algorithm, which means that its network architecture usually needs a high number of hidden layers. The CNN takes in an input image, and, in these hidden layers, it assigns importance (learnable weights and biases) to various aspects/objects in the image. Then, this transformed image is used for the classification in the output layer. |

Self-Organizing Maps (SOM) | Self-Organizing Maps (SOM) are a different type of Neural Network. They show only one layer with a predefined number of nodes. These nodes are linked to the input data and the value associated with these connections represents the distance between them. Thus, the SOM can be seen as a two-dimensional representation of the data, in which the data structure is preserved. The most common use of this algorithm is in clustering analysis, which requires a post-processing phase in which the SOM nodes will be clustered. |

Clustering Algorithms | Clustering algorithms are designed to partition objects into groups, known as clusters, based on measures of similarity and dissimilarity among the objects. The goal is to maximize the similarity among objects of the same cluster and, at the same time, maximize the dissimilarity among objects that belong to different clusters. Examples of these measures include one minus correlation and Euclidean distance. Two commonly used clustering techniques are hierarchical clustering (HC) and k-means clustering. Hierarchical clustering creates a hierarchical tree-like structure, where the length of the branches represents the dissimilarity between clusters. The hierarchical tree is cut at some point and the branches that are separated at this cut will define the clusters of the objects.The k-means clustering algorithm starts with random cluster centers (k), the number of these clusters is specified by the user [26]. The data points are assigned to the nearest cluster center. The center clusters are, then, redefined according to the new cluster configuration. This process is repeated iteratively until the cluster centers are no longer modified or until a maximum number of iterations. |

Fuzzy logic | In Fuzzy Logic theory, the objects do not belong exclusively to one set (or class) or to another. Instead, they have a continuum of grades of membership to all classes, varying from 0 to 1 [37]. Fuzzy logic-based decision support systems usually follow three basic steps. First, the input values are fuzzified by the assignment of the membership functions. Second, a set of logic rules are applied to transform the input values, generating the output. Lastly, these outputs are defuzzified to generate the crisp system prediction. It is a method specifically designed to handle situations where there are highly non-linear relationships between input and output variables, aiming to achieve the optimal solution. As a special case, the Adaptive Neuro Fuzzy Inference System (ANFIS) is a NN to map numerical inputs into an output through fuzzy-based rules. |

Genetic Algorithms (GA) | Genetic Algorithms (GA) are search algorithms of the family of Evolutionary Algorithms based on the mechanics of natural selection and natural genetics [38]. The individuals are the possible solutions for the problem to be optimized. The set of these individuals that evolve together form the algorithm’s population, and the fitness of the individuals is the criteria for a probabilistic selection of the solutions, in which the better the fitness, the higher the probability of that individual being selected for the next generation. This type of stochastic search algorithm is often used in ML applications [39]. GAs are used in discrete spaces and find applications in cases where other gradient-based methods are not applicable. GAs are well-suited for situations where the availability of information plays a crucial role in performance [24]. |

**Table 2.**Summary of the most used performance metrics for classification tasks [29].

Performance Metric | Formula | Description |
---|---|---|

Accuracy | $\frac{\mathrm{T}\mathrm{P}+\mathrm{T}\mathrm{N}}{\mathrm{T}\mathrm{P}+\mathrm{T}\mathrm{N}+\mathrm{F}\mathrm{P}+\mathrm{F}\mathrm{N}}$ | It is the ratio between the number of correct predictions versus the total number of input samples. |

Error rate | $\frac{\mathrm{F}\mathrm{P}+\mathrm{F}\mathrm{N}}{\mathrm{T}\mathrm{P}+\mathrm{T}\mathrm{N}+\mathrm{F}\mathrm{P}+\mathrm{F}\mathrm{N}}$ | It is the ratio between the number of wrong predictions versus the total number of input samples. |

Sensitivity (Recall) | $\frac{\mathrm{T}\mathrm{P}}{\mathrm{T}\mathrm{P}+\mathrm{F}\mathrm{N}}$ | It measures the proportion of correctly identified positive values. |

Specificity | $\frac{\mathrm{T}\mathrm{N}}{\mathrm{T}\mathrm{N}+\mathrm{F}\mathrm{P}}$ | It measures the proportion of correctly identified negative values. |

Precision | $\frac{\mathrm{T}\mathrm{P}}{\mathrm{T}\mathrm{P}+\mathrm{F}\mathrm{P}}$ | It is the proportion of positive predictions that are correct. |

F1 score | $2\times \frac{(\mathrm{p}\mathrm{r}\mathrm{e}\mathrm{c}\mathrm{i}\mathrm{s}\mathrm{i}\mathrm{o}\mathrm{n}\times \mathrm{r}\mathrm{e}\mathrm{c}\mathrm{a}\mathrm{l}\mathrm{l})}{\mathrm{T}(\mathrm{p}\mathrm{r}\mathrm{e}\mathrm{c}\mathrm{i}\mathrm{s}\mathrm{i}\mathrm{o}\mathrm{n}+\mathrm{r}\mathrm{e}\mathrm{c}\mathrm{a}\mathrm{l}\mathrm{l})}$ | It combines precision and sensitivity in a harmonic mean. |

Matthews correlation coefficient (MCC) | $\frac{\mathrm{T}\mathrm{P}\times \mathrm{T}\mathrm{N}+\mathrm{F}\mathrm{P}\times \mathrm{F}\mathrm{N}}{\sqrt{\left(\mathrm{T}\mathrm{P}+\mathrm{F}\mathrm{P}\right)\times \left(\mathrm{T}\mathrm{P}+\mathrm{F}\mathrm{N}\right)\times \left(\mathrm{T}\mathrm{N}+\mathrm{F}\mathrm{P}\right)\times (\mathrm{T}\mathrm{N}+\mathrm{F}\mathrm{N})}}$ | It considers all four values in the confusion matrix, and a high value (close to 1) means that both classes are predicted well |

Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |

© 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Ozella, L.; Brotto Rebuli, K.; Forte, C.; Giacobini, M.
A Literature Review of Modeling Approaches Applied to Data Collected in Automatic Milking Systems. *Animals* **2023**, *13*, 1916.
https://doi.org/10.3390/ani13121916

**AMA Style**

Ozella L, Brotto Rebuli K, Forte C, Giacobini M.
A Literature Review of Modeling Approaches Applied to Data Collected in Automatic Milking Systems. *Animals*. 2023; 13(12):1916.
https://doi.org/10.3390/ani13121916

**Chicago/Turabian Style**

Ozella, Laura, Karina Brotto Rebuli, Claudio Forte, and Mario Giacobini.
2023. "A Literature Review of Modeling Approaches Applied to Data Collected in Automatic Milking Systems" *Animals* 13, no. 12: 1916.
https://doi.org/10.3390/ani13121916