Machine learning models for predicting the use of different animal breeding services in smallholder dairy farms in Sub-Saharan Africa

  • G. MwangaEmail author
  • S. Lockwood
  • D. F. N. Mujibi
  • Z. Yonah
  • M. G. .G. Chagunda
Regular Articles


This study is concerned with developing predictive models using machine learning techniques to be used in identifying factors that influence farmers’ decisions, predict farmers’ decisions, and forecast farmers’ demands relating to breeding service. The data used to develop the models comes from a survey of small-scale dairy farmers from Tanzania (n = 3500 farmers), Kenya (n = 6190 farmers), Ethiopia (n = 4920 farmers), and Uganda (n = 5390 farmers) and more than 120 variables were identified to influence breeding decisions. Feature engineering process was used to reduce the number of variables to a practical level and to identify the most influential ones. Three algorithms were used for feature selection, namely: logistic regression, random forest, and Boruta. Subsequently, six predictive models, using features selected by feature selection method, were tested for each country—neural network, logistic regression, K-nearest neighbor, decision tree, random forest, and Gaussian mixture model. A combination of decision tree and random forest algorithms was used to develop the final models. Each country model showed high predictive power (up to 93%) and are ready for practical use. The use of ML techniques assisted in identifying the key factors that influence the adoption of breeding method that can be taken and prioritized to improve the dairy sector among countries. Moreover, it provided various alternatives for policymakers to compare the consequences of different courses of action which can assist in determining which alternative at any particular choice point had a high probability to succeed, given the information and alternatives pertinent to the breeding decision. Also, through the use of ML, results to the identification of different clusters of farmers, who were classified based on their farm, and farmers’ characteristics, i.e., farm location, feeding system, animal husbandry practices, etc. This information had significant value to decision-makers in finding the appropriate intervention for a particular cluster of farmers. In the future, such predictive models will assist decision-makers in planning and managing resources by allocating breeding services and capabilities where they would be most in demand.


Breeding service Dairy Livestock Machine learning Predictive models 


Funding information

The authors received the support of funding and data access provided by the Programme for Enhancing the Health and Productivity of Livestock (PEHPL, ID: OPP1083453) and Programme for Emerging Agricultural Research Leaders (PEARL).

Compliance with ethical standards

Ethical approval

All procedures performed in studies involving human participants were in accordance with the ethical standards of the institutional and/or national research committee and with the 1964 Helsinki declaration and its later amendments or comparable ethical standards.

Conflict of interest

The authors declare that they have no conflict of interest.

Supplementary material

