Recent feeding history drives prediction of daily feed intake in lactating sows
Maria Victoria Souza, Alex Batista Trentin, Qianqian Huang, Hinayah Rojas de Oliveira, Brian Richert, Luiz Fernando Brito, Hyatt Frobose, Allan SchinckelAbstract
Accurate prediction of feed intake (FI) in lactating sows is essential for precision nutrition, welfare monitoring, and sustainable production. Feed intake during lactation is influenced by both physiological and environmental factors, but the complexity of individual FI makes traditional modeling approaches challenging. Machine learning (ML) provides flexible tools for capturing nonlinear dynamics in sow-feeding datasets. This study evaluated multiple ML algorithms to predict and forecast FI using 17,171 daily observations from 898 lactating sows. Five ML algorithms were tested: Generalized Additive Model (GAM), Elastic Net Regression (ENET), Random Forest (RDF), Extreme Gradient Boosting (XGB), and Light Gradient Boosting Machine (LGB). Predictors included environmental variables (daily maximum air temperature and daily maximum dew point), biological variables (parity and lactation day), and historical data derived from recent FI events (moving averages, lag variables, and intake variability), along with their interactions. An 8:2 sow-level train/test split was employed, along with grouped 5-fold cross-validation (CV) to prevent data leakage. Model performance, feature importance, and forecasting ability were assessed. All models performed similarly, with R ² values between 0.818 (ENET) and 0.828 (LGB) on the test sets and root mean squared errors (RMSE) between 0.993 kg (RDF) and 1.014 kg (ENET). However, GAM, ENET, and LGB showed less overfitting than XGB and RDF, evidenced by a train-test performance gap of over 5 percentage points. Forecasting accuracy remained strong for 1- to 3-day-ahead predictions (R² = 0.61–0.71) but declined progressively thereafter, suggesting that ML models captured short-term individual dynamics but gradually reverted toward lactation-specific averages over longer periods. Historical variables contributed to 71.6% of the total predictive power, with the three-day moving average being the most influential feature, according to its mean absolute Shapley additive explanatory value (SHAP) of 0.728, followed by the one-day lag (SHAP = 0.715). Models without historical variables showed decreased performance, with errors increasing from +0.294 to + 0.316 kg/d. Overall, this study demonstrates that ML models can accurately predict daily FI when incorporating historical data, highlighting the potential of ML-driven forecasting to facilitate personalized, data-driven feeding strategies in precision swine production systems.