Abstract:Aiming to enhance the accuracy and interpretability of current heat stress prediction models for dairy cows, the extreme gradient boosting algorithm (XGBoost) was employed by using infrared body surface temperature and potential influencing factors. A Shapley value-based method, SHAP, was introduced to interpret the prediction outcomes. The maximum temperature (IRTmax) and average temperature (IRTave) from the trunk, fore udder (UD), face, and eyes were selected as body surface temperature variables, and environmental parameters and cow-specific variables were integrated to create a feature subset. The findings revealed that under heat stress conditions, the IRTmax and IRTave of the four body parts were significantly higher than that under non-heat stress conditions (p<0.01). Among the ensemble models compared, i.e., random forest, adaptive boosting, and gradient boosting decision trees, the XGBoost model, optimized through grid search and using fore udder infrared temperature (IRTave_UD) as a key feature, demonstrated the highest accuracy in predicting heat stress, achieving 80.8% accuracy, an F1 score of 79.2%, and an area under the ROC curve (AUC) of 0.873. SHAP analysis indicated that the average infrared temperature of the fore udder (IRTave_UD) positively correlated with heat stress likelihood, while lactation days showed a negative correlation. These two indicators were crucial for identifying heat stress in cows. The research findings can provide valuable technical support for precise cooling management in dairy barns during the summer season.