Explainable Gradient Boosting for Egg Production Anomaly Detection in Laying Hen Farms
Abstract
Abstract- Small-scale laying-hen farms require analytical tools that can detect abnormal egg-production patterns while remaining interpretable for operational decision support. This study develops and evaluates an explainable gradient boosting framework for low-production anomaly detection using farm-level environmental, management, and production records. The dataset contained 481 observations with eight variables, including flock size, feed amount, ammonia, temperature, humidity, light intensity, noise, and total egg production. Exact-duplicate inspection found 407 duplicated rows; therefore, the 74 unique observations were used as the primary evaluation dataset. Egg production rate was derived by normalizing total egg output by flock size, and low-production anomalies were defined using the 10th percentile threshold, resulting in eight anomaly cases. Supervised tree-based models were evaluated using repeated stratified four-fold cross-validation with 20 repeats, and unsupervised methods were used as anomaly baselines. XGBoost achieved the best full-feature performance, with F1-score of 0.928, recall of 1.000, ROC-AUC of 0.997, and PR-AUC of 0.984. Sensitivity analysis without flock size showed that environmental and management variables retained useful signal. SHAP analysis indicated that flock size, light intensity, and temperature were the dominant predictors. The findings support interpretable operational monitoring of low egg-production patterns, although the results require validation on larger expert-labeled datasets.
References
[2] Y. A. Adejola, T. Z. Sibanda, I. Ruhnke, J. Boshoff, S. Pokhrel, and M. Welch, ‘Analyzing the Risk of Short-Term Losses in Free-Range Egg Production Using Commercial Data’, Agriculture, vol. 15, no. 7, p. 743, 2025, doi: 10.3390/agriculture15070743.
[3] L. Paura, I. Arhipova, L. Jankovska, N. Bumanis, G. Vitols, and M. Adjutovs, ‘Evaluation and association of laying hen performance, environmental conditions and gas concentrations in barn housing system’, Ital. J. Anim. Sci., vol. 21, no. 1, pp. 694–701, 2022, doi: 10.1080/1828051X.2022.2056528.
[4] A. K. Carranza-Díaz, D. Larios-Martínez, A. Ruiz-González, S. Godbout, and S. Fournel, ‘Modelling greenhouse gas and ammonia emissions from housing and manure storage in three laying hen production systems’, Biosyst. Eng., vol. 265, p. 104423, 2026, doi: 10.1016/j.biosystemseng.2026.104423.
[5] M. Li et al., ‘Multivariate analysis for data mining to characterize poultry house environment in winter’, Poult. Sci., vol. 103, no. 5, p. 103633, 2024, doi: 10.1016/j.psj.2024.103633.
[6] A. M. Pranta, S. M. A. Islam, and R. I. Khan, ‘Development of a sensor-integrated AI automation model for decision-based heat stress management in layer chickens under subtropical climate conditions’, Smart Agricultural Technology, vol. 12, p. 101306, 2025, doi: 10.1016/j.atech.2025.101306.
[7] R. B. Bist, S. Subedi, X. Yang, and L. Chai, ‘A Novel YOLOv6 Object Detector for Monitoring Piling Behavior of Cage-Free Laying Hens’, AgriEngineering, vol. 5, no. 2, pp. 905–923, 2023, doi: 10.3390/agriengineering5020056.
[8] R. Finistrosa, C. Mañoso, Á. P. de Madrid, and M. Romero, ‘Low-Cost IoT and LoRaWAN-Based System for Laying Hen Identification in Family Poultry Farms’, Applied Sciences, vol. 15, no. 9, p. 4856, 2025, doi: 10.3390/app15094856.
[9] A. Amirivojdan, A. Nasiri, S. Zhou, Y. Zhao, and H. Gan, ‘ChickenSense: A Low-Cost Deep Learning-Based Solution for Poultry Feed Consumption Monitoring Using Sound Technology’, AgriEngineering, vol. 6, no. 3, pp. 2115–2129, 2024, doi: 10.3390/agriengineering6030124.
[10] J. Chigwada, F. Mazunga, C. Nyamhere, V. Mazheke, and N. Taruvinga, ‘Remote poultry management system for small to medium scale producers using IoT’, Sci. Afr., vol. 18, p. e01398, 2022, doi: 10.1016/j.sciaf.2022.e01398.
[11] N. Bumanis, A. Kviesis, L. Paura, I. Arhipova, and M. Adjutovs, ‘Hen Egg Production Forecasting: Capabilities of Machine Learning Models in Scenarios with Limited Data Sets’, Applied Sciences, vol. 13, no. 13, p. 7607, 2023, doi: 10.3390/app13137607.
[12] H. Ji, Y. Xu, and G. Teng, ‘Predicting egg production rate and egg weight of broiler breeders based on machine learning and Shapley additive explanations’, Poult. Sci., vol. 104, no. 1, p. 104458, 2025, doi: 10.1016/j.psj.2024.104458.
[13] Y. Liu et al., ‘A Machine Learning Framework Based on Extreme Gradient Boosting to Predict the Occurrence and Development of Infectious Diseases in Laying Hen Farms, Taking H9N2 as an Example’, Animals, vol. 13, no. 9, p. 1494, 2023, doi: 10.3390/ani13091494.
[14] M. Welch, T. Z. Sibanda, J. D. S. Vilela, M. Kolakshyapati, D. Schneider, and I. Ruhnke, ‘An Initial Study on the Use of Machine Learning and Radio Frequency Identification Data for Predicting Health Outcomes in Free-Range Laying Hens’, Animals, vol. 13, no. 7, p. 1202, 2023, doi: 10.3390/ani13071202.
[15] L. A. van Veen, H. van den Brand, A. C. M. van den Oever, B. Kemp, and A. Youssef, ‘An adaptive expert-in-the-loop algorithm for flock-specific anomaly detection in laying hen production’, Comput. Electron. Agric., vol. 229, p. 109755, 2025, doi: 10.1016/j.compag.2024.109755.
[16] D. Berckmans, ‘General introduction to precision livestock farming’, Animal Frontiers, vol. 7, no. 1, pp. 6–11, Jan. 2017, doi: 10.2527/af.2017.0102.
[17] S. Neethirajan, ‘The role of sensors, big data and machine learning in modern animal farming’, Aug. 01, 2020, Elsevier B.V. doi: 10.1016/j.sbsr.2020.100367.
[18] A. Rajbongshi et al., ‘Leveraging explainable AI for sustainable agriculture: a comprehensive review of recent advances’, Artif. Intell. Rev., Jan. 2026, doi: 10.1007/s10462-025-11459-5.
[19] R. B. Bist, D. Wang, L. Chai, and Y. Xiong, ‘Precision Farming Technologies for Monitoring Livestock and Poultry’, Feb. 01, 2026, Multidisciplinary Digital Publishing Institute (MDPI). doi: 10.3390/agriengineering8020064.
[20] S. Neethirajan, S. Scott, C. Mancini, X. Boivin, and E. Strand, ‘Human-computer interactions with farm animals—enhancing welfare through precision livestock farming and artificial intelligence’, Front. Vet. Sci., vol. 11, 2024, doi: 10.3389/fvets.2024.1490851.
[21] A. Cartolano, A. Cuzzocrea, and G. Pilato, ‘Analyzing and assessing explainable AI models for smart agriculture environments’, Multimed. Tools Appl., vol. 83, no. 12, pp. 37225–37246, Apr. 2024, doi: 10.1007/s11042-023-17978-z.
[22] Y. A. Adejola, T. Z. Sibanda, I. Ruhnke, J. Boshoff, S. Pokhrel, and M. Welch, ‘Forecasting egg production performance and fluctuations in commercial free-range poultry systems using a random forest model’, Smart Agricultural Technology, vol. 12, Dec. 2025, doi: 10.1016/j.atech.2025.101380.
Copyright (c) 2026 Intra Swadaya Hidayat, Febria Sri Handayani, Yarza Aprizal, Almaheri Adhi Pratama, Muhammad Jhonsen Syaftriandi

This work is licensed under a Creative Commons Attribution 4.0 International License.
Authors who publish with this journal agree to the following terms:
- Authors retain copyright and grant the journal right of first publication with the work simultaneously licensed under Creative Commons Attribution 4.0 International License that allows others to share the work with an acknowledgment of the work's authorship and initial publication in this journal.
- Authors are able to enter into separate, additional contractual arrangements for the non-exclusive distribution of the journal's published version of the work (e.g., post it to an institutional repository or publish it in a book), with an acknowledgment of its initial publication in this journal.
- Authors are permitted and encouraged to post their work online (e.g., in institutional repositories or on their website) prior to and during the submission process, as it can lead to productive exchanges, as well as earlier and greater citation of published work (Refer to The Effect of Open Access).


.png)
.png)


