Soft Computing Approaches for Predicting Shade-Seeking Behavior in Dairy Cattle Under Heat Stress: A Comparative Study of Random Forests and Neural Networks
Sergi Sanjuan (),
Daniel Alexander Méndez,
Roger Arnau,
J. M. Calabuig,
Xabier Díaz de Otálora Aguirre and
Fernando Estellés
Additional contact information
Sergi Sanjuan: Instituto Universitario de Matemática Pura y Aplicada, Universitat Politècnica de València, Camino de Vera s/n, 46022 Valencia, Spain
Daniel Alexander Méndez: Instituto de Ciencia y Tecnología Animal, Universitat Politècnica de València, Camino de Vera s/n, 46022 Valencia, Spain
Roger Arnau: Instituto Universitario de Matemática Pura y Aplicada, Universitat Politècnica de València, Camino de Vera s/n, 46022 Valencia, Spain
J. M. Calabuig: Instituto Universitario de Matemática Pura y Aplicada, Universitat Politècnica de València, Camino de Vera s/n, 46022 Valencia, Spain
Xabier Díaz de Otálora Aguirre: Instituto de Ciencia y Tecnología Animal, Universitat Politècnica de València, Camino de Vera s/n, 46022 Valencia, Spain
Fernando Estellés: Instituto de Ciencia y Tecnología Animal, Universitat Politècnica de València, Camino de Vera s/n, 46022 Valencia, Spain
Mathematics, 2025, vol. 13, issue 16, 1-21
Abstract:
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.
Keywords: mathematical modeling; machine learning; soft computing; Random Forests; neural networks; heat stress in livestock; precision livestock farming (search for similar items in EconPapers)
JEL-codes: C (search for similar items in EconPapers)
Date: 2025
References: Add references at CitEc
Citations:
Downloads: (external link)
https://www.mdpi.com/2227-7390/13/16/2662/pdf (application/pdf)
https://www.mdpi.com/2227-7390/13/16/2662/ (text/html)
Related works:
This item may be available elsewhere in EconPapers: Search for items with the same title.
Export reference: BibTeX
RIS (EndNote, ProCite, RefMan)
HTML/Text
Persistent link: https://EconPapers.repec.org/RePEc:gam:jmathe:v:13:y:2025:i:16:p:2662-:d:1727330
Access Statistics for this article
Mathematics is currently edited by Ms. Emma He
More articles in Mathematics from MDPI
Bibliographic data for series maintained by MDPI Indexing Manager ().