Submitted:
07 March 2025
Posted:
10 March 2025
You are already at the latest version
Abstract
The study classified cows' foraging behaviors using machine learning (ML) models evaluated through Random Test-Split (RTS) and Cross-Validation (CV). Models in-cluded Perceptron, Logistic Regression, Support Vector Machine, K-Nearest Neighbors, Random Forest (RF), and XGBoost (XGB). These models classified activity states (Active vs. Static), foraging behaviors (Grazing (GR), Resting (RE), Walking (W), Ruminating (RU)), posture states (Standing up (SU) vs. Lying down (LD)), and activity-by-posture combinations (RU_SU, RU_LD, RE_SU, RE_LD). XGB achieved the highest accuracy for state classification (74.5% RTS, 74.2% CV) and foraging behavior (69.4% CV). RF out-performed XGB in other classifications, including GR, RE, and RU (62.9% CV vs. 56.4% RTS), posture (83.9% CV vs. 79.4% RTS), and activity-by-posture (58.8% CV vs. 56.4% RTS). Key predictors varied: Speed and Actindex were crucial for GR and W when in-creasing and for RE and RU when decreasing. X low values were linked to RE_SU and RU_SU, while X and Z influenced RE_LD more. RTS showed higher accuracy in be-havioral state and general foraging classification. These results emphasize CV in RF's reliability in managing complex behavioral patterns and the importance of continuous recording devices and movement metrics to monitor cattle behavior accurately.
Keywords:
1. Introduction
2. Materials and Methods
2.1. Study Areas
2.2. Animals, Sensors, and Camera Deployment
2.3. Pre-Processing of GPS, Accelerometer, and Camera Data
2.4. Feature Calculations
2.5. Machine Learning Data Partition Strategy
2.6. Models Performance Assessment
3. Results
3.1. Data Summary and Challenges
3.2. Behavior Classification Using Random Train-Test Split Method
3.2.1. States Classification
3.2.2. Activity Classification
| Classification | Model | Activity | Precision (%) | Recall (%) | F1 Score (%) | Model Accuracy (%) |
| General activities | Perceptron | GR | 50 | 64 | 57 |
45.8 |
| RE | 54 | 35 | 42 | |||
| W | 4 | 8 | 5 | |||
| Logistic Regression | GR | 60 | 53 | 56 |
61.2 |
|
| RE | 62 | 76 | 68 | |||
| W | 0 | 0 | 0 | |||
| SVM | GR | 62 | 55 | 58 |
62.5 |
|
| RE | 63 | 77 | 69 | |||
| W | 100 | 4 | 8 | |||
| K-Nearest Neighbor | GR | 55 | 64 | 59 |
60.4 |
|
| RE | 65 | 65 | 65 | |||
| W | 100 | 4 | 8 | |||
| Random Forest | GR | 63 | 64 | 64 |
65.9 |
|
| RE | 68 | 75 | 71 | |||
| W | 50 | 4 | 7 | |||
| XGBoost | GR | 63 | 62 | 62 | 63.3 |
|
| RE | 67 | 72 | 69 | |||
| W | 13 | 8 | 10 | |||
| Fine activities | Perceptron | GR | 70 | 63 | 66 | 53.5 |
| RE | 25 | 12 | 16 | |||
| RU | 46 | 68 | 55 | |||
| Logistic Regression | GR | 62 | 76 | 68 | 56.1 | |
| RE | 0 | 0 | 0 | |||
| RU | 49 | 66 | 56 | |||
| SVM | GR | 66 | 70 | 68 | 58 | |
| RE | 53 | 12 | 19 | |||
| RU | 50 | 72 | 59 | |||
| K-Nearest Neighbor | GR | 64 | 71 | 67 | 54.9 | |
| RE | 37 | 30 | 33 | |||
| RU | 50 | 50 | 50 | |||
| Random Forest | GR | 67 | 73 | 70 | 59.7 | |
| RE | 38 | 30 | 34 | |||
| RU | 60 | 62 | 61 | |||
| XGBoost | GR | 67 | 78 | 72 | 61.7 | |
| RE | 46 | 31 | 37 | |||
| RU | 59 | 59 | 59 |
3.3. Behavior Classification Using Cross-Validation Method
3.3.1. States Classification
3.3.2. Activity Classification and by Posture
4. Discussion
4.1. State Classification
4.2. Activity Classification
5. Conclusions
Author Contributions
Funding
Conflicts of Interest
References
- Strömberg, C.A.E.; Staver, A.C. The History and Challenge of Grassy Biomes. Science (1979) 2022, 377, 592–593. [CrossRef]
- Giridhar, K.; Samireddypalle, A.; Giridhar, K.; Samireddypalle, A. Impact of Climate Change on Forage Availability for Livestock. Climate Change Impact on Livestock: Adaptation and Mitigation 2015, 97–112. [CrossRef]
- Teague, R.; Kreuter, U. Managing Grazing to Restore Soil Health, Ecosystem Function, and Ecosystem Services. Front Sustain Food Syst 2020, 4, 534187. [CrossRef]
- Bilotta, G.S.; Brazier, R.E.; Haygarth, P.M. The Impacts of Grazing Animals on the Quality of Soils, Vegetation, and Surface Waters in Intensively Managed Grasslands. Advances in Agronomy 2007, 94, 237–280. [CrossRef]
- Papanastasis, V.P. Restoration of Degraded Grazing Lands through Grazing Management: Can It Work? Restor Ecol 2009, 17, 441–445. [CrossRef]
- Sanz, A.; Blanco-Penedo, I.; Quintans, G.; Álvarez-Rodríguez, J. Mother-Offspring Bonding Revisited: A Blueprint for the Future of Beef Cattle Farming. Appl Anim Behav Sci 2024, 277, 106346. [CrossRef]
- Derner, J.D.; Hunt, L.; Filho, K.E.; Ritten, J.; Capper, J.; Han, G. Livestock Production Systems. 2017, 347–372. [CrossRef]
- Bailey, D.W.; Trotter, M.G.; Knight, C.W.; Thomas, M.G. Use of GPS Tracking Collars and Accelerometers for Rangeland Livestock Production Research 1.. [CrossRef]
- Nyamuryekung’e, S. Transforming Ranching: Precision Livestock Management in the Internet of Things Era. Rangelands 2024, 46, 13–22. [CrossRef]
- Nyamuryekung’e, S.; Cibils, A.F.; Estell, R.E.; VanLeeuwen, D.; Spiegal, S.; Steele, C.; González, A.L.; McIntosh, M.M.; Gong, Q.; Cao, H. Movement, Activity, and Landscape Use Patterns of Heritage and Commercial Beef Cows Grazing Chihuahuan Desert Rangeland. J Arid Environ 2022, 199, 104704. [CrossRef]
- Brennan, J.; Johnson, P.; Olson, K. Classifying Season Long Livestock Grazing Behavior with the Use of a Low-Cost GPS and Accelerometer. Comput Electron Agric 2021, 181, 105957. [CrossRef]
- Cabezas, J.; Yubero, R.; Visitación, B.; Navarro-García, J.; Algar, M.J.; Cano, E.L.; Ortega, F. Analysis of Accelerometer and GPS Data for Cattle Behaviour Identification and Anomalous Events Detection. Entropy 2022, Vol. 24, Page 336 2022, 24, 336. [CrossRef]
- Arcidiacono, C.; Porto, S.M.C.; Mancino, M.; Cascone, G. Development of a Threshold-Based Classifier for Real-Time Recognition of Cow Feeding and Standing Behavioural Activities from Accelerometer Data. Comput Electron Agric 2017, 134, 124–134. [CrossRef]
- Hounslow, J.L.; Fossette, S.; Chong, W.; Bali, R.; Tucker, A.D.; Whiting, S.D.; Gleiss, A.C. Behaviour-Specific Spatiotemporal Patterns of Habitat Use by Sea Turtles Revealed Using Biologging and Supervised Machine Learning. Journal of Applied Ecology 2023, 60, 1828–1840. [CrossRef]
- Bailey, D.W.; Trotter, M.G.; Tobin, C.; Thomas, M.G. Opportunities to Apply Precision Livestock Management on Rangelands. Front Sustain Food Syst 2021, 5, 611915. [CrossRef]
- Ganskopp, D.C.; Johnson, D.D. GPS Error in Studies Addressing Animal Movements and Activities. Rangel Ecol Manag 2007, 60, 350–358. [CrossRef]
- Bonneau, M.; Vayssade, J.A.; Troupe, W.; Arquet, R. Outdoor Animal Tracking Combining Neural Network and Time-Lapse Cameras. Comput Electron Agric 2020, 168. [CrossRef]
- Aquilani, C.; Confessore, A.; Bozzi, R.; Sirtori, F.; Pugliese, C. Review: Precision Livestock Farming Technologies in Pasture-Based Livestock Systems. Animal 2022, 16, 100429. [CrossRef]
- Herlin, A.; Brunberg, E.; Hultgren, J.; Högberg, N.; Rydberg, A.; Skarin, A.; Siniscalchi, M. Animal Welfare Implications of Digital Tools for Monitoring and Management of Cattle and Sheep on Pasture. 2021, 11, 829. [CrossRef]
- Russel, N.S.; Selvaraj, A. Decoding Cow Behavior Patterns from Accelerometer Data Using Deep Learning. Journal of Veterinary Behavior 2024, 74, 68–78. [CrossRef]
- Mao, A.; Huang, E.; Wang, X.; Liu, K. Deep Learning-Based Animal Activity Recognition with Wearable Sensors: Overview, Challenges, and Future Directions. Comput Electron Agric 2023, 211, 108043. [CrossRef]
- Liu, J.; Bailey, D.W.; Cao, H.; Son, T.C.; Tobin, C.T. Development of a Novel Classification Approach for Cow Behavior Analysis Using Tracking Data and Unsupervised Machine Learning Techniques. Sensors 2024, 24. [CrossRef]
- Augustine, D.J.; Derner, J.D. Assessing Herbivore Foraging Behavior with GPS Collars in a Semiarid Grassland. Sensors (Switzerland) 2013, 13, 3711–3723. [CrossRef]
- Climate United States - Monthly Averages Available online: https://www.usclimatedata.com/ (accessed on 11 February 2025).
- DigitalCommons, U.; All Graduate Theses, U.; Decker, T. Targeted-Grazing as a Fuels Reduction Treatment: Evaluation of Targeted-Grazing as a Fuels Reduction Treatment: Evaluation of Vegetation Dynamics and Utilization Levels Vegetation Dynamics and Utilization Levels. 2018.
- Liu, Z.; Lin, Y.; Hoover, J.; Beene, D.; Charley, P.H.; Singer, N. Individual Level Spatial-Temporal Modelling of Exposure Potential of Livestock in the Cove Wash Watershed, Arizona. Ann GIS 2023, 29, 87–107. [CrossRef]
- Versluijs, E.; Niccolai, L.J.; Spedener, M.; Zimmermann, B.; Hessle, A.; Tofastrud, M.; Devineau, O.; Evans, A.L. Classification of Behaviors of Free-Ranging Cattle Using Accelerometry Signatures Collected by Virtual Fence Collars. Frontiers in Animal Science 2023, 4, 1083272. [CrossRef]
- Sivakumar, M.; Parthasarathy, S.; Padmapriya, T. Trade-off between Training and Testing Ratio in Machine Learning for Medical Image Processing. PeerJ Comput Sci 2024, 10, e2245. [CrossRef]
- Jain, E.; Neeraja, J.; Banerjee, B.; Ghosh, P. A Diagnostic Approach to Assess the Quality of Data Splitting in Machine Learning. 2022.
- Li, Y.; Shu, H.; Bindelle, J.; Xu, B.; Zhang, W.; Jin, Z.; Guo, L.; Wang, W. Classification and Analysis of Multiple Cattle Unitary Behaviors and Movements Based on Machine Learning Methods. Animals 2022, 12. [CrossRef]
- Ghojogh, B.; Ca, B.; Crowley, M.; Ca, M. The Theory Behind Overfitting, Cross Validation, Regularization, Bagging, and Boosting: Tutorial. 2019.
- Cawley, G.C.; Talbot, N.L.C. On Over-Fitting in Model Selection and Subsequent Selection Bias in Performance Evaluation. Journal of Machine Learning Research 2010, 11, 2079–2107.
- Putun, A.; Yilmaz, D. Classification of Cattle Behavior Leveraging Accelerometer Data and Machine Learning. 8th International Artificial Intelligence and Data Processing Symposium, IDAP 2024 2024. [CrossRef]
- Ibrahim, T.; Isaac, K.B.; Francis, B.; Lule, E.; Hellen, N.; Chongomweru, H.; Marvin, G. Interpretable Machine Learning Techniques for Predictive Cattle Behavior Monitoring. 2nd International Conference on Sustainable Computing and Smart Systems, ICSCSS 2024 - Proceedings 2024, 1219–1224. [CrossRef]
- Chakraborty, R.; Pramanik, A.; Majumdar, S.; Ghosh, D.; Layek, S.; Ray, H.; Ghosh, A.; Singh, O.K.; Ghosh, T.K. Performance Analysis of Machine Learning Classifier on Different Cow Health Datasets. Proceedings of the International Conference on Sensing Technology, ICST 2023. [CrossRef]
- Wyner, A.J.; Olson, M.; Bleich, J.; Mease, D. Explaining the Success of AdaBoost and Random Forests as Interpolating Classifiers. Journal of Machine Learning Research 2017, 18, 1–33.
- Najafabadi, M.M.; Villanustre, F.; Khoshgoftaar, T.M.; Seliya, N.; Wald, R.; Muharemagic, E. Deep Learning Applications and Challenges in Big Data Analytics. J Big Data 2015, 2, 1–21. [CrossRef]
- Hey, T.; Butler, K.; Jackson, S.; Thiyagalingam, J. Machine Learning and Big Scientific Data. Philosophical Transactions of the Royal Society A 2020, 378. [CrossRef]
- Mladenova, T.; Valova, I.; Evstatiev, B.; Valov, N.; Varlyakov, I.; Markov, T.; Stoycheva, S.; Mondeshka, L.; Markov, N. Evaluation of the Efficiency of Machine Learning Algorithms for Identification of Cattle Behavior Using Accelerometer and Gyroscope Data. AgriEngineering 2024, Vol. 6, Pages 2179-2197 2024, 6, 2179–2197. [CrossRef]
- Oshana Iddi Dissanayake, A.; McPherson, S.E.; Allyndrée, J.; Kennedy, E.; Cunningham, P.; Riaboff, L. Accelerometer-Based Multivariate Time-Series Dataset for Calf Behavior Classification. 2024. [CrossRef]
- Deepak, D.; D’Mello, D.A.; Divakarla, U. Advancements in Automated Livestock Monitoring: A Concise Review of Deep Learning-Based Cattle Activity Recognition. 10th International Conference on Advanced Computing and Communication Systems, ICACCS 2024 2024, 321–327. [CrossRef]
- Wang, Y.; Yu, R.; Li, X.; Chen, R.; Liu, J. Grazing Regime Rather than Grazing Intensity Affect the Foraging Behavior of Cattle. Ecol Inform 2025, 85, 102996. [CrossRef]
- Grinsztajn, L.; Oyallon, E.; Varoquaux, G. Why Do Tree-Based Models Still Outperform Deep Learning on Tabular Data? 2022.
- Putun, A.; Yilmaz, D. Classification of Cattle Behavior Leveraging Accelerometer Data and Machine Learning. 8th International Artificial Intelligence and Data Processing Symposium, IDAP 2024 2024. [CrossRef]
- Chen, J.M.; Schütz, K.E.; Tucker, C.B. Technical Note: Comparison of Instantaneous Sampling and Continuous Observation of Dairy Cattle Behavior in Freestall Housing. J Dairy Sci 2016, 99, 8341–8346. [CrossRef]
- Biau, G.; Fr, G.B. Analysis of a Random Forests Model. Journal of Machine Learning Research 2012, 13, 1063–1095.
- Kleanthous, N.; Hussain, A.; Khan, W.; Sneddon, J.; Mason, A. Feature Extraction and Random Forest to Identify Sheep Behavior from Accelerometer Data. Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics) 2020, 12465 LNAI, 408–419. [CrossRef]
- Chen, T.; Guestrin, C. XGBoost: A Scalable Tree Boosting System.. [CrossRef]
- Tamura, T.; Okubo, Y.; Deguchi, Y.; Koshikawa, S.; Takahashi, M.; Chida, Y.; Okada, K. Dairy Cattle Behavior Classifications Based on Decision Tree Learning Using 3-Axis Neck-Mounted Accelerometers. Animal Science Journal 2019, 90, 589–596. [CrossRef]
- Zhang, H.; Ma, Y.; Shi, Y.; Qiao, Y.; Wang, M. A Framework for Automatic Analysis of Sheep Ruminating Behavior Based on Keypoint Detection. M2VIP - Proceedings of the International Conference on Mechatronics and Machine Vision in Practice 2024. [CrossRef]


