Automatic determination of abnormal animal activities can be helpful for the timely detection of signs of health and welfare problems. Usually, this problem is addressed as a classification problem, which typically requires manual annotation of behaviors. This manual annotation can introduce noise into the data and may not always be possible. This motivated us to address the problem as a time-series forecasting problem in which the activity of an animal can be predicted. In this work, different machine learning techniques were tested to obtain activity patterns for Iberian pigs. In particular, we propose a novel stacking ensemble learning approach that combines base learners with meta-learners to obtain the final predictive model. Results confirm the superior performance of the proposed method relative to the other tested strategies. We also explored the possibility of using predictive models trained on an animal to predict the activity of different animals on the same farm. As expected, the predictive performance degrades in this case, but it remains acceptable. The proposed method could be integrated into a monitoring system that may have the potential to transform the way farm animals are monitored, improving their health and welfare conditions, for example, by allowing the early detection of a possible health problem.
Citation: Federico Divina, Miguel García-Torres, Francisco Gómez-Vela, Domingo S. Rodriguez-Baena. A stacking ensemble learning for Iberian pigs activity prediction: a time series forecasting approach[J]. AIMS Mathematics, 2024, 9(5): 13358-13384. doi: 10.3934/math.2024652
Automatic determination of abnormal animal activities can be helpful for the timely detection of signs of health and welfare problems. Usually, this problem is addressed as a classification problem, which typically requires manual annotation of behaviors. This manual annotation can introduce noise into the data and may not always be possible. This motivated us to address the problem as a time-series forecasting problem in which the activity of an animal can be predicted. In this work, different machine learning techniques were tested to obtain activity patterns for Iberian pigs. In particular, we propose a novel stacking ensemble learning approach that combines base learners with meta-learners to obtain the final predictive model. Results confirm the superior performance of the proposed method relative to the other tested strategies. We also explored the possibility of using predictive models trained on an animal to predict the activity of different animals on the same farm. As expected, the predictive performance degrades in this case, but it remains acceptable. The proposed method could be integrated into a monitoring system that may have the potential to transform the way farm animals are monitored, improving their health and welfare conditions, for example, by allowing the early detection of a possible health problem.
[1] | N. Zhang, M. Wang, N. Wang, Precision agriculture-a worldwide overview, Comput. Electron. Agric., 36 (2002), 113–132. https://doi.org/10.1016/S0168-1699(02)00096-0 doi: 10.1016/S0168-1699(02)00096-0 |
[2] | R. Gebbers, V. I. Adamchuk, Precision agriculture and food security, Science, 327 (2010), 828–831. https://doi.org/10.1126/science.1183899 doi: 10.1126/science.1183899 |
[3] | H. Auernhammer, Precision farming-the environmental challenge, Comput. Electron. Agric., 30 (2001), 31–43. https://doi.org/10.1016/S0168-1699(00)00153-8 doi: 10.1016/S0168-1699(00)00153-8 |
[4] | S. Wolfert, L. Ge, C. Verdouw, M. J. Bogaardt, Big data in smart farming-a review, Agric. Syst., 153 (2017), 69–80. https://doi.org/10.1016/j.agsy.2017.01.023 doi: 10.1016/j.agsy.2017.01.023 |
[5] | M. J. Kim, C. Mo, H. T. Kim, B. K. Cho, S. J. Hong, D. H. Lee, et al., Research and technology trend analysis by big data-based smart livestock technology: a review, J. Biosyst. Eng., 46 (2021), 386–398. https://doi.org/10.1007/s42853-021-00115-9 doi: 10.1007/s42853-021-00115-9 |
[6] | A. Prunier, L. Mounier, P. L. Neindre, C. Leterrier, P. Mormède, V. Paulmier, et al., Identifying and monitoring pain in farm animals: a review, Animal, 7 (2013), 998–1010. https://doi.org/10.1017/S1751731112002406 doi: 10.1017/S1751731112002406 |
[7] | R. Relić, S. Hristov, M. Joksimović-Todorovlć, V. Davidović, J. Bojkovski, Behavior of cattle as an indicator of their health and welfare, Bull. Univ. Agric. Sci. Vet. Med. Cluj Napoca, 69 (2012), 1–14. https://doi.org/10.15835/BUASVMCN-VM:69:1-2:8847 doi: 10.15835/BUASVMCN-VM:69:1-2:8847 |
[8] | G. Marchesini, D. Mottaran, B. Contiero, E. Schiavon, S. Segato, E. Garbin, et al., Use of rumination and activity data as health status and performance indicators in beef cattle during the early fattening period, Vet. J., 231 (2018), 41–47. https://doi.org/10.1016/j.tvjl.2017.11.013 doi: 10.1016/j.tvjl.2017.11.013 |
[9] | D. Weary, J. Huzzey, M. Von Keyserlingk, Board-invited review: using behavior to predict and identify ill health in animals, J. Anim. Sci., 87 (2009), 770–777. https://doi.org/10.2527/jas.2008-1297 doi: 10.2527/jas.2008-1297 |
[10] | S. G. Matthews, A. L. Miller, T. PlÖtz, I. Kyriazakis, Automated tracking to measure behavioral changes in pigs for health and welfare monitoring, Sci. Rep., 7 (2017), 17582. https://doi.org/10.1038/s41598-017-17451-6 doi: 10.1038/s41598-017-17451-6 |
[11] | P. Martiskainen, M. Järvinen, J. P. Skön, J. Tiirikainen, M. Kolehmainen, J. Mononen, Cow behavior pattern recognition using a three-dimensional accelerometer and support vector machines, Appl. Anim. Behav. Sci., 119 (2009), 32–38. https://doi.org/10.1016/j.applanim.2009.03.005 doi: 10.1016/j.applanim.2009.03.005 |
[12] | A. de Passillé, M. Jensen, N. Chapinal, J. Rushen, Technical note: use of accelerometers to describe gait patterns in dairy calves, J. Dairy Sci., 93 (2010), 3287–3293. https://doi.org/10.3168/jds.2009-2758 doi: 10.3168/jds.2009-2758 |
[13] | P. L. Greenwood, P. Valencia, L. Overs, D. R. Paull, I. W. Purvis, New ways of measuring intake, efficiency and behavior of grazing livestock, Anim. Prod. Sci., 54 (2014), 1796–1804. https://doi.org/10.1071/AN14409 doi: 10.1071/AN14409 |
[14] | B. Koger, A. Deshpande, J. T. Kerby, J. M. Graving, B. R. Costelloe, I. D. Couzin, Quantifying the movement, behavior and environmental context of group-living animals using drones and computer vision, J. Anim. Ecol., 92 (2023), 1357–1371. https://doi.org/10.1111/1365-2656.13904 doi: 10.1111/1365-2656.13904 |
[15] | R. García, J. Aguilar, M. Toro, A. Pinto, P. Rodríguez, A systematic literature review on the use of machine learning in precision livestock farming, Comput. Electron. Agric., 179 (2020), 105826. https://doi.org/10.1016/j.compag.2020.105826 doi: 10.1016/j.compag.2020.105826 |
[16] | G. Mattachini, A. Antler, E. Riva, A. Arbel, G. Provolo, Automated measurement of lying behavior for monitoring the comfort and welfare of lactating dairy cows, Livest. Sci., 158 (2013), 145–150. https://doi.org/10.1016/j.livsci.2013.10.014 doi: 10.1016/j.livsci.2013.10.014 |
[17] | J. Barwick, D. Lamb, R. Dobos, D. Schneider, M. Welch, M. Trotter, Predicting lameness in sheep activity using tri-axial acceleration signals, Animals, 8 (2018), 12. https://doi.org/10.3390/ani8010012 doi: 10.3390/ani8010012 |
[18] | W. Shinada, N. Gakumazawa, S. Koshikawa, T. Ito, T. Fujiwara, M. Takahashi, et al., Precalving behavior in dairy cattle with different calving times, Anim. Sci. J., 94 (2023), e13833. https://doi.org/10.1111/asj.13833 doi: 10.1111/asj.13833 |
[19] | A. Alameer, I. Kyriazakis, J. Bacardit, Automated recognition of postures and drinking behavior for the detection of compromised health in pigs, Sci. Rep., 10 (2020), 13665. https://doi.org/10.1038/s41598-020-70688-6 doi: 10.1038/s41598-020-70688-6 |
[20] | E. S. Fogarty, D. L. Swain, G. M. Cronin, L. E. Moraes, M. Trotter, Behavior classification of extensively grazed sheep using machine learning, Comput. Electron. Agric., 169 (2020) 105175. https://doi.org/10.1016/j.compag.2019.105175 doi: 10.1016/j.compag.2019.105175 |
[21] | R. Arablouei, L. Wang, L. Currie, J. Yates, F. A. Alvarenga, G. J. Bishop-Hurley, Animal behavior classification via deep learning on embedded systems, Comput. Electron. Agric., 207 (2023), 107707. https://doi.org/10.1016/j.compag.2023.107707 doi: 10.1016/j.compag.2023.107707 |
[22] | M. Borchers, Y. Chang, K. Proudfoot, B. Wadsworth, A. Stone, J. Bewley, Machine-learning-based calving prediction from activity, lying, and ruminating behaviors in dairy cattle, J. Dairy Sci., 100 (2017), 5664–5674. https://doi.org/10.3168/jds.2016-11526 doi: 10.3168/jds.2016-11526 |
[23] | L. Schmeling, G. Elmamooz, P. T. Hoang, A. Kozar, D. Nicklas, M. Sünkel, et al., Training and validating a machine learning model for the sensor-based monitoring of lying behavior in dairy cows on pasture and in the barn, Animals, 11 (2021), 2660. https://doi.org/10.3390/ani11092660 doi: 10.3390/ani11092660 |
[24] | J. A. Vázquez-Diosdado, V. Paul, K. A. Ellis, D. Coates, R. Loomba, J. Kaler, A combined offline and online algorithm for real-time and long-term classification of sheep behavior: novel approach for precision livestock farming, Sensors, 19 (2019), 3201. https://doi.org/10.3390/s19143201 doi: 10.3390/s19143201 |
[25] | A. S. Keceli, C. Catal, A. Kaya, B. Tekinerdogan, Development of a recurrent neural networks-based calving prediction model using activity and behavioral data, Comput. Electron. Agric., 170 (2020), 105285. https://doi.org/10.1016/j.compag.2020.105285 doi: 10.1016/j.compag.2020.105285 |
[26] | C. Seiffert, T. M. Khoshgoftaar, J. Van Hulse, A. Napolitano, Rusboost: a hybrid approach to alleviating class imbalance, IEEE Trans. Syst. Man Cybern., 40 (2010), 185–197. https://doi.org/10.1109/TSMCA.2009.2029559 doi: 10.1109/TSMCA.2009.2029559 |
[27] | C. Carslake, J. A. Vázquez-Diosdado, J. Kaler, Machine learning algorithms to classify and quantify multiple behaviors in dairy calves using a sensor: Moving beyond classification in precision livestock, Sensors, 21 (2020), 88. https://doi.org/10.3390/s21010088 doi: 10.3390/s21010088 |
[28] | M. L. Williams, W. P. James, M. T. Rose, Variable segmentation and ensemble classifiers for predicting dairy cow behavior, Biosyst. Eng., 178 (2019), 156–167. https://doi.org/10.1016/j.biosystemseng.2018.11.011 doi: 10.1016/j.biosystemseng.2018.11.011 |
[29] | S. Hu, R. Arablouei, G. J. Bishop-Hurley, A. Reverter, A. Ingham, Predicting bite rate of grazing cattle from accelerometry data via semi-supervised regression, Smart Agric. Technol., 5 (2023), 100256. https://doi.org/10.1016/j.atech.2023.100256 doi: 10.1016/j.atech.2023.100256 |
[30] | F. Abbona, L. Vanneschi, M. Bona, M. Giacobini, Towards modelling beef cattle management with genetic programming, Livest. Sci., 241 (2020), 104205. https://doi.org/10.1016/j.livsci.2020.104205 doi: 10.1016/j.livsci.2020.104205 |
[31] | B. Ji, T. Banhazi, C. J. Phillips, C. Wang, B. Li, 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., 216 (2022), 186–197. https://doi.org/10.1016/j.biosystemseng.2022.02.013 doi: 10.1016/j.biosystemseng.2022.02.013 |
[32] | A. da Silva Santos, V. W. C. de Medeiros, G. E. Gonçalves, Monitoring and classification of cattle behavior: a survey, Smart Agric. Technol., 3 (2023), 100091. https://doi.org/10.1016/j.atech.2022.100091 doi: 10.1016/j.atech.2022.100091 |
[33] | H. Suparwito, K. W. Wong, H. Xie, S. Rai, D. Thomas, A hierarchical classification method used to classify livestock behavior from sensor data, International Conference on Multi-disciplinary Trends in Artificial Intelligence, 2019,204–215. https://doi.org/10.1007/978-3-030-33709-4_18 doi: 10.1007/978-3-030-33709-4_18 |
[34] | D. S. Rodriguez-Baena, F. A. Gomez-Vela, M. García-Torres, F. Divina, C. D. Barranco, N. Daz-Diaz, et al., Identifying livestock behavior patterns based on accelerometer dataset, J. Comput. Sci., 41 (2020), 101076. https://doi.org/10.1016/j.jocs.2020.101076 doi: 10.1016/j.jocs.2020.101076 |
[35] | A. A. Rayas-Amor, E. Morales-Almaráz, G. Licona-Velázquez, R. Vieyra-Alberto, A. García-Martínez, C. G. Martínez-García, et al., Triaxial accelerometers for recording grazing and ruminating time in dairy cows: ann alternative to visual observations, J. Vet. Behav., 20 (2017), 102–108. https://doi.org/10.1016/j.jveb.2017.04.003 doi: 10.1016/j.jveb.2017.04.003 |
[36] | M. Lepot, J. B. Aubin, F. H. Clemens, Interpolation in time series: an introductive overview of existing methods, their performance criteria and uncertainty assessment, Water, 9 (2017), 796. https://doi.org/10.3390/w9100796 doi: 10.3390/w9100796 |
[37] | H. Teichgraeber, A. R. Brandt, Time-series aggregation for the optimization of energy systems: goals, challenges, approaches, and opportunities, Renew. Sustain. Energy Rev., 157 (2022), 111984. https://doi.org/10.1016/j.rser.2021.111984 doi: 10.1016/j.rser.2021.111984 |
[38] | D. Leite, I. Škrjanc, Ensemble of evolving optimal granular experts, owa aggregation, and time series prediction, Inf. Sci., 504 (2019), 95–112. https://doi.org/10.1016/j.ins.2019.07.053 doi: 10.1016/j.ins.2019.07.053 |
[39] | S. L. Wickramasuriya, G. Athanasopoulos, R. J. Hyndman, Optimal forecast reconciliation for hierarchical and grouped time series through trace minimization, J. Amer. Stat. Assoc., 114 (2019), 804–819. https://doi.org/10.1080/01621459.2018.1448825 doi: 10.1080/01621459.2018.1448825 |
[40] | Y. W. Cheung, K. S. Lai, Lag order and critical values of the augmented dickey-fuller test, J. Bus. Econ. Stat., 13 (1995), 277–280. https://doi.org/10.1080/07350015.1995.10524601 doi: 10.1080/07350015.1995.10524601 |
[41] | J. F. Torres, A. M. Fernández, A. Troncoso, F. Martínez-Álvarez, Deep learning-based approach for time series forecasting with application to electricity load, International Work-Conference on the Interplay Between Natural and Artificial Computation, 2017,203–212. https://doi.org/10.1007/978-3-319-94120-2_12 doi: 10.1007/978-3-319-94120-2_12 |
[42] | F. Divina, A. Gilson, F. Goméz-Vela, M. García Torres, J. F. Torres, Stacking ensemble learning for short-term electricity consumption forecasting, Energies, 11 (2018), 949. https://doi.org/10.3390/en11040949 doi: 10.3390/en11040949 |
[43] | J. Neter, M. H. Kutner, C. J. Nachtsheim, W. Wasserman, Applied linear statistical models, Irwin, 1996. |
[44] | F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, et al., Scikit-learn: machine learning in python, J. Mach. Learn. Res., 12 (2011), 2825–2830. https://doi.org/10.5555/1953048.2078195 doi: 10.5555/1953048.2078195 |
[45] | W. Härdle, O. Linton, Applied nonparametric methods, Handb. Econometrics, 4 (1994), 2295–2339. |
[46] | J. L. Bentley, Multidimensional binary search trees used for associative searching, Commun. ACM, 18 (1975), 509–517. https://doi.org/10.1145/361002.361007 doi: 10.1145/361002.361007 |
[47] | S. Hochreiter, J. Schmidhuber, Long short-term memory, Neural Comput., 9 (1997), 1735–1780. https://doi.org/10.1162/neco.1997.9.8.1735 doi: 10.1162/neco.1997.9.8.1735 |
[48] | A. Robinson, F. Fallside, The utility driven dynamic error propagation network, Department of Engineering Cambridge, University of Cambridge, 1987. |
[49] | F. Chollet, Keras-team/Keras, 2015. Available from: https://github.com/fchollet/keras. |
[50] | T. K. Ho, Random decision forests, Proceedings of 3rd International Conference on Document Analysis and Recognition, 1995. https://doi.org/10.1109/ICDAR.1995.598994 |
[51] | D. A. Augusto, H. J. Barbosa, Symbolic regression via genetic programming, Proceedings. Vol. 1. Sixth Brazilian Symposium on Neural Networks, 2000,173–178. https://doi.org/10.1109/SBRN.2000.889734 doi: 10.1109/SBRN.2000.889734 |
[52] | T. Stephens, Gplearn-genetic programming in python, 1859. Available from: https://gplearn.readthedocs.io/en/stable/index.html. |
[53] | J. H. Friedman, Greedy function approximation: a gradient boosting machine, Ann. Stat., 29 (2001), 1189–1232. https://doi.org/10.1214/aos/1013203451 doi: 10.1214/aos/1013203451 |
[54] | Y. Shi, J. Li, Z. Li, Gradient boosting with piece-wise linear regression trees, Proceedings of the Twenty-Eighth International Joint Conference on Artificial Intelligence, 2019, 3432–3438. https://doi.org/10.5555/3367471.3367518 doi: 10.5555/3367471.3367518 |
[55] | G. Ke, Q. Meng, T. Finley, T. Wang, W. Chen, W. Ma, et al., Lightgbm: a highly efficient gradient boosting decision tree, Adv. Neural Inf. Process. Syst., 30 (2017), 3149–3157. https://doi.org/10.5555/3367471.3367518 doi: 10.5555/3367471.3367518 |
[56] | Y. Freund, R. E. Schapire, A desicion-theoretic generalization of on-line learning and an application to boosting, In: P. Vitányi, Computational learning theory, Springer Berlin Heidelberg, 1995, 23–37. https://doi.org/10.1007/3-540-59119-2_166 |
[57] | T. G. Dietterich, Ensemble methods in machine learning, In: J. Kittler, F. Roli, Multiple classifier systems, Springer-Verlag, 2000, 1–15. https://doi.org/10.1007/3-540-45014-9_1 |