Register      Login
Animal Production Science Animal Production Science Society
Food, fibre and pharmaceuticals from animals
RESEARCH ARTICLE (Open Access)

Application of machine-learning algorithms to predict calving difficulty in Holstein dairy cattle

Mahdieh Avizheh A , Mohammad Dadpasand A , Elena Dehnavi https://orcid.org/0000-0001-8238-6290 B and Hamideh Keshavarzi https://orcid.org/0000-0003-4987-4326 C *
+ Author Affiliations
- Author Affiliations

A Department of Animal Science, School of Agriculture, Shiraz University, Shiraz, Iran.

B AGBU, a Joint Venture of NSW Department of Primary Industries and University of New England, Armidale, NSW 2351, Australia.

C Agriculture and Food, Commonwealth Scientific and Industrial Research Organisation (CSIRO), Armidale, NSW 2350, Australia.

* Correspondence to: Hamideh.Keshavarzi@csiro.au

Handling Editor: Sue Hatcher

Animal Production Science 63(11) 1095-1104 https://doi.org/10.1071/AN22461
Submitted: 14 December 2022  Accepted: 24 April 2023   Published: 15 May 2023

© 2023 The Author(s) (or their employer(s)). Published by CSIRO Publishing. This is an open access article distributed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License (CC BY-NC-ND)

Abstract

Context: An ability to predict calving difficulty could help farmers make better farm-management decisions, thereby improving dairy farm profitability and welfare.

Aims: This study aimed to predict calving difficulty in Iranian dairy herds using machine-learning (ML) algorithms and to evaluate sampling methods to deal with imbalanced datasets.

Methods: For this purpose, the history records of cows that calved between 2011 and 2021 on two commercial dairy farms were used. Using WEKA software, four commonly used ML algorithms, namely naïve Bayes, random forest, decision trees, and logistic regression, were applied to the dataset. The calving difficulty was considered as a binary trait with 0, normal or unassisted calving, and 1, difficult calving, i.e. receiving any help during parturition from farm personnel involvement to surgical intervention. The average rate of difficult calving was 18.7%, representing an imbalanced dataset. Therefore, down-sampling and cost-sensitive techniques were implemented to tackle this problem. Different models were evaluated on the basis of F-measure and the area under the curve.

Key results: The results showed that sampling techniques improved the predictive model (P = 0.07, and P = 0.03, for down-sampling and cost-sensitive techniques respectively). F-measure ranged from 0.387 (decision tree) to 0.426 (logistic regression) with the balanced dataset. However, when applied to the original imbalanced dataset, naïve Bayes had the best performance of up to 0.388 in terms of F-measure.

Conclusions: Overall, sampling techniques improved the prediction model compared with original imbalanced dataset. Although prediction models performed worse than expected (due to an imbalanced dataset, and missing values), the implementation of ML algorithms can still lead to an effective method of predicting calving difficulty.

Implications: This research indicated the capability of ML algorithms to predict the incidence of calving difficulty within a balanced dataset, but that more explanatory variables (e.g. genetic information) are required to improve the prediction based on an unbalanced original dataset.

Keywords: cost-sensitive technique, dairy cow, difficult calving, down-sampling, herd–cow factors, imbalanced dataset, machine-learning algorithms, predictive models.


References

Antanaitis R, Juozaitienė V, Malašauskienė D, Televičius M, Urbutis M, Baumgartner W (2021) Influence of calving ease on in-line milk lactose and other milk components. Animals 11, 842
Influence of calving ease on in-line milk lactose and other milk components.Crossref | GoogleScholarGoogle Scholar |

Atashi H, Abdolmohammadi A, Dadpasand M, Asaadi A (2012) Prevalence, risk factors and consequent effect of dystocia in Holstein dairy cows in Iran. Asian–Australasian Journal of Animal Sciences 25, 447–451.
Prevalence, risk factors and consequent effect of dystocia in Holstein dairy cows in Iran.Crossref | GoogleScholarGoogle Scholar |

Baaken D, Hess S (2021) Forecasting regional milk production quantity: a comparison of regression models and machine learning. In ‘2021 Conference, Virtual 315117’, 17–31 August 2021. (International Association of Agricultural Economists)

