Soft Computing Approaches for Predicting Shade-Seeking Behavior in Dairy Cattle Under Heat Stress: A Comparative Study of Random Forests and Neural Networks
Heat stress is one of the main welfare and productivity problems faced by dairy cattle in Mediterranean climates. The main objective of this work is to predict heat stress in livestock from shade-seeking behavior captured by computer vision, combined with some climatic features, in a completely non-invasive way. To this end, we evaluate two soft computing algorithms—Random Forests and Neural Networks—clarifying the trade-off between accuracy and interpretability for real-world farm deployment. Data were gathered at a commercial dairy farm in Titaguas (Valencia, Spain) using overhead cameras that counted cows in the shade every 5–10 min during summer 2023. Each record contains the shaded-cow count, ambient temperature, relative humidity, and an exact timestamp. From here, three thermal indices were derived: the current THI, the previous-night mean THI, and the day-time accumulated THI. The resulting dataset covers 75 days and 6907 day-time observations. To evaluate the models’ performance a 5-fold cross-validation is also used. The results show that both soft computing models outperform a single Decision Tree baseline. The best Neural Network (3 hidden layers, 16 neurons each, learning rate =10−3) reaches an average RMSE of 14.78, while a Random Forest (10 trees, depth =5) achieves 14.97 and offers the best interpretability. Daily error distributions reveal a median RMSE of 13.84 and confirm that predictions deviate less than one hour from observed shade-seeking peaks. Although the dataset came from a single farm, the results generalized well within the observed range. However, the models could not accurately predict the exact number of cows in the shade. This suggests the influence of other variables not included in the analysis (such as solar radiation or wind data), which opens the door for future research.
Authors
- J. M. Calabuig (ORCID: https://orcid.org/0000-0001-8398-8664)
- Fernándo Estellés (ORCID: https://orcid.org/0000-0001-6774-6075)
- Daniel Alexander Méndez (ORCID: https://orcid.org/0000-0001-6414-305X)
- Roger Arnau (ORCID: https://orcid.org/0000-0003-2544-8875)
- Xabier Díaz de Otálora (ORCID: https://orcid.org/0000-0003-4841-079X)
- Sergi Sanjuan
Institutions
- Universitat Politècnica de València (ES)
Publication Details
- Journal
- Mathematics
- Published
- 2025-08-19
- DOI
- https://doi.org/10.3390/math13162662
- Citations
- 1
- Primary Topic
- Effects of Environmental Stressors on Livestock
- Type
- article
- Field-Weighted Citation Impact
- 1.19
Funders
- European Commission
- HORIZON EUROPE Framework Programme
- Universitat Politècnica de València
- Agencia Estatal de Investigación