Organizations: Applied Artificial INtelligence and Intelligent Systems (AAIINS) Laboratory, Dhaka 1217, Bangladesh · Department of Computer Science and Engineering, United International University, Dhaka 1212, Bangladesh · Department of Data Science and Artificial Intelligence, Monash University, Melbourne 3800, Australia · Department of Software Systems & Cybersecurity, Monash University, Melbourne 3800, Australia · Energy and Resources Institute, Faculty of Science and Technology, Charles Darwin University, NSW 2000, Australia · Faculty of Science and Technology, Charles Darwin University, Casuarina, NT, 0810 Australia · School of Engineering and Energy, Murdoch University, Murdoch, WA 6150, Australia · Energy and Resources Institute, Faculty of Science and Technology, Charles Darwin University, Darwin, NT, 0810, Australia
Precision livestock farming requires accurate and timely heat stress prediction to ensure animal welfare and optimize farm management. This study presents a physics-informed digital twin (DT) framework combined with an uncertainty-aware, expert-weighted stacked ensemble for multimodal forecasting of Core Body Temperature (CBT) in dairy cattle. Using the high-frequency, heterogeneous MmCows dataset, the DT integrates an ordinary differential equation (ODE)-based thermoregulation model that simulates metabolic heat production and dissipation, a Gaussian process for capturing cow-specific deviations, a Kalman filter for aligning predictions with real-time sensor data, and a behavioral Markov chain that models activity-state transitions under varying environmental conditions. The DT outputs key physiological indicators, such as predicted CBT, heat stress probability, and behavioral state distributions are fused with raw sensor data and enriched through multi-scale temporal analysis and cross-modal feature engineering to form a comprehensive feature set. The predictive methodology is designed in a three-stage stacked ensemble, where stage 1 trains modality-specific LightGBM 'expert' models on distinct feature groups, stage 2 collects their predictions as meta-features, and at stage 3 Optuna-tuned LightGBM meta-model yields the final CBT forecast. Predictive uncertainty is quantified via bootstrapping and validated using Prediction Interval Coverage Probability (PICP). Ablation analysis confirms that incorporating DT-derived features and multimodal fusion substantially enhances performance. The proposed framework achieves a cross-validated R2 of 0.783, F1 score of 84.25% and PICP of 92.38% for 2-hour ahead forecasting, providing a robust, uncertainty-aware, and physically principled system for early heat stress detection and precision livestock management.
Figures & tables
Study
Multimodal Fusion
Physics- Informed
Continuous CBT Forecasting
Uncertainty Quantification
Personalization
Becker et al. [ 25 ]
✓
✗
✗
✗
✗
Georgiades et al. [ 26 ]
✗
✗
✗
✗
✗
Woodward et al. [ 27 ]
✗
✗
✗
✗
✗
Daniels et al. [ 28 ]
✗
✗
✗
✗
✗
Li et al. [ 22 ]
✓
✗
✓
✗
✗
Chapman et al. [ 24 ]
✓
✗
✗
✗
✗
Table 1: Comparison of the Proposed Framework with State-of-the-Art Methods.
Figure 1: High-level architecture of the proposed multimodal forecasting framework. Raw data from cow-worn and environmental sensors undergo temporal alignment and preprocessing before being fed into a Physics-Informed Digital Twin. The digital twin dynamically couples a behavioral Markov model, a thermodynamic ODE, a Kalman filter, and a Gaussian process to generate uncertainty-aware physiological and behavioral state features. These are fused with multi-scale engineered features to train modality-specific experts and an optimized meta-model, ultimately yielding continuous 2-hour ahead core body temperature (CBT) forecasts and heat-stress classification. Copyright Free Cow Image source: Freepik 1 1 1 https://www.freepik.com/free-photo/cow-grazing-green-meadow_11244779.htm .
Figure 2: Overview of the proposed pipeline. Sensor data from eight modalities are aligned and preprocessed, then passed through a physics-informed DT that models thermal and behavioral dynamics. Multi-scale features are engineered and fed into modality-specific base models. An expert-weighted ensemble fuses predictions, with bootstrap-based uncertainty quantification yielding final CBT forecasts and heat-stress risk estimates.
Figure 3: Internal Computational Loop of the physics-informed DT. The diagram illustrates the recursive state estimation cycle performed at each time step t . It unifies the mechanistic prediction (ODE), behavioral context (Markov), sensor correction (Kalman Filter), and uncertainty quantification (Gaussian Process) into a closed-loop adaptive system.
Table 2: Parameters of the physics-based thermal ODE (Eq. 8 ). Each parameter’s status (fixed, calibrated, or learned per cow) and source are specified in the text.
Figure 4: The overview of the hierarchical fusion strategy. Modality-specific “Specialist” models ( M1…Mn ) are trained independently. Their validation performance ( R2 ) determines their contribution weight ( Wi ). These weighted predictions are concatenated with global context features ( Fglobal ) to train the Meta-Regressor ( fmeta ), which outputs both the final forecast and uncertainty bounds.
Model
MAE ↓
RMSE ↓
R2↑
Linear Regression
0.1737 ± 0.0293
0.2112 ± 0.0323
0.4571 ± 0.1688
Random Forest
0.1712 ± 0.0125
0.2206 ± 0.0181
0.4184 ± 0.0669
Decision Tree
0.1576 ± 0.0171
0.2021 ± 0.0262
0.5025 ± 0.1393
Gradient Boosting
0.1552 ± 0.0122
0.1987 ± 0.0210
0.5242 ± 0.0984
XGBoost
0.1538 ± 0.0120
0.1972 ± 0.0203
0.5909 ± 0.0954
SVR
0.1793 ± 0.0227
0.2259 ± 0.0290
0.3908 ± 0.1130
Table 3: Performance Comparison of Baseline Models and the Proposed Multimodal Model.
Figure 5: Modality Prediction Correlation Matrix. This heatmap illustrates the Pearson correlation coefficients between the predictions of the modality-specific base learners. The high correlation between dt_features and phys_cbt (0.67) validates the DT’s physiological fidelity, while lower correlations in environmental features confirm the model diversity required for the stacked ensemble.
Figure 6: CBT Prediction Over Time. The model’s predictions (red dashed line) accurately track the true CBT values (blue solid line) and effectively capture the critical crossing of the heat stress threshold (black dotted line at 38.8 ∘ C). This demonstrates the model’s capability for timely early warnings.
Feature Group
MAE ↓
RMSE ↓
R2↑
phys_cbt
0.1830 ± 0.0145
0.2313 ± 0.0190
0.3786 ± 0.0644
behav_ankle
0.2340 ± 0.0159
0.2925 ± 0.0155
0.3459 ± 0.0330
behav_immu
0.2349 ± 0.0177
0.2923 ± 0.0176
0.2578 ± 0.0422
behav_uwb
0.2351 ± 0.0195
0.2943 ± 0.0217
0.1429 ± 0.0179
env_weather
0.2133 ± 0.0112
0.2600 ± 0.0136
0.2147 ± 0.0321
prod_milk
0.2372 ± 0.0144
0.2978 ± 0.0159
0.0513 ± 0.0369
Table 4: Ablation Study on Feature Group Importance.
Metric
With DT
Without DT
Improvement
MAE
0.1147
0.1385
+17.22%
RMSE
0.1435
0.1756
+18.29%
R2
0.7835
0.6927
+13.06%
PICP
92.38%
86.52%
+6.77%
Table 5: Ablation Study on the Digital Twin Component.
Figure 7: Comprehensive Regression Analysis. (Top-left) Prediction vs True Values scatter plot with color gradient indicating prediction density and red dashed line representing perfect prediction. ( Top-middle ) Error Distribution histogram with KDE overlay showing the distribution of prediction errors. ( Top-right ) Residual Distribution plot with trend line indicating no systematic bias. ( Bottom ) True Values and Predictions over time with uncertainty intervals (shaded area), demonstrating the model’s ability to quantify prediction uncertainty. The model achieves MAE: 0.114°C, RMSE: 0.143°C, and R²: 0.783.
Figure 8: Extended Performance Analysis. (Left) Autocorrelation of prediction errors shows no significant patterns beyond lag 0, indicating that the model has captured the temporal dynamics of the data without leaving systematic patterns in the residuals. ( Right ) Rolling performance metrics ( MAE , RMSE, R²) remain stable over the evaluation period, showing model robustness across different time segments.
Figure 9: Classification Performance for Heat Stress Prediction. (Left) Normalized Confusion Matrix showing high accuracy for both Normal (0.94) and Stress (0.82) classes. (Middle) ROC Curve with AUC of 0.967, demonstrating good discriminative ability. The optimal threshold is identified at 38.630°C. (Right) Precision-Recall Curve with AUC of 0.946, indicating strong performance across different classification thresholds. The model achieves an accuracy of 0.8938, precision of 0.8411, recall of 0.8453, and F1-score of 0.8425.
College of Information and Electrical Engineering, China Agricultural University, Beijing, 100083, China · National Innovation Center for Digital Fishery, Ministry of Agriculture and Rural Affairs, Beijing, 100083, China · Key Laboratory of Smart Farming Technologies for Aquatic Animal and Livestock, Ministry of Agriculture and Rural Affairs, Beijing, 100083, China +1
a School of Computing, Mathematics and Engineering, Charles Sturt University, Wagga Wagga, NSW 2650, Australia · b School of Computing, Mathematics and Engineering, Charles Sturt University, Albury, NSW 2640, Australia · c Gulbali Institute for Agriculture, Water and Environment, Charles Sturt University, Wagga Wagga, NSW 2678, Australia +4