Bekkar M, Djemaa HK, Alitouche TA (2013) Evaluation measures for models assessment over imbalanced data sets. Journal of Information Engineering and Applications 3, 27–38.

Boakari YL, Ali HE-S (2021) Management to prevent dystocia. In ‘Bovine reproduction’. (Ed. RM Hopper) pp. 590–596. (John Wiley & Sons, Inc.) 10.1002/9781119602484.ch49

Breiman L (2001) Random forests. Machine Learning 45, 5–32.
Random forests.Crossref | GoogleScholarGoogle Scholar |

Briggs WM, Zaretzki R (2008) The skill plot: a graphical technique for evaluating continuous diagnostic tests. Biometrics 64, 250–256.
The skill plot: a graphical technique for evaluating continuous diagnostic tests.Crossref | GoogleScholarGoogle Scholar |

Bureš D, Bartoň L, Zahrádková R, Teslík V, Fiedlerová M (2008) Calving difficulty as related to body weights and measurements of cows and calves in a herd of Gascon breed. Czech Journal of Animal Science 53, 187–194.
Calving difficulty as related to body weights and measurements of cows and calves in a herd of Gascon breed.Crossref | GoogleScholarGoogle Scholar |

Chawla NV (2010) Data mining for imbalanced datasets: an overview. In ‘Data mining and knowledge discovery handbook’. (Eds O Maimon, L Rokach) pp. 875–886. (Springer US: Boston, MA, USA)

Dallago GM, Pacheco JAS, dos Santos RA, de Frias Castro GH, Verardo LL, Guarino LR, Moreira EU (2022) The relationship between dry period length and milk production of Holstein dairy cows in tropical climate: a machine learning approach. Journal of Dairy Research 89, 160–168.
The relationship between dry period length and milk production of Holstein dairy cows in tropical climate: a machine learning approach.Crossref | GoogleScholarGoogle Scholar |

Das S, Datta S, Chaudhuri BB (2018) Handling data irregularities in classification: foundations, trends, and future challenges. Pattern Recognition 81, 674–693.
Handling data irregularities in classification: foundations, trends, and future challenges.Crossref | GoogleScholarGoogle Scholar |

De Amicis I, Veronesi MC, Robbe D, Gloria A, Carluccio A (2018) Prevalence, causes, resolution and consequences of bovine dystocia in Italy. Theriogenology 107, 104–108.
Prevalence, causes, resolution and consequences of bovine dystocia in Italy.Crossref | GoogleScholarGoogle Scholar |

Deka RP, Das NK (2021) ‘Dystocia in cattle: how to reduce its occurrence and improve farm economics.’ (Directorate of Dairy Development: Assam, India)

Dubey R, Zhou J, Wang Y, Thompson PM, Ye J, for the Alzheimer’s Disease Neuroimaging Initiative (2014) Analysis of sampling techniques for imbalanced data: an n = 648 ADNI study. NeuroImage 87, 220–241.
Analysis of sampling techniques for imbalanced data: an n = 648 ADNI study.Crossref | GoogleScholarGoogle Scholar |

Eriksson S, Näsholm A, Johansson K, Philipsson J (2004) Genetic parameters for calving difficulty, stillbirth, and birth weight for Hereford and Charolais at first and later parities. Journal of Animal Science 82, 375–383.
Genetic parameters for calving difficulty, stillbirth, and birth weight for Hereford and Charolais at first and later parities.Crossref | GoogleScholarGoogle Scholar |

Fenlon C, O’Grady L, Mee JF, Butler ST, Doherty ML, Dunnion J (2017) A comparison of 4 predictive models of calving assistance and difficulty in dairy heifers and cows. Journal of Dairy Science 100, 9746–9758.
A comparison of 4 predictive models of calving assistance and difficulty in dairy heifers and cows.Crossref | GoogleScholarGoogle Scholar |

Fernández A, García S, Galar M, Prati RC, Krawczyk B, Herrera F (2018) Foundations on imbalanced classification. In ‘Learning from imbalanced data sets’. (Eds A Fernández, S García, M Galar, RC Prati, B Krawczyk, F Herrera) pp. 19–46. (Springer International Publishing: Cham, Switzerland)

