Predicting Nitrogen Excretion of Dairy Cattle with Machine Learning

  • Herman MollenhorstEmail author
  • Yamine Bouzembrak
  • Michel de Haan
  • Hans J. P. Marvin
  • Roel F. Veerkamp
  • Claudia Kamphuis
Conference paper
Part of the IFIP Advances in Information and Communication Technology book series (IFIPAICT, volume 554)


Several tools were developed during the past decades to support farmers in nutrient management and to meet legal requirements such as the farm specific excretion tool. This tool is used by dairy farmers to estimate the farm specific nitrogen (N) excretion of their animals, which is calculated from farm specific data and some normative values. Some variables, like intake of grazed grass or roughage, are hard to measure. A data driven approach could help finding structures in data, and identifying key factors determining N excretion. The aim of this study was to benchmark machine learning methods such as Bayesian Network (BN) and boosted regression trees (BRT) in predicting N excretion, and to assess how sensitive both approaches are on the absence of hard-to-measure input variables. Data were collected from 25 Dutch dairy farms. In the period 2006–2018, detailed recordings of N intake and output were made during 6–10 weeks distributed over each year. Variables included milk production, feed intake and their composition. Calculated N excretion was categorized as low, medium, and high, with limits of 300 and 450 g/day/animal. Accuracy of prediction of the farm specific N excretion, and distinguishing the low and high cases from the medium ones, was slightly better with BRT than with BN. Leaving out information on intake during grazing did not negatively influence validation performance of both models, which opens opportunities to diminish data collection efforts on this aspect. Further analyses are required to confirm these results, such as cross-validation.


Bayesian networks Boosted regression trees Nitrogen excretion Dairy cows 



This research was conducted by Wageningen Livestock Research, commissioned and funded by the Ministry of Agriculture, Nature and Food Quality, within the framework of Policy Support Research theme “Data driven & High Tech” (project number KB-38-001-002 AI in animal and arable systems). Data used were part of the project ‘Cows and Opportunities’, funded by the Dutch ministries of Agriculture, Nature and Food Quality, and Infrastructure and Water Management, and funded by ZuivelNL (the organization of the Dutch dairy sector), and due to the efforts of the mentioned 25 dairy farmers.


  1. 1.
    MinLNV: Landbouw, natuur en voedsel: waardevol en verbonden - Nederland als koploper in kringlooplandbouw (in Dutch). Ministry of Agriculture, Nature and Food Quality, The Hague, The Netherlands (2018)Google Scholar
  2. 2.
    Aarts, H.F.M., et al.: Quantifying the environmental performance of individual dairy farms - the Annual Nutrient Cycling Assessment (ANCA). Grassl. Sci. Eur. 20, 377–380 (2015)Google Scholar
  3. 3.
    RVO: Handreiking bedrijfsspecifieke excretie melkvee. Rijksdienst voor Ondernemend Nederland, 60 p. (2019)Google Scholar
  4. 4.
    Mollenhorst, H., et al.: Field and crop specific manure application on a dairy farm based on historical data and machine learning (2019, submitted)Google Scholar
  5. 5.
    Marvin, H.J., et al.: Application of Bayesian networks for hazard ranking of nanomaterials to support human health risk assessment. Nanotoxicology 11(1), 123–133 (2017)CrossRefGoogle Scholar
  6. 6.
    Cheng, J., et al.: Learning Bayesian networks from data: an information-theory based approach. Artif. Intell. 137(1–2), 43–90 (2002)MathSciNetCrossRefGoogle Scholar
  7. 7.
    Bouzembrak, Y., et al.: Application of Bayesian Networks in the development of herbs and spices sampling monitoring system. Food Control 83, 38–44 (2018)CrossRefGoogle Scholar
  8. 8.
    Bouzembrak, Y., Marvin, H.J.P.: Impact of drivers of change, including climatic factors, on the occurrence of chemical food safety hazards in fruits and vegetables: a Bayesian Network approach. Food Control 97, 67–76 (2019)CrossRefGoogle Scholar
  9. 9.
    Cows and Opportunities homepage (in Dutch). Accessed 22 Oct 2019
  10. 10.
    Oenema, J., et al.: Toetsing van de Kringloopwijzer - Gemeten en voorspelde stikstof- en fosfaatproducties van mest en gewas. Wageningen University and Research, Wageningen, The Netherlands. p. 84 (2017)Google Scholar
  11. 11.
    Friedman, J.H.: Greedy function approximation: a gradient boosting machine. Ann. Stat. 29(5), 1189–1232 (2001)MathSciNetCrossRefGoogle Scholar
  12. 12.
    Witten, I.H. Frank, E.: Data Mining: Practical Machine Learning Tools and Techniques. Morgan Kaufmann Series in Data Management Systems, 2nd edn. Elsevier/Morgan Kaufmann, San Fransisco, CA (2005)CrossRefGoogle Scholar

Copyright information

© IFIP International Federation for Information Processing 2020

Authors and Affiliations

  • Herman Mollenhorst
    • 1
    Email author
  • Yamine Bouzembrak
    • 2
  • Michel de Haan
    • 1
  • Hans J. P. Marvin
    • 2
  • Roel F. Veerkamp
    • 3
  • Claudia Kamphuis
    • 3
  1. 1.Livestock & Environment, Wageningen Livestock ResearchWageningen University and ResearchWageningenThe Netherlands
  2. 2.Toxicology, Novel Foods & Agro Chains, Wageningen Food Safety ResearchWageningen University and ResearchWageningenThe Netherlands
  3. 3.Animal Breeding and GenomicsWageningen University and ResearchWageningenThe Netherlands

Personalised recommendations