Source-linked AI summary
Exploring the Potential of Symbolic Regression in Precision Livestock Farming
Elisabeth Mayrhuber, Maciej Oczak, Michael Iwersen, David Brunner, Viktoria Dorfer, Stephan Winkler
TL;DR
Predicting farrowing time could help farms balance piglet safety and sow welfare, but choosing when to confine sows remains challenging. This study uses a two-stage ear-tag acceleration approach with symbolic regression, which achieved the best test-set MAE among evaluated models compared with SVR.
Problem
Choosing when to crate sows to protect piglets while limiting stress and restricted natural behaviours for the mother remains a challenge.
Source: §1 · p. 2Method
The study detects nest-building onset from activity changes, then predicts time to farrowing using symbolic regression and ear-tag acceleration features.
Source: §1 · p. 2, §2.2 · p. 3, §2.3 · p. 4Results
166/180 sows received a nest-building alarm, and symbolic regression had the best test-set MAE, significantly differing from SVR (p=2.18 × 10−6).
Source: §3.1 · p. 5, §3.2 · p. 5Takeaways & Limitations
The authors conclude that the two-stage ear-tag approach provides an online farrowing prediction, with symbolic regression offering performance and interpretability advantages over closed-box models.
Source: §4 · p. 8The best symbolic-regression model is not shown because its 2,917-node tree is too complex to display efficiently.
Source: §3.3 · p. 7
Abstract
from arXiv · showhide
The ability to predict farrowing time in pigs is crucial for optimal farm management and ensuring piglet survival. This study investigates the potential of explainable artificial intelligence for precision livestock farming, focusing on acceleration sensor data from sows around the time of farrowing. Accurately predicting farrowing allows farmers to balance both, piglet safety by avoiding piglet crushing events and the mother sow's welfare, by avoiding early crating. Traditional machine learning models often lack interpretability (``closed-box'' problem). Explainable artificial intelligence offers a solution by revealing the decision-making processes within the models. This work is split into two stages. First the detection of nest building behaviour and second the prediction of the remaining time to farrowing. The nest building detection was possible for 166 out of 180 sows and successful within 48 hours before farrowing for 149 sows. The nest building detection is purely based on the change of a sow's activity level and uses no machine learning techniques. Further, this study utilizes symbolic regression, an open-box modelling technique that generates interpretable mathematical formulas, to predict the remaining time until the onset of farrowing. The results are compared with closed-box models, like support vector regression and artificial neural networks, for both explainability and performance. Notably, symbolic regression achieved a mean absolute error of 9.28 hours for the time-to-farrowing prediction, outperforming the closed-box models in terms of performance and interpretability. This research demonstrates that explainable artificial intelligence, specifically symbolic regression, can offer both interpretable results and competitive performance in precision livestock farming.
1 Introduction
Crating can protect piglets from crushing but increases sow stress and restricts natural behaviour, making the timing of confinement a welfare trade-off. This study proposes a two-step alarm using ear-tag acceleration data, with symbolic regression for interpretable time-to-farrowing predictions.
1 Introduction
- Optimal crating time remains challenging because piglet protection must be balanced against sow stress and restricted natural behaviours.Temporary crating delays confinement until after nest building, ideally at least 24 hours before farrowing.Source: §1 · p. 2
- The proposed two-step alarm detects nest-building onset and then predicts the remaining time until birth using sow ear-tag accelerometer data.The study builds on prior farrowing prediction research and differs from recent approaches based on computer vision.Source: §1 · p. 2
- Symbolic regression generates interpretable mathematical formulas, offering an open-box alternative to closed-box models such as artificial neural networks.The formulas are intended to reveal relationships between sensor data and predicted time to farrowing.Source: §1 · p. 2
2 Material and Methods
The study used ear-tag acceleration data from 180 sows, engineered separate features for nest-building detection and time-to-farrowing prediction, and evaluated both tasks in a simulated online setting. The prediction stage compared open- and closed-box algorithms using grouped cross-validation.
2.1 Experimental data
- 180 sows wore SMARTBOW® ear tags with tri-axial accelerometers; the dataset used acceleration magnitude and a 144/36 sow training/test split balanced across pen types.Acceleration magnitude was calculated from the squared x, y, and z values.Source: §2.1 · pp. 2–3, Table 1 · p. 3
2.2 Data Preprocessing and Feature Engineering
- Nest-building detection used 12-, 24-, and 48-hour rolling averages, while time-to-farrowing prediction used six activity features and five timestamps per sow.The remaining minutes until farrowing served as the prediction target.Source: §2.2 · p. 3
2.3 Detection of Nest Building Behaviour
- Detection ran in a sliding-window online simulation beginning 2.5 days after pen entry, with an alarm triggered when either of two conditions evaluated true.The constants 0.8 and 1.75 were selected by trying combinations on the training set.Source: §2.3 · pp. 3–4
2.4 Time to Farrowing Prediction
- After the initial alarm, models predicted remaining time every 90 minutes, comparing two open-box algorithms with four closed-box algorithms using grouped five-fold cross-validation.Grouping kept timestamps from the same sow together during cross-validation.Source: §2.4 · p. 4
3 Results and Discussion
The study evaluates online detection of nest-building behaviour and prediction of remaining time to farrowing from sow acceleration data. Symbolic regression (SR) had the best test-set MAE among the evaluated models, while its equation-based form offers interpretability.
3.1 Detection of Nest Building Behaviour
- 166 of 180 sows received a nest-building alarm before farrowing; none were detected late, while 14 had no detection.In 17 cases, alarms occurred at least 48 hours before farrowing, often after activity anomalies during normal day–night cycles; detection depended on within-sow activity change and was robust to baseline activity differences.Source: §3.1 · p. 5
3.2 Time to Farrowing Prediction
- After the initial alarm, six signal features updated time-to-farrowing predictions every 90 minutes, with onset-to-farrowing intervals of 6–188 hours.Training and validation used MAE and PCC at predefined timestamps, while real-time performance was reported separately.Source: §3 · p. 4, §3.2 · p. 5
- SR achieved the best test-sow MAE, followed by SVR, with a significant difference between them (p = 2.18 × 10−6).Table 3 reports model performance in a real-time setting; the authors describe SR as inherently more interpretable.Source: §3.2 · p. 5, Table 3 · p. 6
- For the demonstration sow, SR predictions had an MAE of 1.52 hours and a PCC of 0.99, better than the average result.Figure 2 plots predicted against actual time to farrowing, with a line marking perfect prediction.Source: Figure 2 · p. 7, §3.2 · p. 7
- For that same sow, LR and ANN had worse MAE than SR, although LR’s mean PCC exceeded SR’s in Table 3.The PCC comparison for the individual sow did not hold for every sow.Source: §3.2 · p. 7, Figure 3 · p. 8
3.3 Explainability of Time to Farrowing Prediction
- SR’s equation makes its internals interpretable, but the best model was omitted at 2,917 tree nodes; the smaller illustrative model performed significantly worse.The displayed model uses mean acceleration magnitude over the last 24 hours and the average rolling mean over the preceding 24 hours.Source: §3.3 · p. 7
4 Conclusions
The study presents a two-stage, online farrowing-prediction approach using ear-tag acceleration data, with symbolic regression offering interpretability and competitive performance. Its conclusions also identify limits to the current practical reach of interpretability.
4 Conclusions
- Symbolic regression offered a clear advantage over ANNs in performance and interpretability, although ANNs sometimes achieved similar or better performance.The authors note that current interpretability mostly benefits ML experts and aim to improve it for non-technicians.Source: §4 · p. 8
- 166 of 180 sows received an alarm at or shortly before nest-building onset.Source: §4 · p. 8
- The two-stage online approach uses an initial nest-building alarm followed by interval-updated, interpretable time-to-farrowing predictions from ear-tag acceleration data.Source: §4 · p. 8
- Predictions use individual sows’ activity changes, making them robust to baseline-activity differences such as those across farms.Source: §4 · p. 8
- Current interpretability mostly benefits ML experts, and future work aims to improve it for veterinarians and other non-technicians.Source: §4 · p. 8