11250_2019_2097_MOESM1_ESM.pdf (2.3 mb)
ESM 1 (PDF 2.33 mb)


  1. Anthony, M., Vincent, K., David, O., John, M., 2014. Breeding Services and the Factors Influencing Their Use on Smallholder Dairy Farms in Central Uganda. Vet. Med. Int. 2014.Google Scholar
  2. Chandrashekar, G., Sahin, F., 2014. A survey on feature selection methods. Comput. Electr. Eng. 40, 16–28. CrossRefGoogle Scholar
  3. Dehinenet, G., Mekonnen, H., Kidoido, M., Ashenafi, M., Bleich, E.G., 2014. Factors influencing adoption of dairy technology on small holder dairy farmers in selected zones of Amhara and Oromia National Regional States, Ethiopia. Discourse J. Agric. Food Sci.Google Scholar
  4. Fawcett, T., 2015. Mining the Quantified Self: Personal Knowledge Discovery as a Challenge for Data Science. Big Data 3, 249–266. CrossRefPubMedGoogle Scholar
  5. Kikuhara, K., Kumagai, H., Hirooka H, 2009, Development and Evaluation of a Simulation Model for Dairy Cattle Production Systems Integrated with Forage Crop Production. Asian-Australasian J. Anim. Sci. 22, 57.CrossRefGoogle Scholar
  6. Lamb, G.C., Mercadante, V.R.G., Henry, D.D., Fontes, P.L.P., Dahlen, C.R., Larson, J.E., DiLorenzo, N., 2016. Invited Review: Advantages of current and future reproductive technologies for beef cattle production. Prof. Anim. Sci. 32, 162–171. CrossRefGoogle Scholar
  7. León-Velarde, C., (CIP), R.Q.-P.C., 8pp, L.P., 2001, U., 2001. Modeling cattle production systems: integrating components and their interactions in the development of simulation models. Proceedings-Third Int. Symp. Syst. Approaches Agric. Dev. SAAD III Int. Potato Cent. (CIP), Lima Peru 8.Google Scholar
  8. Lior, R., 2014. Data mining with decision trees: theory and applications.Google Scholar
  9. Mohsen, H., El-Dahshan, E.-S.A., El-Horbaty, E.-S.M., Salem, A.-B.M., 2017. Classification using deep learning neural networks for brain tumors. Futur. Comput. Informatics J. CrossRefGoogle Scholar
  10. Mugisha, A., Kayiizi, V., Owiny, D., Mburu, J., 2014. Breeding services and the factors influencing their use on smallholder dairy farms in central Uganda. Vet. Med. Int. 2014, 169380. CrossRefPubMedPubMedCentralGoogle Scholar
  11. Murage, A.W., Ilatsia, E.D., 2011. Factors that determine use of breeding services by smallholder dairy farmers in Central Kenya. Trop Anim Heal. Prod 43, 43:199–207. CrossRefGoogle Scholar
  12. Mwanga, G., Mujibi, D., Yonah, Z., Chagunda, M., 2018a. Multi-country investigation of factors influencing breeding decisions by smallholder dairy farmers in sub-Saharan Africa. Trop. Anim. Health Prod. 51, 1–15. CrossRefGoogle Scholar
  13. Mwanga, G., Mujibi, D., Yonah, Z., Chagunda, M., 2018b. Predictive models for machine learning in smallholder dairy production systems.Google Scholar
  14. Ristoski, P., Paulheim, H., 2016. Semantic Web in data mining and knowledge discovery: A comprehensive survey. Web Semant. Sci. Serv. Agents World Wide Web 36, 1–22. CrossRefGoogle Scholar
  15. Schmidhuber, J., 2015. Deep learning in neural networks: An overview. Neural Networks 61, 85–117. CrossRefPubMedGoogle Scholar
  16. Scrucca, L., Fop, M., Murphy, B., Raftery, A., 2016. mclust 5: Clustering, Classification and Density Estimation Using Gaussian Finite Mixture Models. R J. 8, 289–317.CrossRefGoogle Scholar
  17. Shaikhina, T., Lowe, D., Daga, S., Briggs, D., Higgins, R., Khovanova, N., 2017. Decision tree and random forest models for outcome prediction in antibody incompatible kidney transplantation. Biomed. Signal Process. Control. CrossRefGoogle Scholar
  18. Singh, A., Halgamuge, M.N., Lakshmiganthan, R., 2017. Impact of Different Data Types on Classifier Performance of Random Forest, Naïve Bayes, and K-Nearest Neighbors Algorithms. IJACSA) Int. J. Adv. Comput. Sci. Appl. 8.Google Scholar
  19. Tefera, S., Lagat, J., Bett, H., 2014. Determinants of Artificial Insemination Use by Smallholder Dairy Farmers in Lemu-Bilbilo District, EthiopiaInt. J. African Asian Stud. 4.Google Scholar

Copyright information

© Springer Nature B.V. 2019

Authors and Affiliations

  1. 1.The Nelson Mandela African Institution of Science and TechnologyArushaTanzania
  2. 2.Washington State UniversityPullmanUSA
  3. 3.Usomi LimitedNairobiKenya
  4. 4.Department of Animal Breeding and Husbandry in the Tropics and SubtropicsUniversity of HohenheimStuttgartGermany

Personalised recommendations