| Model | Model Accuracy (%) | STATES | |||||
| Active | Static | ||||||
| Precision (%) | Recall (%) | F1 Score (%) | Precision (%) | Recall (%) | F1 Score (%) | ||
| Perceptron | 63.8 | 68 | 52 | 59 | 62 | 76 | 68 |
| Logistic Regression | 72.4 | 76 | 65 | 70 | 70 | 79 | 74 |
| Support Vector | 71.1 | 73 | 67 | 70 | 70 | 75 | 72 |
| K-Nearest Neighbor | 74 | 73 | 74 | 74 | 74 | 74 | 74 |
| Random Forest | 73.2 | 73 | 73 | 73 | 73 | 74 | 74 |
| XGBoost | 74.2 | 77 | 69 | 73 | 72 | 79 | 75 |
| Classification | Method | Model accuracy (%) |
Behaviors | Precision (%) | Recall (%) | F1 (%) |
| General activities | Random Forest | 68.51 | GR | 65.2 | 67.9 | 66.5 |
| RE | 71.8 | 77.5 | 74.5 | |||
| W | 22.2 | 2.4 | 4.3 | |||
| XGBoost | 69.38 | GR | 67.1 | 67.2 | 67.2 | |
| RE | 72 | 77.9 | 74.9 | |||
| W | 48.3 | 16.9 | 25 | |||
| Fine activities | Random Forest | 62.38 | GR | 66.6 | 80.9 | 73.1 |
| RE | 47.1 | 18.6 | 26.7 | |||
| RU | 59.6 | 65.9 | 62.6 | |||
| XGBoost | 60.35 | GR | 67.2 | 76.4 | 71.5 | |
| RE | 36.5 | 20.9 | 26.6 | |||
| RU | 58.9 | 64.4 | 61.5 | |||
| Posture | Random forest | 83.94 | LD | 79.9 | 47.7 | 59.8 |
| SU | 84.7 | 96 | 90 | |||
| XGBoost | 83.7 | LD | 76.4 | 50.3 | 60.7 | |
| SU | 85.1 | 94.8 | 89.7 | |||
| Activities by posture | Random Forest | 58.87 | RE_LD | 30.6 | 15.2 | 20.3 |
| RE_SU | 46.2 | 34 | 39.1 | |||
| RU_LD | 50.9 | 52.6 | 51.8 | |||
| RU_SU | 52.2 | 39.9 | 45.2 | |||
| XGBoost | 58.78 | RE_LD | 47.6 | 10.1 | 16.7 | |
| RE_SU | 43.1 | 13.8 | 21 | |||
| RU_LD | 52.3 | 55.5 | 53.8 | |||
| RU_SU | 64.4 | 25.7 | 36.7 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).
