Abstract
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 R2 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 (R2 = 0.61 to 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.
Keywords: forecasting, precision livestock farming, predictive modeling, temporal patterns
Machine learning can precisely predict daily feed intake in lactating sows when recent feeding history is available. The results support the use of continuous feeding records to increase precision nutrition and short-term intake forecasts in commercial swine systems.
Introduction
Lactating sow feed intake (FI) is a central determinant of sow productivity, welfare, and biological efficiency (NRC 2012; Gormley et al. 2024; Greiner and Wileman 2025). During lactation, inadequate FI compromises milk production, increases body reserve mobilization, and can negatively affect litter growth (Koketsu et al. 1997; Kim and Easter 2001; Rodríguez et al. 2023; Gormley et al. 2024). At the same time, feed represents the largest cost in sow production, making its accurate management essential not only for performance but also for economic and environmental sustainability (Wade 2023). This challenge is important for hyper-prolific sows, whose nutrient demands are higher (Hansen et al. 2012), but FI is often variable and difficult to predict.
The regulation of FI during lactation is complex and influenced by several, often interacting, factors. For instance, biological characteristics such as parity, body condition, and litter size affect FI capacity (Kim et al. 2009; Hansen et al. 2012; Cozannet et al. 2018), while environmental conditions, especially high thermal load, can depress consumption (Johnson et al. 2022; Gormley et al. 2024). The expansion of precision livestock farming has made it possible to capture this complexity at a large scale, as automated feeding systems enable recording of individual sow FI continuously through lactation (Gaillard et al. 2019; Rodríguez et al. 2023). This multitude of data creates both an opportunity and a challenge to transform high-resolution feeding data into actionable management decisions at the farm level.
Machine learning (ML) models have been explored for this purpose because they are well-suited to nonlinear, high-dimensional, and temporally structured data (Hawkins 2009; Liakos et al. 2018; Morota et al. 2018), such as daily FI. In lactating sows, they are very attractive because recent feeding history may capture information about a sow’s current physiological state, stress burden, and adaptive capacity (Gaillard et al. 2019; Vargovic et al. 2021). However, despite increasing interest in ML-based prediction, relatively little focus has been placed on the forecasting ability of these models. For precision feeding, this is significant because the key question is not only whether FI can be described accurately, but also whether future FI can be reliably predicted to aid management decisions. For example, this is important because both under- and over-supplementation can decrease nutritional efficiency (Huber 2025). The first is by limiting performance and the second is by unnecessarily increasing feeding costs. Therefore, the present study aimed to address this gap by evaluating whether ML models can provide useful short-term forecasts of daily FI in lactating sows. Specifically, we (i) compared and validated multiple ML algorithms using biological, environmental, and historical FI predictor variables; (ii) assessed the relative importance of these predictor groups; and (iii) tested models’ performance for short-term forecasting across different time intervals.
Materials and methods
Animals and housing
This study used retrospective production records; therefore, Institutional Animal Care and Use Committee approval was not required. Data collection and animal management protocols are described in detail by Huang et al. (2026). Briefly, retrospective production records were analyzed from 898 lactating sows (Landrace × Large White) housed in a commercial facility during the summer of 2024 (May–July). Sows were primarily of parity 1 (n = 503), with remaining animals in parities 2 (n = 138) and 3 + (n = 257). Average lactation length was 20.1 ± 0.97 days (range: 1 to 25 d). Individual daily feed intake (DFI) was recorded via electronic feeders (GESTAL, Jyga Technologies Inc., St-Lambert-de-Lauzon, QC, Canada), with sows receiving a standard lactation diet (NRC 2012). Prior to analysis, variable names were standardized, and inconsistent labels were harmonized. Records with missing daily feed intake were removed, and only observations within the predefined lactation window (days 1 to 22) were retained. Predictor features were then constructed from the edited dataset, with missing predictor values imputed using median values derived from the training set. A total of 17,171 DFI observations from 898 sows were utilized for subsequent analyses. As multiple DFI observations were available per sow, observations were not considered statistically independent at the sow level. Therefore, sow identification was used as the grouping variable in data splitting and cross-validation procedures between training and testing sets.
Feature engineering
To ensure a leakage-safe pipeline, features for any given prediction day d were engineered using only information available up to day d − 1. Features were categorized into three distinct domains: biological, historical, and environmental (Table 1), as follows: biological predictors included parity (1, 2, or 3+), lactation day (1 to 22), and room number (13 levels) to account for housing-level variance. To capture the nonlinear trajectory of the lactation curve, we included a parity-by-lactation-day interaction and polynomial terms (quadratic and cubic). Historical predictors were derived from individual sow feeding records using a rolling window approach. These included lag values (Lag1, −2, −3, and −7 days), moving averages (MA3, MA5, and MA7), and a 3-day coefficient of variation (CV3) to capture DFI stability. We also calculated “intake velocity” as the difference between Lag1 and Lag2 to represent short-term shifts. A “room mean intake” covariate was also calculated, from training data only, to serve as a baseline for environmental and management factors within room facilities. Environmental predictors were obtained from NASA’s POWER database (Sparks 2018), including daily maximum temperature (Tmax, °C), maximum dew point (Tdew, °C), and cumulative heat load (DGH24; degree-hours above 24°C). To account for delayed physiological heat stress responses, 1-day lags and 2-day moving averages were computed for Tmax and Tdew. Finally, interactions between those variables and lactation day were included to model the increasing sensitivity to heat stress as metabolic demand rises during peak lactation (Dourmad et al. 2022).
Table 1.
Descriptive statistics of features used as predictors in machine learning models for daily feed intake in lactating sows (N = 17,171 observations).
| Category | Feature | Mean (SD) | Range |
|---|---|---|---|
| Biological | Parity (number) | 1.73 (0.88) | 1–3 |
| Lactation Day | 11.01 (5.56) | 1–22 | |
| Parity × Lactation Day | – | – | |
| Room mean intake | 6.62 (1.79) | 2.16–11.01 | |
| Environmental | T max | 28.5 (2.7) | 22.31–33.92 |
| T dew | 20.97 (3.48) | 12.03–26.85 | |
| DGH24 | 11.15 (5.19) | 0–24 | |
| T dew Lag 1 | 20.97 (3.49) | 12.03–26.85 | |
| T dew MA2 | 21.01 (2.92) | 12.56–26.2 | |
| T max Lag1 | 28.52 (2.72) | 22.31–33.92 | |
| T max MA2 | 28.57 (2.28) | 23.38–33.34 | |
| DGH24 Lag 1 | 11.17 (5.24) | 0–24 | |
| Lactation day × Tdew | – | – | |
| Lactation day × Tmax | – | – | |
| Historical | Intake CV3 | 0.13 (0.1) | 0–1.03 |
| Intake Lag 1 | 6.51 (2.3) | 0.23–13.71 | |
| Intake Lag 2 | 6.39 (2.28) | 0.23–13.27 | |
| Intake Lag 3 | 6.27 (2.25) | 0.23–13.27 | |
| Intake Lag 7 | 5.62 (1.99) | 0.23–12.91 | |
| Intake MA3 | 6.58 (2.09) | 0.72–12.89 | |
| Intake MA5 | 6.61 (1.96) | 1.48–12.51 | |
| Intake MA7 | 6.64 (1.82) | 1.89–12.26 | |
| Intake velocity | 0.31 (1.15) | −7.4–6.93 |
SD: standard deviation; × represents interaction; Tmax: daily maximum temperature; Tdew: daily maximum dew point temperature; DGH24: degree-hours above 24°C; Lag n: value recorded n days prior to the observation day; MAn: simple moving average over the preceding n days; CV3: coefficient of variation over the preceding 3 days; Intake velocity: first-order difference in daily feed intake. All intake values are in kg/day; temperature variables are in °C.
Machine learning workflow
The modeling pipeline was implemented in R version 4.4.0 (R Core Team 2025) using a sow-independent generalization framework.
Data preprocessing
The dataset (N = 17,171 DFI observations from 898 sows) was randomly partitioned at the sow level into training (80%, n = 13,754 DFI observations from 718 sows) and testing (20%, n = 3436 DFI observations from 180 sows) sets. Within the training set, hyperparameter tuning was performed using a sow-level grouped 5-fold CV (Table 2). To assess the stability of model performance estimates, 20 independent sow-level random splits were performed using distinct random seeds. Performance metrics were summarized as mean ± SD with 95% empirical confidence intervals across replicates.
Table 2.
Hyperparameter search space and best parameters selected via 5-fold cross-validation and grid search for each algorithm.
| Model | Algorithm type | Search space | Best parameters |
|---|---|---|---|
| LGB | Gradient boosting (leaf-wise) | learning_rate ∈ {0.03, 0.07, 0.1}; num_leaves ∈ {31, 63, 127}; min_data_in_leaf ∈ {10, 20, 40} | learning_rate = 0.03; num_leaves = 31; min_data_in_leaf = 40; nrounds = 246 |
| RDF | Bagging ensemble | mtry ∈ {7, 11, 17}; | mtry = 7; |
| nodesize ∈ {5, 10, 20}; | nodesize = 20; | ||
| ntree = 500 | ntree = 500 | ||
| XGB | Gradient boosting (level-wise) | η ∈ {0.05, 0.1}; | η = 0.05; |
| max_depth ∈ {4, 6};nrounds ∈ {300, 500} | max_depth = 6; nrounds = 500; subsample = 0.8; colsample = 0.8; min_child_weight = 5 | ||
| GAM | Semiparametric regression | Smooth terms: k = 5; | 11 smooth terms (lactation day, lag/MA features, environment); 9 linear terms (parity, interactions) |
| method = fast REML; | |||
| select = TRUE | |||
| ENET | Regularized linear regression |
|
α = 1; λ = 1.00 × 10−4 |
LGB: Light Gradient Boosting Machine; RDF: Random Forest; XGB: Extreme Gradient Boosting; GAM: Generalized Additive Model; ENET: Elastic Net Regression; REML: restricted maximum likelihood.
Algorithm implementation
Five structurally diverse algorithms were evaluated:
Generalized Additive Models (GAM): well-suited to modeling continuous biological processes since they smooth temporal trajectories (Ferrari 2025; Simpson 2025). In summary, the GAM extends generalized linear models by allowing smooth, nonlinear functions of predictors while maintaining interpretability (Wood 2017). The GAM was implemented via the mgcv package (Wood 2017) using bam with fast restricted maximum likelihood (REML). Smooth terms were fitted using penalized thin-plate regression splines. We employed automatic term selection (select = TRUE), which applies an extra penalty to shrink uninformative smooths toward zero effective degrees of freedom.
Elastic Net Regression (ENET): ENET is a regularized linear approach combining Lasso and Ridge penalties (Zou and Hastie 2005). This model tested whether the engineered features linearized the problem sufficiently for competitive performance. The mixing parameter was tuned with λ optimized via cross-validation (Zou and Hastie 2005). Models were fit using the glmnet package (Friedman et al. 2010).
Random Forest (RDF): builds an ensemble of decision trees, each trained on a bootstrap sample of the data with random feature selection at each split, with predictions averaged across all trees (Breiman 2001). This approach can detect complex feature interactions (eg parity-dependent temperature effects) without requiring explicit specification. The randomForest package was used with a bagging ensemble of 500 decision trees (Breiman 2001).
Extreme Gradient Boosting (XGB): A gradient boosting framework utilizing level-wise tree growth (Chen and Guestrin 2016) was optimized for learning rate, tree depth, and subsampling ratios via grid search, using the xgboost package (Chen and Guestrin 2016).
Light Gradient Boosting Machine (LGB): A gradient boosting architecture utilizing leaf-wise tree growth and histogram-based binning (Ke et al. 2017). This was selected for its computational efficiency and potential to capture localized patterns in continuous biological data and implemented using the lightgbm package (Ke et al. 2017).
Model performance evaluation
Model performance was quantified through coefficient of determination (R2), mean absolute error (MAE, kg), mean absolute percentage error (MAPE, %), and root mean squared error (RMSE, kg), which can be expressed as:
where represents observed intake, is the predicted intake and n is the number of observations.
To evaluate generalization capacity, metrics were compared between training and testing sets. Overfitting was quantified as the absolute difference between training and testing R2 values. A train-test performance gap > 5 R2 percentage points was considered indicative of overfitting. Models exhibiting large train–test discrepancies were interpreted as having reduced generalizability. The training time (in seconds) was also included for comparison regarding computational time.
Feature importance
Feature importance for the best-performing model was assessed using Shapley Additive Explanation (SHAP) values (Lundberg and Lee 2017; Tulpan et al. 2026). This framework provides a unified measure of feature contribution by calculating the marginal effect of each variable on individual predictions. We utilized the LGB native SHAP implementation. Global feature importance was determined by computing the mean absolute SHAP values across the held-out test set, representing the average magnitude of each feature’s impact on the predicted DFI.
Forecasting analyses
To assess forecasting capability, models were refitted to predict FI at multiple time intervals (1 to 13 days ahead). For interpretation, a practical performance threshold for the forecasting horizon was defined as the longest time interval at which the best-performing model maintained an R2 of at least 0.60. Model performance relative to the one-day-ahead forecast was also reported to describe the proportional loss in accuracy across horizons. For n day-ahead forecasting, historical features were calculated using data available n days prior, excluding any information from the intervening period. The rationale behind this approach was to mimic real-farm scenarios where producers might want to anticipate FI declines before they occur, allowing proactive interventions. To benchmark forecasting performance against a naive baseline, a persistence model was also evaluated at each horizon, whereby the predicted value for day was set equal to the last observed FI value at day (Gauthier et al. 2021). The persistence model represents the simplest possible forecasting strategy and establishes the minimum performance threshold that any ML model should exceed to justify its added complexity. Forecasting performance was evaluated using R2 and RMSE on the held-out test set, with ML model results compared against the persistence baseline to assess the added predictive value of the learned features.
Sensitivity analyses
To quantify the value of continuous individual intake monitoring, all five models were retrained excluding all historical features, retaining only biological and environmental predictors. Predictive performance of reduced models was compared to full models on the held-out test set, isolating the contribution of automated individual feeding records beyond population-level and environmental information.
Results
Descriptive statistics
Mean DFI was 6.62 ± 2.33 kg, with variation across individuals (range: 0.23 to 13.71 kg). Feed intake increased rapidly from day 4 (4.60 ± 1.13 kg) to peak around day 20 (8.80 ± 1.85 kg), then declined gradually toward weaning. As expected, primiparous sows consumed less feed (mean = 4.89 kg/d) than parity 2 and 3 + sows (mean = 6.12 to 6.31 kg/d). Environmental conditions during the study period averaged 28.50 ± 2.7°C [22 to 34°C], and 20.96 ± 3.5°C [12.03 to 26.85°C] for Tmax and Tdew, respectively, with an average of 11.15 ± 5.2 heat hours above 24°C per day. No significant differences were observed between training and testing sets for biological, historical, or environmental predictors (P > 0.05), confirming a balanced split.
Model performance
Table 3 and Figs. 1 and 2 summarize the predictive performance of all five algorithms on the held-out test set. Tree-based ensemble methods achieved the highest accuracy, with LGB, RDF, and XGB yielding test R2 of 0.828, 0.825, and 0.824, and MAE of 0.741, 0.747, and 0.749 kg, respectively. GAM and ENET performed comparably to each other (test R2 = 0.820 and 0.818; MAE = 0.769 and 0.774 kg) but below the tree-based models by approximately 0.021 kg RMSE. All models exceeded a baseline multiple linear regression (results not shown), confirming the predictive gain attributable to nonlinear modeling and engineered features. Overfitting was minimal for GAM and ENET, with train-test R2 gaps of 0.002 and 0.003, respectively. Tree-based models showed moderate train-test gaps (LGB: 0.039; XGB: 0.099; RDF: 0.103), with RDF and XGB exceeding the a priori-defined 5-percentage-point threshold as indicative of reduced generalizability.
Table 3.
Predictive performance of five machine learning algorithms for daily feed intake in lactating sows on training and held-out test sets.
| Model |
R
2
|
RMSE (kg) |
MAE (kg) |
MAPE (%) |
Training time | Overfit* | ||||
|---|---|---|---|---|---|---|---|---|---|---|
| Train | Test | Train | Test | Train | Test | Train | Test | seconds | ΔR2 | |
| LGB | 0.867 | 0.828 | 0.845 | 0.986 | 0.639 | 0.741 | 12.81 | 15.73 | 415.760 | 0.039 |
| RDF | 0.928 | 0.825 | 0.621 | 0.993 | 0.465 | 0.747 | 9.53 | 15.81 | 436.812 | 0.103* |
| XGB | 0.924 | 0.824 | 0.64 | 0.997 | 0.488 | 0.749 | 9.88 | 15.74 | 633.323 | 0.099* |
| GAM | 0.822 | 0.82 | 0.977 | 1.009 | 0.733 | 0.769 | 14.57 | 16.3 | 58344.2 | 0.002 |
| ENET | 0.822 | 0.818 | 0.979 | 1.014 | 0.736 | 0.774 | 14.55 | 16.34 | 1388.02 | 0.003 |
Overfit gap = Train R2 − Test R2. Values > 0.05 (marked *) exceed the threshold defined a priori as indicative of reduced generalizability. Models are ranked by Test R2 in descending order. LGB: Light Gradient Boosting Machine; RDF: Random Forest; XGB: Extreme Gradient Boosting; GAM: Generalized Additive Model; ENET: Elastic Net Regression; RMSE: root mean squared error; MAE: mean absolute error; MAPE: mean absolute percentage error.
Figure 1.

Test-set predictive performance across five machine learning models for daily feed intake prediction in lactating sows. Evaluation metrics included mean absolute error (MAE, kg), mean absolute percentage error (MAPE, %), coefficient of determination (R2), and root mean square error (RMSE, kg). Models included Elastic Net Regression (ENET, orange), Generalized Additive Model (GAM, green), Random Forest (RDF, blue), Extreme Gradient Boosting (XGB, red), and Light Gradient Boosting Machine (LGB, purple). Lower values indicate better performance for MAE, MAPE, and RMSE; higher values indicate better performance for R2. Numeric labels at the end of each bar indicate the exact metric value for each model.
Figure 2.

Observed versus predicted daily feed intake (kg) for five machine learning models predicting daily feed intake in lactating sows. Elastic Net Regression (ENET), Generalized Additive Model (GAM), Light Gradient Boosting Machine (LGB), Random Forest (RDF), and Extreme Gradient Boosting (XGB). Each hexagonal bin represents a region of the prediction space, with color indicating the density of observations on a log scale from 1 (dark purple) to 30 + (yellow). The dashed red line represents the perfect prediction line (slope = 1, intercept = 0), and the solid black line represents the fitted regression of predicted on observed values.
All models captured the characteristic temporal trajectory of DFI, characterized by a rapid increase during early lactation, peaking around days 18 to 20, and a gradual decline toward weaning (Koketsu et al. 1996; Rodríguez et al. 2023). Root mean squared errors ranged from 0.75 to 1.00 kg during days 3 to 21 across all ML algorithms. The largest errors occurred on day 1, where historical features were unavailable and on day 22, the final lactation day, where sample size was reduced and intake variability was highest (Fig. 3). Across all lactation stages, LGB and XGB produced the lowest RMSE, with the largest model separation occurring in late lactation (days 21 to 22). No model exhibited systematic directional bias across lactation days.
Figure 3.

Prediction error (RMSE, kg) by lactation day for five machine learning models predicting daily feed intake in lactating sows. Lines represent Elastic Net Regression (ENET, orange), Generalized Additive Model (GAM, green), Random Forest (RDF, blue), Extreme Gradient Boosting (XGB, red), and Light Gradient Boosting Machine (LGB, purple). RMSE was computed across sow-level cross-validation folds for each lactation day independently.
When stratified by parity, all models correctly ranked intake by parity group, with P3 + sows showing the highest predicted intake, followed by P2 and P1. Prediction accuracy improved with parity across all algorithms. Test R2 for P3 + sows exceeded that for P1 sows by 6 to 8 percentage points (eg LGB: R2 = 0.832 for P3 + vs 0.768 for P1), consistent with the higher intake variability among primiparous sows. Absolute errors were higher for P2 sows than for P1 or P3 + across all models, likely reflecting the smaller number of P2 sows (n = 138).
Feature importance
The ranking of feature importance for the best model (LGB) is shown in Table 4. SHAP analyses revealed that historical DFI features accounted for 71.6% of total predictive power. The three-day moving average (MA3) was the most influential single feature (mean absolute SHAP = 0.728), followed closely by the one-day lag (Lag1, SHAP = 0.715). Biological and environmental variables contributed 17.5% and 10.9% to predictive power, respectively. Among biological variables, the parity-by-lactation day interaction term was the most important (SHAP = 0.354), while parity alone (SHAP = 0.048) was close in importance to lactation day (SHAP = 0.043).
Table 4.
Feature importance of the top 10 ranking based on mean absolute SHAP values for the Light Gradient Boosting Machine model.
| Rank | Abbreviation | Mean Absolute SHAP | Category |
|---|---|---|---|
| 1 | MA3 | 0.728 | Historical |
| 2 | Lag1 | 0.715 | Historical |
| 3 | Parity × Day | 0.354 | Biological |
| 4 | RoomMA | 0.137 | Historical |
| 5 | Lag2 | 0.125 | Historical |
| 6 | MA5 | 0.078 | Historical |
| 7 | Day × Tmax | 0.072 | Environmental |
| 8 | Parity | 0.048 | Biological |
| 9 | Lactation day | 0.043 | Biological |
| 10 | Day × Tdew | 0.034 | Environmental |
SHAP: Shapley additive explanation × represents interaction; Tmax: maximum daily temperature; Tdew: maximum dew point temperature; Lag n: value recorded n days prior to the observation day; MAn: simple moving average over the preceding n days.
SHAP dependence plots are shown in Fig. 4 and illustrate the functional relationships between the top four predictors and model predictions. For MA3 and Lag1, both relationships followed a sigmoid-like positive curve. The two features showed comparable SHAP ranges (approximately −1.3 to + 1.9), consistent with their similar mean absolute SHAP values. A notable vertical cluster of points is visible around 6.5 and 6.0 for MA3 and Lag1, respectively, reflecting a common baseline intake value in the dataset. For Parity × Day, the relationship was also nonlinear. SHAP values ranged from negative to approximately + 0.3 to 0.4 at low interaction values (<10) and then plateaued, suggesting that the combined effect of parity and lactation stage is most informative early in lactation.
Figure 4.

Shapley additive explanation value (SHAP) dependence plots. Plots show the relationship between observed feature values (x-axis) and their corresponding SHAP values (impact on daily feed intake, DFI; y-axis) for the four most important predictors in the Light Gradient Boosting Machine (LGB) model. MA3, three-day moving average of intake; Lag1, one-day lagged intake; Parity × Day, parity-by-lactation-day interaction; and RoomMA, room mean intake. Each point represents a single observation. The black curve represents a smoothed trend line. Positive SHAP values indicate that the feature increased the predicted DFI relative to the baseline, while negative values indicate a decrease.
Sensitivity analyses
To quantify the contribution of continuous intake monitoring, models were retrained using only environmental and biological features, excluding all historical variables derived from historical intake. The performance of these reduced models dropped compared to the full model (Table 5). All models dropped performance without historical features, with changes in R2 ranging from −0.119 to −0.132 and errors increasing from + 0.294 to + 0.316 kg/d.
Table 5.
Predictive performance of five machine learning modeling approaches for daily feed intake using the full feature set (including historical features) and a reduced model excluding historical features.
| Model | Full model |
Without historical features |
Performance loss |
|||
|---|---|---|---|---|---|---|
| R 2 | RMSE (kg) | R 2 | RMSE (kg) | ΔR2 | ΔRMSE (kg) | |
| LGB | 0.828 | 0.986 | 0.709 | 1.28 | −0.119 | +0.294 |
| RDF | 0.825 | 0.993 | 0.701 | 1.30 | −0.124 | +0.307 |
| XGB | 0.824 | 0.997 | 0.703 | 1.30 | −0.120 | +0.303 |
| GAM | 0.820 | 1.009 | 0.688 | 1.33 | −0.132 | +0.321 |
| ENET | 0.818 | 1.014 | 0.689 | 1.33 | −0.129 | +0.316 |
Model performance is summarized by the coefficient of determination (R2) and root mean square error (RMSE, kg). Performance loss (Δ) represents the change in each metric after removing historical features, calculated as reduced model minus full model values. Negative ΔR2 and positive ΔRMSE indicate decreased predictive accuracy when historical information is excluded. GAM: Generalized Additive Model; ENET: ElasticNet Regression; RDF: Random Forest; XGB: Extreme Gradient Boosting; LGB: Light Gradient Boosting Machine.
Forecasting performance
Figures 5 and 6 show that across all forecast time intervals, ML models outperformed the persistence baseline across the evaluated forecasting horizons. The difference between the ML models and persistence performance increased with horizon length. The persistence performance deteriorated and reached negative R2 values from approximately day 5 onward, including an R2 of −1.60 at day 12.
Figure 5.

Predictive performance of machine learning models and a persistence baseline across forecast time intervals of 1 to 13 days ahead. The upper panel shows the coefficient of determination (R2) and the lower panel shows the root mean square error (RMSE). Models include LightGBM (LGB), Random Forest (RDF), XGBoost (XGB), ElasticNet (ENET), and Generalized Additive Model (GAM). The dashed black line represents the persistence baseline (PERSIST), in which the most recently observed feed intake was used as the prediction for each future horizon.
Figure 6.

Added value (ΔR2) of the machine learning models relative to the persistence baseline across forecasting horizons of 1 to 13 days ahead. Added value was calculated as , such that positive values indicate better predictive performance than persistence. Models include Elastic Net Regression (ENET, orange), Generalized Additive Model (GAM, green), Random Forest (RDF, blue), Extreme Gradient Boosting (XGB, red), and Light Gradient Boosting Machine (LGB, purple). The progressive increase in ΔR2 with horizon length reflects the continued deterioration of the persistence baseline as the forecasting horizon increases (R2 = 0.59 at day 1, 0.08 at day 4, and −1.60 at day 12).
At short horizons, LGB, XGB, and RDF showed the highest predictive accuracy, with R2 values of approximately 0.71 at one day ahead with performance degrading for long time intervals (eg R2 ≈ 0.33 to 0.43 by day 13). Absolute predictive accuracy declined as the forecasting horizon increased, although small fluctuations occurred at the longest horizons. For LGB, R2 decreased from 0.714 at one-day ahead to 0.661, and 0.609 at two and three days ahead respectively, while RMSE increased from 1.06 to 1.13 and 1.19 kg, respectively. The corresponding R2 values were 0.558 at day 4 and 0.515 at day 5. Thus, day 3 was the longest horizon at which R2 remained above the operational threshold of 0.60 and retained approximately 85% of the one-day-ahead R2. The decline showed no abrupt change in slope, showing that the 3-day horizon represented a practical accuracy threshold but with no notable inflection point in forecasting performance. At days 11 and 12, ENET had numerically higher R2 than the tree-based models, although the differences were small. This pattern suggests that regularized linear relationships may remain competitive as the contribution of recent nonlinear intake patterns diminishes at longer forecasting horizons. The GAM underperformed relative to other ML methods across all time intervals, despite retaining positive R2 throughout the forecast window.
Residual diagnostics
Residual diagnostics were conducted for all models to verify the validity of predictions. As recommended by Tulpan et al. (2026), fit diagnostics should be performed even for well-established algorithms with strong theoretical foundations. Across all models, prediction errors were approximately normally distributed with means near zero and constant variance across fitted values, and no systematic patterns observed in residuals plotted against predicted values. Minor departures from normality were detected at the tails of the error distributions (0.3% outliers). Given the consistency of residual behavior across models and the large sample size, these departures were not considered to compromise the reliability of the reported performance metrics.
Discussion
Models’ comparison
All five models achieved comparable test-set performance, with R2 ranging from 0.818 (ENET) to 0.828 (LGB). The narrow performance range across algorithms suggests that the predictive signal in this dataset was determined more by the engineered features, particularly the historical intake variables, than by algorithm choice. This is consistent with findings in other livestock prediction tasks, where feature engineering contributed more to model accuracy than algorithm selection (Chen et al. 2013; Mansbridge et al. 2018; Vázquez-Diosdado et al. 2023). Therefore, raw accuracy was not the main difference among models; it was generalization. Generalization measures the ability of the model to adapt learned patterns to new, unfamiliar datasets (Aggarwal et al. 2022). The GAM and ENET exhibited train-test R2 gaps of 0.002 and 0.003, respectively, compared to 0.039, 0.099, and 0.103 for LGB, XGB, and RDF. This indicates higher overfitting for tree-based models, specifically RDF and XGB. The overfitting observed in RDF and XGB is consistent with the tendency of ensemble methods to memorize training patterns in moderate-dimensional feature spaces, as reported in other livestock prediction studies (Herrera-Camacho et al. 2025; Önder et al. 2025). Therefore, determining the best model requires a critical consideration between the marginally higher test-set R2 (less than 1 unit of difference) of the first ones compared against the cost of greater overfitting. In applied precision livestock farming, where conditions are very different from training conditions, a model that generalizes more conservatively is often preferable to one that maximizes in-sample fit at the expense of robustness. For this reason, GAM and ENET appear more conservative for practical implementation.
The overall R2 achieved here (0.818 to 0.828) is comparable to that reported in previous literature on sow lactation data. Earlier work relied on biological and environmental predictors fitted to generalized Michaelis-Menten (GMM) or polynomial functions (Schinckel et al. 2010; Cabezón et al. 2016, 2017) with R2 increasing from 0.474 to 0.85 as temperature and humidity covariates were incorporated. Our previous work on this same dataset (Huang et al. 2026) found that a cubic polynomial mixed-effect model describing the predicted DFI trajectory [] achieved an R2 of 0.83 and a residual standard deviation of 0.91 kg, which is in the same range as our ML models here. However, the key gains are in prediction error (our RMSE ∼ 1 kg) and forecasting ability. Critically, those curve-fitting studies did not incorporate the sow’s own recent intake history as a predictor. Consistent with that, our reduced model which excluded historical features and used only biological and environmental predictors achieved performance comparable to those benchmarks.
The study most directly comparable to ours is Gauthier et al. (2021), who also used historical FI for one-day-ahead prediction, achieving RMSE of 1.06 kg/d across 39,090 lactations from six commercial farms. Our results are not directly equivalent because of dataset scale, origin, and feature scope, but the comparison reinforces the broader finding that incorporating recent FI history substantially improves short-term forecasting accuracy.
Performance varied by parity group in a consistent direction across all models. First-parity sows showed lower R2 relative to multiparous animals, which may reflect greater between-animal variability in gilt lactation trajectories and lower absolute intake levels that reduce the predictive leverage of lag features. Parity 3 + sows achieved the highest R2 (0.822 to 0.832), consistent with more repeatable lactation dynamics in mature sows. The highest RMSE was observed in parity 2 sows (1.044 to 1.061 kg), which may be attributed to less data on those sows (n = 138).
The increase in prediction error across lactation stage, from RMSE of 0.77 to 0.84 kg in early lactation to 1.14 to 1.37 kg by day 22, can be interpreted by looking at early lactation FI rising trajectory that is well captured by recent FI history, whereas late lactation is characterized by greater between-sow variability (Huang et al. 2026). The drop of performance shown by GAM in late lactation (RMSE = 1.82 kg on day 22 versus 1.37 kg for LGB) is consistent with known boundary instability of penalized splines when observations become sparse at the extremes of the covariate range (Wood 2017). The positive bias observed on day 1 across all models (0.25 to 0.46 kg) likely reflects post-farrowing FI suppression, a transient physiological state that departs from the patterns encoded by historical lag features and may warrant exclusion from training or separate modeling.
The MAE of 0.741 kg achieved by LGB represents approximately 11.2% of mean DFI, which is within the range reported for comparable ML applications in lactating sows (Gauthier et al. 2021). Whether this level of accuracy is sufficient depends on the intended application.
The influence of historical features
Historical features dominated the SHAP importance rankings across predictors, with MA3 and Lag1 ranking first and second, respectively. Together, those predictors accounted for 71.6% of the combined importance of all environmental and biological predictors. Lag2 and MA5 also appeared in the top ten, reinforcing that the recent FI trajectory is the primary driver of next-day predictions. These results show that, biologically, the current feeding pattern is the best indicator of a sow immediate physiological state. Indeed, this happens because a mobbing average variable can integrate multiple physiological signals into a single one. The high day-to-day autocorrelation in FI reflects what Batterham (1993) and Eissen et al. (2000) described as homeostatic FI regulation. In simple words, once a sow establishes a stable FI pattern for a given lactation stage, she tends to maintain it with high daily consistency (Batterham 1993; Eissen et al. 2000). The stronger importance of Lag1 relative to Lag2, and MA3 relative to MA5/MA7, is consistent with this interpretation as the most recent observation carries the most signal. Deviations from a sow established pattern are often early indicators of problems such as illness, heat stress, or declining milk production (Vargovic et al. 2021).
The appearance of the room mean average intake (RoomMA) variable among the top five features is noteworthy. This variable acts as a proxy for shared environmental conditions (eg batch-level management events) that affect all sows in a farrowing room simultaneously. Its moderate importance suggests that group-level context provides supplementary information even after individual history is accounted for. In a real farm scenario, this means that pen-level monitoring may improve prediction beyond what individual sow records alone can provide. Importantly, the dominance of historical variables does not imply that environmental or biological predictors can be disregarded. The most correct interpretation is that their effects appear to be expressed through short-term FI history, making them an integrated proxy for the other variables that precision feeding systems aim to quantify separately. This interpretation is supported by the observation that model RMSE was highest in the first days post-farrowing, a period before a stable FI pattern can be established and when historical features carry the least information.
The contribution of biological and environmental features
Beyond historical intake features, the Parity × Day interaction was among the most influential predictors, ranking well above parity or lactation day alone (Table 4). This result is biologically plausible and consistent with our previous study using the same population (Huang et al. 2026), which showed that primiparous and multiparous sows differed not only in average FI but also in the shape and timing of changes in the FI curve across lactation. This between-sow heterogeneity has been consistently observed in commercial herds, even under uniform management and feeding systems (Cabezón et al. 2017; Gauthier et al. 2021; Rodríguez et al. 2023; Estrada et al. 2024).
Deviations from expected FI trajectories may reflect variation in biological state, productive demand, health, welfare, or management conditions. Sow-level determinants of lactation FI include parity, body condition and body reserves at farrowing, gestation feeding level, litter size, and milk output (Eissen et al. 2000; Strathe et al. 2017; Theil et al. 2022). Feeding behavior may also be affected by lameness, leg or claw lesions, postpartum disorders, thermal discomfort, and inadequate access to feed or water (Cornou et al. 2008; Gómez et al. 2021). When nutrient intake is insufficient to support maintenance and milk production, sows mobilize body reserves, potentially resulting in greater losses of body weight and body condition, reduced litter growth, and impaired subsequent reproductive performance (Strathe et al. 2017; Theil et al. 2022; Estrada et al. 2024). Consequently, a persistent negative deviation from the expected FI trajectory should be interpreted as a nonspecific early-warning signal of nutritional, health, welfare, environmental, or management problems. This interpretation reinforces the practical value of predicting FI at the individual-sow level, as deviations from an individualized baseline could be used to identify animals requiring further evaluations.
Moreover, variation in individual appetite regulation and metabolic demand leads to divergent FI slopes after peak lactation, a phenomenon also reported by Cabezón et al. (2017) and attributed to differences in nutrient requirements and heat production among sows. Importantly, Rodríguez et al. (2023) showed that these individual deviations are predictive of subsequent reproductive performance, confirming that departures from the average lactation curve capture biological information. This was further supported in a large commercial cohort (n = 4284 sows) where sows with consistently low lactation FI had over one additional day to return to estrus and farrowed approximately one fewer pig in the subsequent cycle compared to higher-consuming counterparts (Estrada et al. 2024). Taken together, these findings indicate that parity effects on FI are dynamic across lactation, which helps explain why parity and day were much more informative when represented jointly (interacting) than separately.
Environmental interaction terms, particularly Day × Tmax and Day × Tdew, also ranked among the ten most important features, although their contribution was smaller than that of historical and biological predictors. Expressing these variables as interactions with lactation day appears to be more informative than including temperature measures alone, likely because the effect of thermal stress on FI changes over the course of lactation (Huang et al. 2026). The direct effect of thermal stress, although not explicitly addressed in the present study, is well-documented in the literature. More specifically, heat stress negatively impacts lactation FI (Renaudeau et al. 2001; Dourmad et al. 2022; Johnson et al. 2022; Ma et al. 2023). In our previous analyses (Huang et al. 2026), greater thermal load (Tmax and Tdew) was associated with reduced lactation FI, particularly when environmental effects were modeled as lactation-day-dependent terms.
Additionally, our results support the hypothesis that temperature effects were reflected through their cumulative physiological impact on consumption. This happens because when ambient temperature increases from thermoneutral to heat stress conditions, the biological response of the sows will be reduced appetite, increased maintenance energy for thermoregulation, and altered feeding patterns (Renaudeau et al. 2001; Huynh et al. 2005). In other words, these physiological changes, in the end, will manifest as reduced intake over preceding days. Therefore, MA3, Lag1, and other historical features can capture them.
This finding has important implications in commercial settings where environmental sensors may experience delays (such as calibration drift or connectivity failures) models relying primarily on historical features can maintain effective performance by leveraging the animal’s own intake response as a biological sensor of environmental conditions. This is particularly valuable in precision livestock farming applications where data quality varies across farms.
Forecasting for different time intervals and practical applications
The observed reduction in forecasting accuracy beyond 3 days ahead is consistent with limitations reported in online FI forecasting frameworks, particularly those described by Gauthier et al. (2021). In their rolling-prediction approach, forecast performance declined rapidly as the interval since the last FI observation increased. Our results corroborate this, and the underlying mechanism is reflected in the feature importance structure since MA3 and Lag1 were the strongest predictors (Table 4), meaning that as the forecast horizon extends, the most informative features become unavailable.
From a farm standpoint, the practical implications depend on the management decision being supported. One-day-ahead forecasting is most relevant for real-time interventions, such as triggering alerts when predicted FI falls below a threshold for a given sow. On the other hand, forecasts at 2 to 3-day time intervals may still support short-term planning, including monitoring FI trajectories and anticipating nutritional adjustments. Beyond 3 days, forecast reliability decreases and the additional benefit of individualized predictions relative to simpler population-level FI curves may become limited.
Limitations and future directions
Some study limitations should also be acknowledged. First, data were collected during summer months in a single facility, which may limit generalizability to other seasons, climates, or management systems. Validation across diverse environments and seasons would strengthen confidence in model sturdiness. The study population was relatively homogeneous in terms of genetics since all sows were Landrace × Large White. Performance in more heterogeneous populations remains to be tested. However, the feature engineering approach (moving averages, lags, variability) is generalizable and could be applied to broad datasets.
Certain important variables were unavailable, such as litter size, body weight, and body condition score throughout lactation, which could provide additional information about the metabolic status of individual sows. Litter size and litter growth rates would indicate milk production intensity. Health records could improve prediction of acute intake drops. Incorporating these in future iterations could further enhance model performance. The forecasting analyses assumed that future environmental conditions are known. These would need to be forecasted as well, introducing additional uncertainty. Integration with weather forecasting systems and propagation of forecast uncertainty through the FI prediction model would be valuable extensions.
All models were evaluated on prediction accuracy but not on economic value or management outcomes. The best scenario would be to formulate the high- and low-density diets and feed closer to each sow’s requirement. The ultimate goal in sow farms is not perfect prediction per se, but rather improved decision-making that enhances sow productivity, welfare, and profitability. Coupling these prediction models with economic optimization frameworks (eg optimal dietary energy density given predicted intake trajectory) would demonstrate more direct practical impact.
Finally, this aligns with the broader shift in animal agriculture toward preventive, data-driven management (Liakos et al. 2018; Morota et al. 2018; Benjamin and Yik 2019; Chen et al. 2023). However, realizing these benefits requires not just technology deployment but also workforce training and management system redesign. Precision technologies generate vast amounts of data, but value is only created when data is translated into decisions and actions. Integrating ML prediction models into farm management software, designing user interfaces that present actionable insights rather than raw predictions, and training farm staff to interpret and respond to model outputs are all critical steps.
Conclusions
This study shows that machine learning models can accurately predict daily feed intake in lactating sows when recent intake history is combined with biological and environmental data. Predictive performance was driven primarily by historical intake features, which accounted for approximately 71.6% of total feature importance, with the 3-day moving average ranking as the most influential predictor. Forecast accuracy remained strong up to 3 days ahead and declined progressively thereafter, suggesting that these models can capture short-term individual feeding dynamics under the modeled information assumption while losing precision over longer prediction time intervals. Overall, these results support the use of machine learning as a practical framework for data-driven, responsive feeding strategies in precision swine production.
Glossary
List of abbreviations
- DFI
daily feed intake
- DGH24
degree-hours above 24°C
- ENET
elastic net regression
- FI
feed intake
- GAM
generalized additive model
- LGB
light gradient boosting machine
- MA
moving average
- MAE
mean absolute error
- MAPE
mean absolute percentage error
- ML
machine learning
- P1
parity 1
- P2
parity 2
- P3+
parity 3 or higher
- RDF
random forest
- RMSE
root mean square error
- SHAP
Shapley additive explanation value
- XGB
extreme gradient boosting machine
Contributor Information
Maria Victoria Souza, Department of Animal Sciences, Purdue University, West Lafayette, IN 47907, United States.
Alex Batista Trentin, Department of Agronomy, Purdue University, West Lafayette, IN 47907, United States.
Qianqian Huang, Department of Animal Sciences, Purdue University, West Lafayette, IN 47907, United States.
Hinayah Rojas de Oliveira, Department of Animal Sciences, Purdue University, West Lafayette, IN 47907, United States.
Brian Richert, Department of Animal Sciences, Purdue University, West Lafayette, IN 47907, United States.
Luiz Fernando Brito, Department of Animal Sciences, Purdue University, West Lafayette, IN 47907, United States.
Hyatt Frobose, Jyga Technologies Inc—GESTAL, St-Lambert-de-Lauzon, Quebec G0S 2W0, Canada.
Allan Schinckel, Department of Animal Sciences, Purdue University, West Lafayette, IN 47907, United States.
Funding
M.V.S. acknowledges financial support from the Coordination for the Improvement of Higher Education Personnel—Brazil (CAPES) – Finance Code 001.
Conflicts of interest
H.F. is employed by Jyga Technologies Inc. (GESTAL), which provided the data used in this study. The authors declare no other actual or potential conflicts of interest.
References
- Aggarwal P. et al. 2022. COVID-19 image classification using deep learning: advances, challenges and opportunities. Comput. Biol. Med. 144:105350. 10.1016/j.compbiomed.2022.105350 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Batterham E. S. 1993. Manipulating pig production IV: proceedings of the fourth biennial Conference of the Australasian Pig Science Association (APSA) held in Canberra, ACT, on November 28 to December 1, 1993. The Association, Attwood, Vic., Australia.
- Benjamin M., Yik S. 2019. Precision livestock farming in swine welfare: a review for swine practitioners. Anim. Open Access J. MDPI. 9:133. 10.3390/ani9040133 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Breiman L. 2001. Random forests. Mach. Learn. 45:5–32. 10.1023/A:1010933404324 [DOI] [Google Scholar]
- Cabezón F. A., Schinckel A. P., León Y. L., Craig B. A. 2017. Analysis of lactation feed intakes for sows with extended lactation lengths. Transl. Anim. Sci. 1:1–25. 10.2527/tas2017-0016 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Cabezón F. A. et al. 2016. Analysis of lactation feed intakes for sows including data on environmental temperatures and humidity. J. Anim. Sci. 94:40. 10.2527/msasas2016-085 [DOI] [Google Scholar]
- Chen C., Liu X., Liu C., Pan Q. 2023. Development of the precision feeding system for sows via a rule-based expert system. Int. J. Agric. Biol. Eng. 16:187–198. 10.25165/ijabe.v16i2.7427 [DOI] [Google Scholar]
- Chen L., Schenkel F., Vinsky M., Crews D. H. Jr., Li C. 2013. Accuracy of predicting genomic breeding values for residual feed intake in Angus and Charolais beef cattle. J. Anim. Sci. 91:4669–4678. 10.2527/jas.2013-5715 [DOI] [PubMed] [Google Scholar]
- Chen T., Guestrin C. 2016. XGBoost: a scalable tree boosting system. In: Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, San Francisco, CA. New York, NY: Association for Computing Machinery. p. 785–794. 10.1145/2939672.2939785 [DOI]
- Cornou C., Vinther J., Kristensen A. R. 2008. Automatic detection of oestrus and health disorders using data from electronic sow feeders. Livest. Sci. 118:262–271. 10.1016/j.livsci.2008.02.004 [DOI] [Google Scholar]
- Cozannet P. et al. 2018. Reducing BW loss during lactation in sows: a meta-analysis on the use of a nonstarch polysaccharide-hydrolyzing enzyme supplement. J. Anim. Sci. 96:2777–2788. 10.1093/jas/sky045 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Dourmad J.-Y., Le Velly V., Gourdine J.-L., Renaudeau D. 2022. Effect of ambient temperature in lactating sows, a meta-analysis and simulation approach in the context of climate change. Anim. Open Space. 1:100025. 10.1016/j.anopes.2022.100025 [DOI] [Google Scholar]
- Eissen J. J., Kanis E., Kemp B. 2000. Sow factors affecting voluntary feed intake during lactation. Livest. Prod. Sci. 64:147–165. 10.1016/S0301-6226(99)00153-0 [DOI] [Google Scholar]
- Estrada J., Johnson D. C., Kyle K. L., Perez J., Parr E., Welch M. W., Neill C., Peterson B. A., Boler D. D. 2024. Characterizing sow feed intake during lactation to explain litter and subsequent farrowing performance. J. Anim. Sci. 102:skae093. 10.1093/jas/skae093 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Ferrari C. et al. 2025. Application of a generalized additive mixed model in time series study of dairy cow behavior under hot summer conditions. J. Dairy Sci. 108:1554–1572. 10.3168/jds.2024-25001 [DOI] [PubMed] [Google Scholar]
- Friedman J. H., Hastie T., Tibshirani R. 2010. Regularization paths for generalized linear models via coordinate descent. J. Stat. Softw. 33:1–22. 10.18637/jss.v033.i01 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Gaillard C., Gauthier R., Cloutier L., Dourmad J.-Y. 2019. Exploration of individual variability to better predict the nutrient requirements of gestating sows1. J. Anim. Sci. 97:4934–4945. 10.1093/jas/skz320 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Gauthier R., Largouët C., Rozé L., Dourmad J.-Y. 2021. Online forecasting of daily feed intake in lactating sows supported by offline time-series clustering, for precision livestock farming. Comput. Electron. Agric. 188:106329. 10.1016/j.compag.2021.106329 [DOI] [Google Scholar]
- Gómez Y. et al. 2021. A systematic review on validated precision livestock farming technologies for pig production and its potential to assess animal welfare. Front. Vet. Sci. 8:660565. 10.3389/fvets.2021.660565 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Gormley A., Jang K. B., Garavito-Duarte Y., Deng Z., Kim S. W. 2024. Impacts of maternal nutrition on sow performance and potential positive effects on piglet performance. Animals. 14:1858. 10.3390/ani14131858 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Greiner L. L., Wileman C. 2025. Nutritional strategies to optimize reproductive performance of the highly prolific sow. In: Ross J., editor. Advances in pig breeding and reproduction. Burleigh Dodds Science Publishing Limited, Cambridge, UK. p. 277–301. 10.19103/AS.2024.0137.18 [DOI] [Google Scholar]
- Hansen A. V., Strathe A. B., Kebreab E., France J., Theil P. K. 2012. Predicting milk yield and composition in lactating sows: a Bayesian approach. J. Anim. Sci. 90:2285–2298. 10.2527/jas.2011-4788 [DOI] [PubMed] [Google Scholar]
- Hawkins D. M. 2009. Recursive partitioning. WIREs Comput Stats. 1:290–295. 10.1002/wics.44 [DOI] [Google Scholar]
- Herrera-Camacho J. et al. 2025. Body weight estimation in Holstein × Zebu crossbred heifers: comparative analysis of XGBoost and LightGBM algorithms. Vet. Med. Sci. 11:e70422. 10.1002/vms3.70422 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Huang Q., Souza M. V., Frobose H., Oliveira H. R., Brito L. F., Schinckel A. P. 2026. Modeling feed intake in lactating sows during summer considering temperature and humidity covariates. Transl. Anim. Sci. 10:txag092. 10.1093/tas/txag092 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Huber L. 2025. Review: feeding strategies to meet the dynamic lysine and energy requirements of gestating and lactating sows. Animal. 19:101574. 10.1016/j.animal.2025.101574 [DOI] [PubMed] [Google Scholar]
- Huynh T. T. T. et al. 2005. Effects of increasing temperatures on physiological changes in pigs at different relative humidities. J. Anim. Sci. 83:1385–1396. 10.2527/2005.8361385x [DOI] [PubMed] [Google Scholar]
- Johnson J. S. et al. 2022. Electronically controlled cooling pads can improve litter growth performance and indirect measures of milk production in heat-stressed lactating sows. J. Anim. Sci. 100:skab371. 10.1093/jas/skab371 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Ke G. Q. et al. 2017. LightGBM: a highly efficient gradient boosting decision tree. In: Proceedings of the 31st Conference on Neural Information Processing Systems, Long Beach, CA. p. 3149–3157. 10.5555/3294996.3295074 [DOI]
- Kim S. W., Easter R. A. 2001. Nutrient mobilization from body tissues as influenced by litter size in lactating sows. J. Anim. Sci. 79:2179–2186. 10.2527/2001.7982179x [DOI] [PubMed] [Google Scholar]
- Kim S. W., Hurley W. L., Wu G., Ji F. 2009. Ideal amino acid balance for sows during gestation and lactation. J. Anim. Sci. 87:E123–E132. 10.2527/jas.2008-1452 [DOI] [PubMed] [Google Scholar]
- Koketsu Y., Dial G. D., Pettigrew J. E., King V. L. 1996. Feed intake pattern during lactation and subsequent reproductive performance of sows. J. Anim. Sci. 74:2875–2884. 10.2527/1996.74122875x [DOI] [PubMed] [Google Scholar]
- Koketsu Y., Dial G. D., Pettigrew J. E., King V. L. 1997. Influence of feed intake during individual weeks of lactation on reproductive performance of sows on commercial farms. Livest. Prod. Sci. 49:217–225. 10.1016/S0301-6226(97)00050-X [DOI] [Google Scholar]
- Liakos K. G., Busato P., Moshou D., Pearson S., Bochtis D. 2018. Machine learning in agriculture: a review. Sensors. 18:2674. 10.3390/s18082674 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Lundberg S., Lee S.-I. 2017. A unified approach to interpreting model predictions. 10.48550/arXiv.1705.07874, preprint: not peer reviewed. [DOI]
- Ma H. et al. 2023. A review on the effect of light–thermal–humidity environment in sow houses on sow reproduction and welfare. Reprod. Domest. Anim. 58:1023–1045. 10.1111/rda.14400 [DOI] [PubMed] [Google Scholar]
- Mansbridge N. et al. 2018. Feature selection and comparison of machine learning algorithms in classification of grazing and rumination behaviour in sheep. Sensors. 18:3532. 10.3390/s18103532 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Morota G., Ventura R. V., Silva F. F., Koyama M., Fernando S. C. 2018. BIG DATA ANALYTICS AND PRECISION ANIMAL AGRICULTURE SYMPOSIUM: machine learning and data mining advance predictive big data analysis in precision animal agriculture1. J. Anim. Sci. 96:1540–1550. 10.1093/jas/sky014 [DOI] [PMC free article] [PubMed] [Google Scholar]
- NRC. 2012. Nutrient requirements of swine: eleventh revised edition. The National Academies Press, Washington, DC. https://nap.nationalacademies.org/catalog/13298/nutrient-requirements-of-swine-eleventh-revised-edition [Google Scholar]
- Önder H. et al. 2025. Predicting live weight for female rabbits of meat crosses from body measurements using LightGBM, XGBoost and support vector machine algorithms. Vet. Med. Sci. 11:e70149. 10.1002/vms3.70149 [DOI] [PMC free article] [PubMed] [Google Scholar]
- R Core Team. 2025. https://www.R-project.org/
- Renaudeau D., Quiniou N., Noblet J. 2001. Effects of exposure to high ambient temperature and dietary protein level on performance of multiparous lactating sows1. J. Anim. Sci. 79:1240–1249. 10.2527/2001.7951240x [DOI] [PubMed] [Google Scholar]
- Rodríguez M., Díaz-Amor G., Morales J., Koketsu Y., Piñeiro C. 2023. Feed intake patterns of modern genetics lactating sows: characterization and effect of the reproductive parameters. Porc. Health Manag. 9:6. 10.1186/s40813-022-00300-y [DOI] [PMC free article] [PubMed] [Google Scholar]
- Schinckel A. P., Schwab C. R., Duttlinger V. M., Einstein M. E. 2010. Analyses of feed and energy intakes during lactation for three breeds of sows. Prof. Anim. Sci. 26:35–50. 10.15232/S1080-7446(15)30556-8 [DOI] [Google Scholar]
- Simpson, G. L. 2025. Method: using generalized additive models in the animal sciences. arXiv 2507.06281. 10.48550/arXiv.2507.06281 [DOI] [Google Scholar]
- Strathe A. V., Bruun T. S., Hansen C. F. 2017. Sows with high milk production had both a high feed intake and high body mobilization. Animal. 11:1913–1921. 10.1017/S1751731117000155 [DOI] [PubMed] [Google Scholar]
- Sparks A. H. 2018. Nasapower: a NASA POWER global meteorology, surface solar energy and climatology data client for R. J. Open Source Softw. 3:1035. 10.21105/joss.01035 [DOI] [Google Scholar]
- Theil P. K., Farmer C., Feyera T. 2022. Review: physiology and nutrition of late gestating and transition sows. J. Anim. Sci. 100:skac176. 10.1093/jas/skac176 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Tulpan D., Tedeschi L. O., Menendez H., Vieira R. A. M. 2026. ASAS-NANP symposium: mathematical modeling in animal nutrition: construction of supervised machine learning regression pipelines for livestock data modeling: a case studys. J. Anim. Sci. 104:skaf444. 10.1093/jas/skaf444 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Vargovic L., Hermesch S., Athorn R. Z., Bunter K. L. 2021. Feed intake and feeding behavior traits for gestating sows recorded using electronic sow feeders. J. Anim. Sci. 99:skaa395. 10.1093/jas/skaa395 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Vázquez-Diosdado J. A. et al. 2023. Accurate prediction of calving in dairy cows by applying feature engineering and machine learning. Prev. Vet. Med. 219:106007. 10.1016/j.prevetmed.2023.106007 [DOI] [PubMed] [Google Scholar]
- Wade D. 2023. 6 Sow farm costs and hurdles to execution. J. Anim. Sci. 101:244–244. 10.1093/jas/skad341.277 [DOI] [Google Scholar]
- Wood S. N. 2017. Generalized additive models: an introduction with R . 2nd ed. Chapman and Hall/CRC, New York. [Google Scholar]
- Zou H, Hastie T. 2005. Regularization and variable selection via the elastic net. J. R. Stat. Soc. Ser. B Stat. Methodol. 67:301–320. 10.1111/j.1467-9868.2005.00503.x [DOI] [Google Scholar]