Friedman N, Geiger D, Goldszmidt M (1997) Bayesian network classifiers. Machine Learning 29, 131–163.
Bayesian network classifiers.Crossref | GoogleScholarGoogle Scholar |

Ghavi Hossein-Zadeh N (2016) Effect of dystocia on subsequent reproductive performance and functional longevity in Holstein cows. Journal of Animal Physiology and Animal Nutrition 100, 860–867.
Effect of dystocia on subsequent reproductive performance and functional longevity in Holstein cows.Crossref | GoogleScholarGoogle Scholar |

He S, Li B, Peng H, Xin J, Zhang E (2021) An effective cost-sensitive XGBoost method for malicious URLs detection in imbalanced dataset. IEEE Access 9, 93089–93096.
An effective cost-sensitive XGBoost method for malicious URLs detection in imbalanced dataset.Crossref | GoogleScholarGoogle Scholar |

Hempstalk K, McParland S, Berry DP (2015) Machine learning algorithms for the prediction of conception success to a given insemination in lactating dairy cows. Journal of Dairy Science 98, 5262–5273.
Machine learning algorithms for the prediction of conception success to a given insemination in lactating dairy cows.Crossref | GoogleScholarGoogle Scholar |

Hiew MWH, Megahed AA, Townsend JR, Singleton WL, Constable PD (2016) Clinical utility of calf front hoof circumference and maternal intrapelvic area in predicting dystocia in 103 late gestation Holstein-Friesian heifers and cows. Theriogenology 85, 384–395.
Clinical utility of calf front hoof circumference and maternal intrapelvic area in predicting dystocia in 103 late gestation Holstein-Friesian heifers and cows.Crossref | GoogleScholarGoogle Scholar |

Jabeur SB, Sadaaoui A, Sghaier A, Aloui R (2020) Machine learning models and cost-sensitive decision trees for bond rating prediction. Journal of the Operational Research Society 71, 1161–1179.
Machine learning models and cost-sensitive decision trees for bond rating prediction.Crossref | GoogleScholarGoogle Scholar |

Johanson JM, Berger PJ (2003) Birth weight as a predictor of calving ease and perinatal mortality in Holstein cattle. Journal of Dairy Science 86, 3745–3755.
Birth weight as a predictor of calving ease and perinatal mortality in Holstein cattle.Crossref | GoogleScholarGoogle Scholar |

Juozaitienė V, Juozaitis A, Kardisauskas A, Žymantienė J, Žilaitis V, Antanaitis R, Ruzauskas M (2017) Relationship between dystocia and the lactation number, stillbirth and mastitis prevalence in dairy cows. Acta Veterinaria Brno 86, 345–352.
Relationship between dystocia and the lactation number, stillbirth and mastitis prevalence in dairy cows.Crossref | GoogleScholarGoogle Scholar |

Kerslake JI, Amer PR, O’Neill PL, Wong SL, Roche JR, Phyn CVC (2018) Economic costs of recorded reasons for cow mortality and culling in a pasture-based dairy industry. Journal of Dairy Science 101, 1795–1803.
Economic costs of recorded reasons for cow mortality and culling in a pasture-based dairy industry.Crossref | GoogleScholarGoogle Scholar |

Keshavarzi H, Sadeghi-Sefidmazgi A, Mirzaei A, Ravanifard R (2020) Machine learning algorithms, bull genetic information, and imbalanced datasets used in abortion incidence prediction models for Iranian Holstein dairy cattle. Preventive Veterinary Medicine 175, 104869
Machine learning algorithms, bull genetic information, and imbalanced datasets used in abortion incidence prediction models for Iranian Holstein dairy cattle.Crossref | GoogleScholarGoogle Scholar |

López de Maturana E, Legarra A, Varona L, Ugarte E (2007) Analysis of fertility and dystocia in Holsteins using recursive models to handle censored and categorical data. Journal of Dairy Science 90, 2012–2024.
Analysis of fertility and dystocia in Holsteins using recursive models to handle censored and categorical data.Crossref | GoogleScholarGoogle Scholar |

