Skip to main content

Forecasting for Sustainable Dairy Produce: Enhanced Long-Term, Milk-Supply Forecasting Using k-NN for Data Augmentation, with Prefactual Explanations for XAI

  • Conference paper
  • First Online:

Part of the book series: Lecture Notes in Computer Science ((LNAI,volume 13405))

Abstract

Accurate milk supply forecasting for the dairy sector, covering 1000 s of farms with low resolution data, is a key challenge in achieving a sustainable, precision agriculture that can improve farm management, balancing costs, energy use and environmental protection. We show that case-based reasoning (CBR) can meet this sustainability challenge, by supplementing a time series prediction model on a full-year-forecasting task. Using a dataset of three years of milk supply from Irish dairy farms (N = 2,479), we produce accurate full-year forecasts for each individual farm, by augmenting that farm’s data with data from nearest-neighboring farms, based on the similarity of their time series profiles (using Dynamic Time Warping). A study comparing four methods (Seasonal Naïve, LSTM, Prophet, \(Prophet^{NN}\)) showed that the method using CBR data-augmentation \((Prophet^{NN})\) outperformed the other evaluated methods. We also demonstrate the utility of CBR in providing farmers with novel prefactual explanations for forecasting that could help them to realize actions that could boost future milk yields and profitability.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   69.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   89.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