Malašauskienė D, Antanaitis R, Juozaitienė V, Paulauskas A, Urbonavičius G, Televicius M, Urbutis M, Kajokiene L, Yilmaz A, Baumgartner W (2022) Impact of calving difficulty on lameness in dairy cows. Agriculture 12, 960
Impact of calving difficulty on lameness in dairy cows.Crossref | GoogleScholarGoogle Scholar |

McGuirk BJ, Forsyth R, Dobson H (2007) Economic cost of difficult calvings in the United Kingdom dairy herd. Veterinary Record 161, 685–687.
Economic cost of difficult calvings in the United Kingdom dairy herd.Crossref | GoogleScholarGoogle Scholar |

McQueen RJ, Garner SR, Nevill-Manning CG, Witten IH (1995) Applying machine learning to agricultural data. Computers and Electronics in Agriculture 12, 275–293.
Applying machine learning to agricultural data.Crossref | GoogleScholarGoogle Scholar |

Mee JF (2004) Managing the dairy cow at calving time. Veterinary Clinics of North America: Food Animal Practice 20, 521–546.
Managing the dairy cow at calving time.Crossref | GoogleScholarGoogle Scholar |

Mee JF (2008) Prevalence and risk factors for dystocia in dairy cattle: a review. The Veterinary Journal 176, 93–101.
Prevalence and risk factors for dystocia in dairy cattle: a review.Crossref | GoogleScholarGoogle Scholar |

Mee JF, Berry DP, Cromie AR (2011) Risk factors for calving assistance and dystocia in pasture-based Holstein–Friesian heifers and cows in Ireland. The Veterinary Journal 187, 189–194.
Risk factors for calving assistance and dystocia in pasture-based Holstein–Friesian heifers and cows in Ireland.Crossref | GoogleScholarGoogle Scholar |

Microsoft (2012) Microsoft SQL server management studio. Available at http://www8.cs.umu.se/education/examina/Rapporter/EsquiviasFlarup.pdf

Montazeri-Najafabadi M, Ghaderi-Zefrehei M (2021) Data mining of some factors affecting dystocia in Iranian dairy cows. Animal Production Research 10, 13–24.
Data mining of some factors affecting dystocia in Iranian dairy cows.Crossref | GoogleScholarGoogle Scholar |

Murty MN, Devi VS (2011) Bayes classifier. In ‘Pattern recognition: an algorithmic approach’. (Eds M Narasimha Murty, V Susheela Devi) pp. 86–102. (Springer London: London, UK)

Norman HD, Hutchison JL, Miller RH (2010) Use of sexed semen and its effect on conception rate, calf sex, dystocia, and stillbirth of Holsteins in the United States. Journal of Dairy Science 93, 3880–3890.
Use of sexed semen and its effect on conception rate, calf sex, dystocia, and stillbirth of Holsteins in the United States.Crossref | GoogleScholarGoogle Scholar |

Probo M, Guadagnini M, Sala G, Amodeo P, Bolli A (2022) Calving ease risk factors and subsequent survival, fertility and milk production in Italian Holstein cows. Animals 12, 671
Calving ease risk factors and subsequent survival, fertility and milk production in Italian Holstein cows.Crossref | GoogleScholarGoogle Scholar |

R Core Team (2022) ‘R: a language and environment for statistical computing.’ (R Foundation for Statistical Computing: Vienna, Austria)

Sadeghi-Sefidmazgi A, Moradi-Shahrbabak M, Nejati-Javaremi A, Miraei-Ashtiani SR, Amer PR (2012) Breeding objectives for Holstein dairy cattle in Iran. Journal of Dairy Science 95, 3406–3418.
Breeding objectives for Holstein dairy cattle in Iran.Crossref | GoogleScholarGoogle Scholar |

Saito T, Rehmsmeier M (2015) The precision-recall plot is more informative than the ROC plot when evaluating binary classifiers on imbalanced datasets. PLoS ONE 10, e0118432
The precision-recall plot is more informative than the ROC plot when evaluating binary classifiers on imbalanced datasets.Crossref | GoogleScholarGoogle Scholar |

Sampson DL, Parker TJ, Upton Z, Hurst CP (2011) A comparison of methods for classifying clinical samples based on proteomics data: a case study for statistical and machine learning approaches. PLoS ONE 6, e24973
A comparison of methods for classifying clinical samples based on proteomics data: a case study for statistical and machine learning approaches.Crossref | GoogleScholarGoogle Scholar |

Shahinfar S, Page D, Guenther J, Cabrera V, Fricke P, Weigel K (2014) Prediction of insemination outcomes in Holstein dairy cattle using alternative machine learning algorithms. Journal of Dairy Science 97, 731–742.
Prediction of insemination outcomes in Holstein dairy cattle using alternative machine learning algorithms.Crossref | GoogleScholarGoogle Scholar |

Tan X, Su S, Huang Z, Guo X, Zuo Z, Sun X, Li L (2019) Wireless sensor networks intrusion detection based on SMOTE and the random forest algorithm. Sensors 19, 203
Wireless sensor networks intrusion detection based on SMOTE and the random forest algorithm.Crossref | GoogleScholarGoogle Scholar |

Uematsu M, Sasaki Y, Kitahara G, Sameshima H, Osawa T (2013) Risk factors for stillbirth and dystocia in Japanese Black cattle. The Veterinary Journal 198, 212–216.
Risk factors for stillbirth and dystocia in Japanese Black cattle.Crossref | GoogleScholarGoogle Scholar |

Vincze B, Gáspárdy A, Kézér FL, Pálffy M, Bangha Z, Szenci O, Kovács L (2018) Fetal metacarpal/metatarsal bone thickness as possible predictor of dystocia in Holstein cows. Journal of Dairy Science 101, 10283–10289.
Fetal metacarpal/metatarsal bone thickness as possible predictor of dystocia in Holstein cows.Crossref | GoogleScholarGoogle Scholar |

Weiss GM, McCarthy K, Zabar B (2007) Cost-sensitive learning vs. sampling: which is best for handling unbalanced classes with unequal error costs? In ‘Proceedings of the 2007 International Conference on Data Mining, DMIN 2007, 25–28 June 2007, Las Vegas, Nevada, USA’.

Weldeyohanes G, Fesseha H (2020) Dystocia in domestic animals and its management. International Journal of Pharmacy & Biomedical Research 7, 1–11.

Witten IH, Frank E, Hall MA, Pal CJ (2017) ‘Data mining: practical machine learning tools and techniques.’ (Eds IH Witten, E Frank, MA Hall, CJ Pal) (Morgan Kaufmann: USA). Available at https://www.sciencedirect.com/science/article/pii/B9780128042915000052 [Accessed 1 January 2017]

Zaborski D, Grzesiak W (2011) Detection of difficult calvings in dairy cows using neural classifier. Archives Animal Breeding 54, 477–489.
Detection of difficult calvings in dairy cows using neural classifier.Crossref | GoogleScholarGoogle Scholar |

Zaborski D, Grzesiak W, Kotarska K, Szatkowska I, Jedrzejczak M (2014) Detection of difficult calvings in dairy cows using boosted classification trees. Indian Journal of Animal Research 48, 452–458.
Detection of difficult calvings in dairy cows using boosted classification trees.Crossref | GoogleScholarGoogle Scholar |

Zaborski D, Grzesiak W, Pilarczyk R (2016) Detection of difficult calvings in the Polish Holstein-Friesian Black-and-White heifers. Journal of Applied Animal Research 44, 42–53.
Detection of difficult calvings in the Polish Holstein-Friesian Black-and-White heifers.Crossref | GoogleScholarGoogle Scholar |

Zaborski D, Proskura WS, Grzesiak W (2018) The use of data mining methods for dystocia detection in Polish Holstein-Friesian Black-and-White cattle. Asian-Australasian Journal of Animal Sciences 31, 1700–1713.
The use of data mining methods for dystocia detection in Polish Holstein-Friesian Black-and-White cattle.Crossref | GoogleScholarGoogle Scholar |