References

  1. Aha, D.W., Kibler, D., Albert, M.K.: Instance-based learning algorithms. Mach. Learn. 6(1), 37–66 (1991). https://doi.org/10.1007/BF00153759

    Article  Google Scholar 

  2. Berndt, D.J., Clifford, J.: Using dynamic time warping to find patterns in time series. In: KDD Workshop, vol. 10, pp. 359–370. Seattle, WA, USA (1994)

    Google Scholar 

  3. Boichard, D.: Estimation of the economic value of conception rate in dairy cattle. Livest. Prod. Sci. 24(3), 187–204 (1990)

    Article  Google Scholar 

  4. Branting, K., Hastings, J.D., Lockwood, J.A.: Carma: a case-based range management advisor. In: IAAI, pp. 3–10 (2001)

    Google Scholar 

  5. Byrne, R.M., Egan, S.M.: Counterfactual and prefactual conditionals. Can. J. Exp. Psychol./Revue Can. de Psychol. Expérimentale 58(2), 113 (2004)

    Article  Google Scholar 

  6. Cerqueira, V., Torgo, L., Mozetič, I.: Evaluating time series forecasting models: an empirical study on performance estimation methods. Mach. Learn. 109(11), 1997–2028 (2020). https://doi.org/10.1007/s10994-020-05910-7

    Article  MathSciNet  MATH  Google Scholar 

  7. Chollet, F., et al.: Keras (2015). https://github.com/fchollet/keras

  8. Dai, X., Keane, M.T., Shalloo, L., Ruelle, E., Byrne, R.M.: Counterfactual explanations for prediction and diagnosis in xai. In: To appear in AIES 2022 (2022)

    Google Scholar 

  9. Delaney, E., Greene, D., Keane, M.T.: Instance-based counterfactual explanations for time series classification. In: Sánchez-Ruiz, A.A., Floyd, M.W. (eds.) ICCBR 2021. LNCS (LNAI), vol. 12877, pp. 32–47. Springer, Cham (2021). https://doi.org/10.1007/978-3-030-86957-1_3

    Chapter  Google Scholar 

  10. Epstude, K., Scholl, A., Roese, N.J.: Prefactual thoughts: mental simulations about what might happen. Rev. Gen. Psychol. 20(1), 48–56 (2016)

    Article  Google Scholar 

  11. Fdez-Riverola, F., Corchado, J.M.: Fsfrt: forecasting system for red tides. Appl. Intell. 21(3), 251–264 (2004). https://doi.org/10.1023/B:APIN.0000043558.52701.b1

    Article  Google Scholar 

  12. Feely, C., Caulfield, B., Lawlor, A., Smyth, B.: Using case-based reasoning to predict marathon performance and recommend tailored training plans. In: Watson, I., Weber, R. (eds.) ICCBR 2020. LNCS (LNAI), vol. 12311, pp. 67–81. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-58342-2_5

    Chapter  Google Scholar 

  13. Gee, A.H., Garcia-Olano, D., Ghosh, J., Paydarfar, D.: Explaining deep classification of time-series data with learned prototypes. CEUR Workshop Proc. 2429, 15–22 (2019)

    Google Scholar 

  14. Gowing, P., Dunne, J.: Cost control for 2022 (2022). https://www.teagasc.ie/news--events/daily/dairy/cost-control-for-2022.php

  15. Hastings, J., Branting, K., Lockwood, J.: Carma: a case-based rangeland management adviser. AI Mag. 23(2), 49–49 (2002)

    Google Scholar 

  16. Herweijer, C., Combes, B., Gillham, J.: How AI can enable a sustainable future. PwC report (2018)

    Google Scholar 

  17. Hochreiter, S., Schmidhuber, J.: Long short-term memory. Neural Comput. 9(8), 1735–1780 (1997)

    Article  Google Scholar 

  18. Horan, B., Dillon, P., Berry, D., O’Connor, P., Rath, M.: The effect of strain of holstein-friesian, feeding system and parity on lactation curves characteristics of spring-calving dairy cows. Livest. Prod. Sci. 95(3), 231–241 (2005)

    Article  Google Scholar 

  19. Hyndman, R.J., Athanasopoulos, G.: Forecasting: principles and practice. OTexts (2018)

    Google Scholar 

  20. Hyndman, R.J., Koehler, A.B.: Another look at measures of forecast accuracy. Int. J. Forecast. 22(4), 679–688 (2006)

    Article  Google Scholar 

  21. Keane, M.T., Kenny, E.M., Delaney, E., Smyth, B.: If only we had better counterfactual explanations: five key deficits to rectify in the evaluation of counterfactual xai techniques. In: IJCAI-21 (2021)

    Google Scholar 

  22. Keane, M.T., Smyth, B.: Good Counterfactuals and where to find them: a case-based technique for generating counterfactuals for explainable AI (XAI). In: Watson, I., Weber, R. (eds.) ICCBR 2020. LNCS (LNAI), vol. 12311, pp. 163–178. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-58342-2_11

    Chapter  Google Scholar 

  23. Kenny, E.M., Ford, C., Quinn, M., Keane, M.T.: Explaining black-box classifiers using post-hoc explanations-by-example: the effect of explanations and error-rates in xai user studies. Artif. Intell. 294, 103459 (2021)

    Article  MathSciNet  Google Scholar 

  24. Kenny, E.M., et al.: Bayesian case-exclusion and personalized explanations for sustainable dairy farming. In: IJCAI, pp. 4740–4744 (2021)

    Google Scholar 

  25. Kenny, E.M., Ruelle, E., Geoghegan, A., Shalloo, L., O’Leary, M., O’Donovan, M., Keane, M.T.: Predicting grass growth for sustainable dairy farming: a CBR system using bayesian case-exclusion and Post-Hoc, personalized explanation-by-example (XAI). In: Bach, K., Marling, C. (eds.) ICCBR 2019. LNCS (LNAI), vol. 11680, pp. 172–187. Springer, Cham (2019). https://doi.org/10.1007/978-3-030-29249-2_12

    Chapter  Google Scholar 

  26. Kim, B., Khanna, R., Koyejo, O.O.: Examples are not enough, learn to criticize! criticism for interpretability. In: Advances in Neural Information Processing Systems, pp. 2280–2288 (2016)

    Google Scholar 

  27. Kok, A., Chen, J., Kemp, B., Van Knegsel, A.: Dry period length in dairy cows and consequences for metabolism and welfare and customised management strategies. Animal 13(S1), s42–s51 (2019)

    Article  Google Scholar 

  28. Mahato, V., O’Reilly, M., Cunningham, P.: A comparison of k-nn methods for time series classification and regression. In: AICS, pp. 102–113 (2018)

    Google Scholar 

  29. Makridakis, S., Spiliotis, E., Assimakopoulos, V.: Statistical and machine learning forecasting methods: concerns and ways forward. PLoS One 13(3), e0194889 (2018)

    Article  Google Scholar 

  30. Molnar, C.: Interpretable machine learning. Lulu.com (2020)

    Google Scholar 

  31. Mueen, A., Keogh, E.: Extracting optimal performance from dynamic time warping. In: Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pp. 2129–2130 (2016)

    Google Scholar 

  32. Murphy, M.D., O’Mahony, M.J., Shalloo, L., French, P., Upton, J.: Comparison of modelling techniques for milk-production forecasting. J. Dairy Sci. 97(6), 3352–3363 (2014)

    Article  Google Scholar 

  33. Nakhaeizadeh, G.: Learning prediction of time series. A theoretical and empirical comparison of CBR with some other approaches. In: Wess, S., Althoff, K.-D., Richter, M.M. (eds.) EWCBR 1993. LNCS, vol. 837, pp. 65–76. Springer, Heidelberg (1994). https://doi.org/10.1007/3-540-58330-0_77

    Chapter  Google Scholar 

  34. Petitjean, F., Forestier, G., Webb, G.I., Nicholson, A.E., Chen, Y., Keogh, E.: Dynamic time warping averaging of time series allows faster and more accurate classification. In: 2014 IEEE international conference on data mining, pp. 470–479. IEEE (2014)

    Google Scholar 

  35. Shalloo, L., Cromie, A., McHugh, N.: Effect of fertility on the economics of pasture-based dairy systems. Animal 8(s1), 222–231 (2014)

    Article  Google Scholar 

  36. Shalloo, L., Creighton, P., O’Donovan, M.: The economics of reseeding on a dairy farm. Irish J. Agric. Food Res. 50(1), 113–122 (2011)

    Google Scholar 

  37. Smyth, B., Cunningham, P.: A novel recommender system for helping marathoners to achieve a new personal-best. In: Proceedings of the Eleventh ACM Conference on Recommender Systems, pp. 116–120 (2017)

    Google Scholar 

  38. Taylor, S.J., Letham, B.: Forecasting at scale. Am. Stat. 72(1), 37–45 (2018)

    Article  MathSciNet  Google Scholar 

  39. Teagasc: Teagasc national farm survey 2020 - dairy enterprise fact-sheet (2020). https://www.teagasc.ie/media/website/publications/2021/NFS_Dairy_Factsheet2020.pdf

  40. Temraz, M., Kenny, E.M., Ruelle, E., Shalloo, L., Smyth, B., Keane, M.T.: Handling climate change using counterfactuals: using counterfactuals in data augmentation to predict crop growth in an uncertain climate future. In: Sánchez-Ruiz, A.A., Floyd, M.W. (eds.) ICCBR 2021. LNCS (LNAI), vol. 12877, pp. 216–231. Springer, Cham (2021). https://doi.org/10.1007/978-3-030-86957-1_15

    Chapter  Google Scholar 

  41. Upton, J., Murphy, M., De Boer, I., Koerkamp, P.G., Berentsen, P., Shalloo, L.: Investment appraisal of technology innovations on dairy farm electricity consumption. J. Dairy Sci. 98(2), 898–909 (2015)

    Article  Google Scholar 

  42. Vinuesa, R., et al.: The role of artificial intelligence in achieving the sustainable development goals. Nat. Commun. 11(1), 1–10 (2020)

    Article  Google Scholar 

  43. Wiratunga, N., Wijekoon, A., Nkisi-Orji, I., Martin, K., Palihawadana, C., Corsar, D.: Actionable feature discovery in counterfactuals using feature relevance explainers. Case-based reasoning for the explanation of intelligent systems, Third Workshop on XCBR (2021)

    Google Scholar 

  44. Zhang, F., Murphy, M.D., Shalloo, L., Ruelle, E., Upton, J.: An automatic model configuration and optimization system for milk production forecasting. Comput. Electron. Agric. 128, 100–111 (2016)

    Article  Google Scholar 

  45. Zhang, F., Shine, P., Upton, J., Shaloo, L., Murphy, M.D.: A review of milk production forecasting models: past & future methods (2020)

    Google Scholar 

Download references

Acknowledgements

This publication has emanated from research conducted with the financial support of (i) Science Foundation Ireland (SFI) to the Insight Centre for Data Analytics under Grant Number 12/RC/2289_P2 and (ii) SFI and the Department of Agriculture, Food and Marine on behalf of the Government of Ireland under Grant Number 16/RC/3835 (VistaMilk).

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Eoin Delaney .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2022 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Delaney, E., Greene, D., Shalloo, L., Lynch, M., Keane, M.T. (2022). Forecasting for Sustainable Dairy Produce: Enhanced Long-Term, Milk-Supply Forecasting Using k-NN for Data Augmentation, with Prefactual Explanations for XAI. In: Keane, M.T., Wiratunga, N. (eds) Case-Based Reasoning Research and Development. ICCBR 2022. Lecture Notes in Computer Science(), vol 13405. Springer, Cham. https://doi.org/10.1007/978-3-031-14923-8_24

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-14923-8_24

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-14922-1

  • Online ISBN: 978-3-031-14923-8

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics