# Prediction of the daily nutrient requirements of gestating sows based on sensor data and machine-learning algorithms

Maëva Durand, Christine Largouët, Louis Bonneau de Beaufort, Jean-Yves Dourmad, Charlotte Gaillard

<figure><img src="image_1.png" /></figure>

## ► To cite this version:

Maëva Durand, Christine Largouët, Louis Bonneau de Beaufort, Jean-Yves Dourmad, Charlotte Gaillard. Prediction of the daily nutrient requirements of gestating sows based on sensor data and machine-learning algorithms. Journal of Animal Science, 2023, 101, pp.skad337. 10.1093/jas/skad337. hal-04235874

HAL Id: hal-04235874

https://hal.inrae.fr/hal-04235874

Submitted on 28 May 2024

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_2.png" /></figure>
# Prediction of the daily nutrient requirements of gestating sows based on sensor data and machine-learning algorithms

Maëva Durand, Christine Largouët, Louis Bonneau de Beaufort, Jean-Yves Dourmad, Charlotte Gaillard

<figure><img src="image_1.png" /></figure>

## ► To cite this version:

Maëva Durand, Christine Largouët, Louis Bonneau de Beaufort, Jean-Yves Dourmad, Charlotte Gaillard. Prediction of the daily nutrient requirements of gestating sows based on sensor data and machine-learning algorithms. Journal of Animal Science, 2023, 101, pp.skad337. 10.1093/jas/skad337. hal-04235874

HAL Id: hal-04235874

https://hal.inrae.fr/hal-04235874v1

Submitted on 28 May 2024

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_2.png" /></figure>
<figure><img src="image_3.png" /></figure>

# Prediction of the daily nutrient requirements of gestating sows based on sensor data and machine-learning algorithms

Maëva Durand,†, ID Christine Largouët,‡ Louis Bonneau de Beaufort,‡ Jean Yves Dourmad,† and Charlotte Gaillard†,†, ID

## Abstract

Precision feeding is a strategy for supplying an amount and composition of feed as close that are as possible to each animal's nutrient requirements, with the aim of reducing feed costs and environmental losses. Usually, the nutrient requirements of gestating sows are provided by a nutrition model that requires input data such as sow and herd characteristics, but also an estimation of future farrowing performances. New sensors and automatons, such as automatic feeders and drinkers, have been developed on pig farms over the last decade, and have produced large amounts of data. This study evaluated machine-learning methods for predicting the daily nutrient requirements of gestating sows, based only on sensor data, according to various configurations of digital farms. The data of 73 gestating sows was recorded using sensors such as electronic feeders and drinker stations, connected weight scales, accelerometers, and cameras. Nine machine-learning algorithms were trained on various dataset scenarios according to different digital farm configurations (one or two sensors), to predict the daily metabolizable energy and standardized ileal digestible lysine requirements for each sow. The prediction results were compared to those predicted by the InraPorc model, a mechanistic model for the precision feeding of gestating sows. The scenario predictions were also evaluated with or without the housing conditions and sow characteristics at artificial insemination usually integrated into the InraPorc model. Adding housing and sow characteristics to sensor data improved the mean average percentage error by 5.58% for lysine and by 2.22% for energy. The higher correlation coefficient values for lysine (0.99) and for energy (0.95) were obtained for scenarios involving an automatic feeder system (daily duration and number of visits with or without consumption) only. The scenarios including an automatic feeder combined with another sensor gave good performance results. For the scenarios using sow and housing characteristics and automatic feeder only, the root mean square error was lower with gradient tree boosting (0.91 MJ/d for energy and 0.08 g/d for lysine) compared with those obtained using linear regression (2.75 MJ/d and 1.07 g/d). The results of this study show that the daily nutrient requirements of gestating sows can be predicted accurately using data provided by sensors and machine-learning methods. It paves the way for simpler solutions for precision feeding.

## Lay Summary

New technologies, such as sensors and automatons, are being developed in agriculture to reduce workload or help farmers make management decisions. The most common approach to the analysis of the huge amount of data generated by these technologies is to use machine-learning algorithms, to detect health or welfare problems for example. The hypothesis was that these automatically collected data and algorithms could also serve to predict the nutrient requirements of gestating sows, usually calculated based on complex models that require a lot of on-farm input data. The predictions of 22 scenarios were compared based on different combinations of sensor data, with the prediction of a nutritional model for gestating sows. The results of nine algorithms applied to the different scenarios were also compared. The results suggested that feeder data, alone or in combination with another sensor, predicted nutrient requirements with high accuracy. Data from other sensors combined with additional information about the sow (i.e., age and body weight) also led to high prediction accuracy. The difference between the algorithms evaluated was relatively significant, but all showed acceptable prediction results, especially non-linear algorithms. In conclusion, this work demonstrated the possibility of accurately predicting daily nutrient requirements for each sow using sensor data and machine-learning algorithms.

**Keywords:** artificial intelligence, automaton, behavior, model, pig, precision feeding

**Abbreviations:** BT, backfat thiskness; ESF, electronic sow feeder; GTB, gradient tree boosting; KNN, k-nearest-neighbors; LASSO, linear regression with a LASSO regularization; LR, linear regression; MAPE, mean absolute percentage error; ME, metabolizable energy; MLP, multilayer perceptron; PR, polynomial regression; RF, random forest; $R^2$, coefficient of determination; RFID, radio frequency identification; RIDGE, linear regression with a RIDGE regularization; RMSE, root mean square error; SID Lys, standard ileal digestible lysine; SVR, support vector machine for regression

## Introduction

Precision feeding can be defined as a nutritional strategy aimed at matching feed supply as close as possible to an individual's nutrient requirements, to prevent nutrient supply

deficit and excess (Pomar et al., 2019). For gestating sows, this strategy reduced lysine intake by 25%, nitrogen excretion by 18.5% (Gaillard and Dourmad, 2022), and feed costs by 3.4€ per gestation (Gaillard et al., 2020a) without impacting

<footnote>†PEGASE, INRAE, Institut Agro, Saint Gilles, France</footnote>

<footnote>‡Institut Agro, Univ Rennes1, CNRS, INRIA, IRISA, Rennes, France</footnote>

<footnote n="1">¹Corresponding author: charlotte.gaillard@inrae.fr</footnote>
<figure><img src="image_3.png" /></figure>

# Prediction of the daily nutrient requirements of gestating sows based on sensor data and machine-learning algorithms

Maëva Durand,†, ID Christine Largouët,‡ Louis Bonneau de Beaufort,‡ Jean Yves Dourmad,† and Charlotte Gaillard†,†, ID

## Abstract

Precision feeding is a strategy for supplying an amount and composition of feed as close that are as possible to each animal's nutrient requirements, with the aim of reducing feed costs and environmental losses. Usually, the nutrient requirements of gestating sows are provided by a nutrition model that requires input data such as sow and herd characteristics, but also an estimation of future farrowing performances. New sensors and automatons, such as automatic feeders and drinkers, have been developed on pig farms over the last decade, and have produced large amounts of data. This study evaluated machine-learning methods for predicting the daily nutrient requirements of gestating sows, based only on sensor data, according to various configurations of digital farms. The data of 73 gestating sows was recorded using sensors such as electronic feeders and drinker stations, connected weight scales, accelerometers, and cameras. Nine machine-learning algorithms were trained on various dataset scenarios according to different digital farm configurations (one or two sensors), to predict the daily metabolizable energy and standardized ileal digestible lysine requirements for each sow. The prediction results were compared to those predicted by the InraPorc model, a mechanistic model for the precision feeding of gestating sows. The scenario predictions were also evaluated with or without the housing conditions and sow characteristics at artificial insemination usually integrated into the InraPorc model. Adding housing and sow characteristics to sensor data improved the mean average percentage error by 5.58% for lysine and by 2.22% for energy. The higher correlation coefficient values for lysine (0.99) and for energy (0.95) were obtained for scenarios involving an automatic feeder system (daily duration and number of visits with or without consumption) only. The scenarios including an automatic feeder combined with another sensor gave good performance results. For the scenarios using sow and housing characteristics and automatic feeder only, the root mean square error was lower with gradient tree boosting (0.91 MJ/d for energy and 0.08 g/d for lysine) compared with those obtained using linear regression (2.75 MJ/d and 1.07 g/d). The results of this study show that the daily nutrient requirements of gestating sows can be predicted accurately using data provided by sensors and machine-learning methods. It paves the way for simpler solutions for precision feeding.

## Lay Summary

New technologies, such as sensors and automatons, are being developed in agriculture to reduce workload or help farmers make management decisions. The most common approach to the analysis of the huge amount of data generated by these technologies is to use machine-learning algorithms, to detect health or welfare problems for example. The hypothesis was that these automatically collected data and algorithms could also serve to predict the nutrient requirements of gestating sows, usually calculated based on complex models that require a lot of on-farm input data. The predictions of 22 scenarios were compared based on different combinations of sensor data, with the prediction of a nutritional model for gestating sows. The results of nine algorithms applied to the different scenarios were also compared. The results suggested that feeder data, alone or in combination with another sensor, predicted nutrient requirements with high accuracy. Data from other sensors combined with additional information about the sow (i.e., age and body weight) also led to high prediction accuracy. The difference between the algorithms evaluated was relatively significant, but all showed acceptable prediction results, especially non-linear algorithms. In conclusion, this work demonstrated the possibility of accurately predicting daily nutrient requirements for each sow using sensor data and machine-learning algorithms.

**Keywords:** artificial intelligence, automaton, behavior, model, pig, precision feeding

**Abbreviations:** BT, backfat thiskness; ESF, electronic sow feeder; GTB, gradient tree boosting; KNN, k-nearest-neighbors; LASSO, linear regression with a LASSO regularization; LR, linear regression; MAPE, mean absolute percentage error; ME, metabolizable energy; MLP, multilayer perceptron; PR, polynomial regression; RF, random forest; $R^2$, coefficient of determination; RFID, radio frequency identification; RIDGE, linear regression with a RIDGE regularization; RMSE, root mean square error; SID Lys, standard ileal digestible lysine; SVR, support vector machine for regression

## Introduction

Precision feeding can be defined as a nutritional strategy aimed at matching feed supply as close as possible to an individual's nutrient requirements, to prevent nutrient supply

deficit and excess (Pomar et al., 2019). For gestating sows, this strategy reduced lysine intake by 25%, nitrogen excretion by 18.5% (Gaillard and Dourmad, 2022), and feed costs by 3.4€ per gestation (Gaillard et al., 2020a) without impacting

<footnote>†PEGASE, INRAE, Institut Agro, Saint Gilles, France</footnote>

<footnote>‡Institut Agro, Univ Rennes1, CNRS, INRIA, IRISA, Rennes, France</footnote>

<footnote n="1">¹Corresponding author: charlotte.gaillard@inrae.fr</footnote>
sow performances. Precision feeding is based on the avail-
ability of smart feeders that make it possible to supply feed
at individual or small group levels, based on the accurate
prediction of nutrient requirements and the determination of
the nutritional value of feed ingredients. Electronic feeding
stations allow individual feed supply (Gaillard et al., 2020b),
and tables are available for determining the nutrient value of
feed (Sauvant et al., 2004). The nutrient requirements of ges-
tating sows are usually provided by a mechanistic nutrition
model that requires inputs such as herd performances, sow
age, and body condition at artificial insemination, but also an
estimation (or actual data a posteriori) of farrowing perfor-
mances (Cooper et al., 2001; Hansen et al., 2014; Gaillard et
al., 2019).

Sensors and automatons are being increasingly used on farms (Galaz et al., 2021) to automatize tasks, manage large groups of animals in real time, or help optimize production costs (Berckmans, 2017; Neethirajan, 2020; Siegford and Guzhva, 2021). These technologies allow individual monitoring thanks to Radio Frequency Identification (RFID) (Mahfuz et al., 2022). The huge amount of real-time data collected, especially behavioral data, requires efficient approaches to classification or prediction issues, such as machine learning (Neethirajan, 2020; Llonch et al., 2022). Indeed, machine learning uses methods that learn from data to solve a specific task, such as classification or clustering, prediction, anomaly detection, or recommendation (Géron, 2019). These algorithms have already been used on pig feeder data to predict biting outbreaks with an accuracy of 96% (Ollagnier et al., 2023) and to predict body weight with an accuracy of 89% (He et al., 2021).

This study aims to explore the prediction of daily and indi-
vidual nutrient requirements (here defined as metabolizable
energy [ME] and standardized ileal digestible amino acids) of
gestating sows based on data measured by sensors (electron-
ics feeder and drinker, automatic weighting system, camera
and accelerometer). This study also proposes to test various
digital farm configurations and to compare the results accord-
ing to the number and type of sensors (22 scenarios), as well
as nine different machine-learning algorithms (linear-based,
p polynomial, Tree-based, support vector machine, nearest
neighbor, and neural network).

Materials and Methods

This study was carried out from July to April 2021, at the Pig
Physiology and Phenotyping Experimental facilities (UE3P,
doi: 10.15454/1.5573932732039927E12) of the French
National Research Institute for Agriculture, Food and the
Environment (INRAE) located in Saint-Gilles (France). Ethi-
cal approval concerning the French legislation on experimen-
tal animal care was given by the Ethics Committee for Animal
Experimentation in Rennes, France (authorization for exper-
iments on living animals No. 25883-2020070711528084).
The data used in this study is available for public access and
described in the data paper (Durand et al., 2023).

Overall approach

The study was designed to evaluate the prediction of the
nutrient requirements of sows based on sensor data and
machine-learning methods. The first question to be answered
is the following: "What is the best sensor(s) that may be
required on a farm for correctly predicting sow nutrient

requirements?” Other questions regarding algorithm optimi-
zation are considered: (i) “Which is the best algorithm, i.e.
with the highest accuracy, for predicting those requirements?”
(ii) “Does the integration of sow and housing characteristics
into the predictive variables improve prediction?”

Predicting nutrient requirements is a regression problem since it is needed for predicting continuous values. For that purpose, nine supervised algorithms were chosen for their high performance in regression tasks as well as their representability of the diversity of machine-learning algorithms (Géron, 2019). A linear regression (LR), the LR with a LASSO regularization (LASSO), the LR with a RIDGE regularization (RIDGE), a polynomial regression (PR), a support vector machine for regression (SVR), a random forest (RF), a k-nearest-Neighbors (KNN), a gradient tree boosting (GTB), as well as a multilayer perceptron (MLP), were therefore evaluated.

The supervised machine-learning algorithms were trained
on different scenarios to represent digital farm configurations
with one or two sensors, to limit investment costs for farmers.
Five sensors were considered for their availability during the
study:

* The presence of an electronic sow feeder (ESF) for recording feeding behavior (scenario 1).

* The presence of an automatic weighing system in the gestation room (scenario 2).

* The presence of accelerometers (scenario 3i) or cameras (scenario 3g) for measuring individual or group activity, respectively.

* The presence of electronic drinkers for recording drinking behavior (scenario 4).

A total of 11 scenarios were defined (Figure 1) depending on farm sensor configurations (a single sensor, or a combination of two sensors). Each scenario was tested with the possible addition of sows and housing characteristics (11 scenarios) or without (11 scenarios). The sow and housing characteristics included the average temperature measured in the gestation room (throughout the gestation), body weight, backfat thickness, and the age of the sow on the day of the artificial insemination. In all scenarios (with or without sow and housing characteristics), the “Day of gestation” variable was considered to take into account the “bump feeding” (i.e., an increase in feed supply) after 85 d of gestation.

Nutrition model INRAPorc (Dourmad et al., 2008) mod-
ified by Gaillard et al. (2020a) produced reference values of
ME (in MJ/d) and standard ileal digestible lysine (SID Lys,
in g/d) (Figure 2). These reference values have been used to
evaluate the results provided by machine-learning techniques.
These values were calculated ex-post, by taking into account
the average daily temperature measured in the gestation room,
the daily individual time spent in a standing position (given
by accelerometers), the farrowing performances (number and
weight of piglets), and the daily body weight (Table 1).

Data collection and pre-processing

A total of 73 crossbred sows (8 primiparous and 65 multip-
arous), housed in four gestation rooms, were studied from
a few days after artificial insemination to nearly the end of
their gestation (104 d). The ambient temperature (°C) was
continuously measured (every 5 min) in the gestation rooms
thanks to sensors set up at 1.8 m above (Lascar Electronics,
Salisbury, United Kingdom, precision ± 0.45 °C).
sow performances. Precision feeding is based on the avail-
ability of smart feeders that make it possible to supply feed
at individual or small group levels, based on the accurate
prediction of nutrient requirements and the determination of
the nutritional value of feed ingredients. Electronic feeding
stations allow individual feed supply (Gaillard et al., 2020b),
and tables are available for determining the nutrient value of
feed (Sauvant et al., 2004). The nutrient requirements of ges-
tating sows are usually provided by a mechanistic nutrition
model that requires inputs such as herd performances, sow
age, and body condition at artificial insemination, but also an
estimation (or actual data a posteriori) of farrowing perfor-
mances (Cooper et al., 2001; Hansen et al., 2014; Gaillard et
al., 2019).

Sensors and automatons are being increasingly used on farms (Galaz et al., 2021) to automatize tasks, manage large groups of animals in real time, or help optimize production costs (Berckmans, 2017; Neethirajan, 2020; Siegford and Guzhva, 2021). These technologies allow individual monitoring thanks to Radio Frequency Identification (RFID) (Mahfuz et al., 2022). The huge amount of real-time data collected, especially behavioral data, requires efficient approaches to classification or prediction issues, such as machine learning (Neethirajan, 2020; Llonch et al., 2022). Indeed, machine learning uses methods that learn from data to solve a specific task, such as classification or clustering, prediction, anomaly detection, or recommendation (Géron, 2019). These algorithms have already been used on pig feeder data to predict biting outbreaks with an accuracy of 96% (Ollagnier et al., 2023) and to predict body weight with an accuracy of 89% (He et al., 2021).

This study aims to explore the prediction of daily and indi-
vidual nutrient requirements (here defined as metabolizable
energy [ME] and standardized ileal digestible amino acids) of
gestating sows based on data measured by sensors (electron-
ics feeder and drinker, automatic weighting system, camera
and accelerometer). This study also proposes to test various
digital farm configurations and to compare the results accord-
ing to the number and type of sensors (22 scenarios), as well
as nine different machine-learning algorithms (linear-based,
p polynomial, Tree-based, support vector machine, nearest
neighbor, and neural network).

Materials and Methods

This study was carried out from July to April 2021, at the Pig
Physiology and Phenotyping Experimental facilities (UE3P,
doi: 10.15454/1.5573932732039927E12) of the French
National Research Institute for Agriculture, Food and the
Environment (INRAE) located in Saint-Gilles (France). Ethi-
cal approval concerning the French legislation on experimen-
tal animal care was given by the Ethics Committee for Animal
Experimentation in Rennes, France (authorization for exper-
iments on living animals No. 25883-2020070711528084).
The data used in this study is available for public access and
described in the data paper (Durand et al., 2023).

Overall approach

The study was designed to evaluate the prediction of the
nutrient requirements of sows based on sensor data and
machine-learning methods. The first question to be answered
is the following: "What is the best sensor(s) that may be
required on a farm for correctly predicting sow nutrient

requirements?” Other questions regarding algorithm optimi-
zation are considered: (i) “Which is the best algorithm, i.e.
with the highest accuracy, for predicting those requirements?”
(ii) “Does the integration of sow and housing characteristics
into the predictive variables improve prediction?”

Predicting nutrient requirements is a regression problem since it is needed for predicting continuous values. For that purpose, nine supervised algorithms were chosen for their high performance in regression tasks as well as their representability of the diversity of machine-learning algorithms (Géron, 2019). A linear regression (LR), the LR with a LASSO regularization (LASSO), the LR with a RIDGE regularization (RIDGE), a polynomial regression (PR), a support vector machine for regression (SVR), a random forest (RF), a k-nearest-Neighbors (KNN), a gradient tree boosting (GTB), as well as a multilayer perceptron (MLP), were therefore evaluated.

The supervised machine-learning algorithms were trained
on different scenarios to represent digital farm configurations
with one or two sensors, to limit investment costs for farmers.
Five sensors were considered for their availability during the
study:

* The presence of an electronic sow feeder (ESF) for recording feeding behavior (scenario 1).

* The presence of an automatic weighing system in the gestation room (scenario 2).

* The presence of accelerometers (scenario 3i) or cameras (scenario 3g) for measuring individual or group activity, respectively.

* The presence of electronic drinkers for recording drinking behavior (scenario 4).

A total of 11 scenarios were defined (Figure 1) depending on farm sensor configurations (a single sensor, or a combination of two sensors). Each scenario was tested with the possible addition of sows and housing characteristics (11 scenarios) or without (11 scenarios). The sow and housing characteristics included the average temperature measured in the gestation room (throughout the gestation), body weight, backfat thickness, and the age of the sow on the day of the artificial insemination. In all scenarios (with or without sow and housing characteristics), the “Day of gestation” variable was considered to take into account the “bump feeding” (i.e., an increase in feed supply) after 85 d of gestation.

Nutrition model INRAPorc (Dourmad et al., 2008) mod-
ified by Gaillard et al. (2020a) produced reference values of
ME (in MJ/d) and standard ileal digestible lysine (SID Lys,
in g/d) (Figure 2). These reference values have been used to
evaluate the results provided by machine-learning techniques.
These values were calculated ex-post, by taking into account
the average daily temperature measured in the gestation room,
the daily individual time spent in a standing position (given
by accelerometers), the farrowing performances (number and
weight of piglets), and the daily body weight (Table 1).

Data collection and pre-processing

A total of 73 crossbred sows (8 primiparous and 65 multiparous), housed in four gestation rooms, were studied from a few days after artificial insemination to nearly the end of their gestation (104 d). The ambient temperature (°C) was continuously measured (every 5 min) in the gestation rooms thanks to sensors set up at 1.8 m above (Lascar Electronics, Salisbury, United Kingdom, precision ± 0.45 °C).
<figure><img src="image_4.png" /><figcaption>**Figure 1.** Creation of scenarios with or without sow and housing characteristics based on various sensors (one only or two combined) used in the study.</figcaption></figure>

<figure><img src="image_5.png" /><figcaption>**Figure 2.** Evaluation of the algorithm's performance with the nutrition model.</figcaption></figure>

<table><caption>**Table 1.** Description of the daily variables predicted and used in the nutritional model as well as sow and housing characteristics</caption><thead><tr><th>Variables</th><th>Primiparous</th><th>Multiparous</th></tr></thead><tbody><tr><td>Number of sows</td><td>8</td><td>65</td></tr><tr><td>Nutritional model inputs</td><td></td><td></td></tr><tr><td>Age at insemination, d<fnref n="1" /></td><td>275.30 ± 15.30</td><td>821.63 ± 322.85</td></tr><tr><td>Body weight of sows, kg<fnref n="1" /></td><td>163.30 ± 7.70</td><td>238.14 ± 37.08</td></tr><tr><td>BT<fnref n="2" /> of sows, mm<fnref n="1" /></td><td>17.125 ± 2.62</td><td>15.52 ± 3.13</td></tr><tr><td>Daily temperature, °C<fnref n="1" /></td><td>19.60 ± 2.47</td><td>20.38 ± 2.30</td></tr><tr><td>Time in standing position, h/d</td><td>4.26 ± 1.28</td><td>3.93 ± 1.99</td></tr><tr><td>Number of piglets stillbirth</td><td>15.60 ± 3.18</td><td>16.35 ± 4.40</td></tr><tr><td>Weight of litter, kg</td><td>21.80 ± 3.90</td><td>23.94 ± 4.88</td></tr><tr><td>Predicted</td><td></td><td></td></tr><tr><td>SID LYS<fnref n="3" />, g/d</td><td>10.29 ± 2.30</td><td>8.76 ± 2.62</td></tr><tr><td>ME<fnref n="4" />, MJ/d</td><td>32.40 ± 2.92</td><td>36.03 ± 4.06</td></tr></tbody></table>

Feeding behavior, including each visit to the feeder, the number and duration (in minutes) of feeding visits (and

the amount of feed consumed), the number and duration of non-feeding visits (without consumption), and the feeder access order, was collected thanks to two self-locking ESF (Gestal, JYGA Technologies Inc, Quebec, Canada) and by identifying the sow using their RFID ear tag (Table 2, scenario 1). The body weight of each sow was measured weekly using a scale (Schippers, Hapert, the Netherlands, precision ± 5 kg) and uniformly distributed on a daily basis using the Weibull equation (Quiniou, 2021) (Table 2, scenario 2).

Sows were also equipped with a tri-axial accelerometer (RF-Track, Rennes, France), to record their physical activities on an individual scale: the time (in minutes) spent lying down, standing, moving, and the number of posture changes (Table 2, scenario 3i). Two cameras (RS-CCPOE280IR4-DH, Ro-main Inc., Quebec, Canada) mounted on the gestation room ceiling continuously recorded the sow pen. The physical activities of the sows were evaluated on a group scale by automatically analyzing videos with a convolutional neural network algorithm (Dilepix, Rennes, France; Durand et al., 2021). Both tools, the accelerometer and algorithm, produced data every 30 minutes, as a representative summary of the last 30 min. This algorithm's outputs were the proportion of sows in different positions: ventral lying, lateral lying, standing, sitting, eating, and drinking (Table 2, scenario 3g). Another RFID ear tag was used to record the drinking behavior of sows at two electronic drinkers (Asserva, Lamballe,

<footnote n="1">¹Features defining “sow and housing characteristics” on the model.</footnote>

<footnote n="2">²Back fat Thickness.</footnote>

<footnote n="3">³Standard ileal digestible lysine.</footnote>

<footnote n="4">⁴Metabolizable energy.</footnote>
<figure><img src="image_4.png" /><figcaption>**Figure 1.** Creation of scenarios with or without sow and housing characteristics based on various sensors (one only or two combined) used in the study.</figcaption></figure>

<figure><img src="image_5.png" /><figcaption>**Figure 2.** Evaluation of the algorithm's performance with the nutrition model.</figcaption></figure>

<table><caption>**Table 1.** Description of the daily variables predicted and used in the nutritional model as well as sow and housing characteristics</caption><thead><tr><th>Variables</th><th>Primiparous</th><th>Multiparous</th></tr></thead><tbody><tr><td>Number of sows</td><td>8</td><td>65</td></tr><tr><td>Nutritional model inputs</td><td></td><td></td></tr><tr><td>Age at insemination, d<fnref n="1" /></td><td>275.30 ± 15.30</td><td>821.63 ± 322.85</td></tr><tr><td>Body weight of sows, kg<fnref n="1" /></td><td>163.30 ± 7.70</td><td>238.14 ± 37.08</td></tr><tr><td>BT<fnref n="2" /> of sows, mm<fnref n="1" /></td><td>17.125 ± 2.62</td><td>15.52 ± 3.13</td></tr><tr><td>Daily temperature, °C<fnref n="1" /></td><td>19.60 ± 2.47</td><td>20.38 ± 2.30</td></tr><tr><td>Time in standing position, h/d</td><td>4.26 ± 1.28</td><td>3.93 ± 1.99</td></tr><tr><td>Number of piglets stillbirth</td><td>15.60 ± 3.18</td><td>16.35 ± 4.40</td></tr><tr><td>Weight of litter, kg</td><td>21.80 ± 3.90</td><td>23.94 ± 4.88</td></tr><tr><td>Predicted</td><td></td><td></td></tr><tr><td>SID LYS<fnref n="3" />, g/d</td><td>10.29 ± 2.30</td><td>8.76 ± 2.62</td></tr><tr><td>ME<fnref n="4" />, MJ/d</td><td>32.40 ± 2.92</td><td>36.03 ± 4.06</td></tr></tbody></table>

Feeding behavior, including each visit to the feeder, the number and duration (in minutes) of feeding visits (and

the amount of feed consumed), the number and duration of non-feeding visits (without consumption), and the feeder access order, was collected thanks to two self-locking ESF (Gestal, JYGA Technologies Inc, Quebec, Canada) and by identifying the sow using their RFID ear tag (Table 2, scenario 1). The body weight of each sow was measured weekly using a scale (Schippers, Hapert, the Netherlands, precision ± 5 kg) and uniformly distributed on a daily basis using the Weibull equation (Quiniou, 2021) (Table 2, scenario 2).

Sows were also equipped with a tri-axial accelerometer (RF-Track, Rennes, France), to record their physical activities on an individual scale: the time (in minutes) spent lying down, standing, moving, and the number of posture changes (Table 2, scenario 3i). Two cameras (RS-CCPOE280IR4-DH, Ro-main Inc., Quebec, Canada) mounted on the gestation room ceiling continuously recorded the sow pen. The physical activities of the sows were evaluated on a group scale by automatically analyzing videos with a convolutional neural network algorithm (Dilepix, Rennes, France; Durand et al., 2021). Both tools, the accelerometer and algorithm, produced data every 30 minutes, as a representative summary of the last 30 min. This algorithm's outputs were the proportion of sows in different positions: ventral lying, lateral lying, standing, sitting, eating, and drinking (Table 2, scenario 3g). Another RFID ear tag was used to record the drinking behavior of sows at two electronic drinkers (Asserva, Lamballe,

<footnote n="1">¹Features defining “sow and housing characteristics” on the model.</footnote>

<footnote n="2">²Back fat Thickness.</footnote>

<footnote n="3">³Standard ileal digestible lysine.</footnote>

<footnote n="4">⁴Metabolizable energy.</footnote>
France): the number and duration of visits with or without water consumption, and the total quantity of water drunk (in L) (Table 2, scenario 4).

Sensor data was cleaned to avoid outliers and regrouped on a daily scale (Table 2). All visits to the ESF lasting over 6 h (less than 1% of observations) and all hourly accelerometer data with a sum different from a 1 h duration (less than 1% of observations) were removed from the dataset.

## Algorithm hyper-parameter tuning and evaluation of performances

The supervised machine-learning algorithms were implemented in Python using the scikit-learn library (Pedregosa et al., 2011). The 8,323 observations (an observation being a sow per day of gestation, 'n' in the metrics formula) were randomly split 100 times ('t' in the metrics formula) into a training dataset (70% of the original dataset) and a test dataset (30%), to avoid possible overfitting of the predictive learning model. A K-fold learning strategy was also tested without giving better results, these K-fold results are therefore not presented in this paper.

To optimize the performance the hyper-parameter tuning (detailed in Table 3) was evaluated through a 3-fold cross-validation method on the training dataset due to the limited amount of data (70% of the global dataset) (Pedregosa et al., 2011). Hyper-parameter tuning was carried out for each tested ML algorithm and each scenario.

The relevance of sow and housing characteristics variables (Table 1) was tested in an ablation study for the best algorithm and scenario (one sensor). These variables were

excluded from the dataset one after the other, and the performance results were compared.

Three metrics were used to evaluate the performances of the prediction model (in the metrics formula) applied to the test dataset: the coefficient of determination R<fnref n="2" /> score (between 0 and 1), the root mean square error (RMSE, in the unit of the predicted variable), and the mean absolute percentage error (MAPE, in %). Let us recall that the reference values ('y' in the metrics formula) are given by the INRAPorc nutrition model applied to individual sows (Gaillard et al., 2020a). The R<fnref n="2" /> score measures the quality of the regression prediction and allows a comparison between models. The RMSE and MAPE values were used to measure the accuracy and prediction errors of the models. The higher the R<fnref n="2" /> score, and the lower the RMSE and MAPE values, the higher the accuracy of the prediction. A mean value of the metrics was calculated based on the 100 validation steps of the split dataset, to increase the repeatability of the presented results and avoid overfitting.

$$R^2 = 1 - \frac{\sum_{t=1}^{n} (y_t - \hat{y}_t)^2}{\sum_{t=1}^{n} (y_t - \bar{y})^2}$$

$$RMSE = \sqrt{\frac{1}{n} \sum_{t=1}^{n} (y_t - \hat{y}_t)^2}$$

$$MAPE = \frac{100}{n} \sum_{t=1}^{n} \left| \frac{y_t - \hat{y}_t}{y_t} \right|$$

<table><caption>**Table 2.** Description of the variables studied per scenario, as a daily mean value by parity (primiparous and multiparous sows)</caption><thead><tr><th rowspan="2">Scenario</th><th>Variables</th><th>Primiparous</th><th>Multiparous</th></tr><tr><th>n =</th><th>8</th><th>65</th></tr></thead><tbody><tr><td rowspan="4">1 (feeder)</td><td>Number of NNV<sup>1</sup></td><td>3.93 ± 2.77</td><td>5.27 ± 3.60</td></tr><tr><td>Number of NV<sup>2</sup></td><td>1.01 ± 0.14</td><td>1.02 ± 0.16</td></tr><tr><td>Duration of NNV<sup>1</sup>, min</td><td>21.75 ± 37.25</td><td>31.63 ± 42.14</td></tr><tr><td>Duration of NV<sup>2</sup>, min</td><td>33.80 ± 15.79</td><td>33.81 ± 25.33</td></tr><tr><td rowspan="2">2 (weight scale)</td><td>Feeder order</td><td>15.81 ± 2.07</td><td>8.84 ± 3.73</td></tr><tr><td>Live body weight mean, kg</td><td>191.17 ± 22.47</td><td>266.23 ± 35.43</td></tr><tr><td rowspan="4">3i (accelerometer)</td><td>Lying time, h</td><td>17.28 ± 3.10</td><td>18.12 ± 3.17</td></tr><tr><td>Standing time, h</td><td>4.26 ± 1.28</td><td>3.93 ± 1.99</td></tr><tr><td>Moving time, h</td><td>1.29 ± 0.75</td><td>1.10 ± 0.77</td></tr><tr><td>Postures changes, n</td><td>39.77 ± 14.70</td><td>34.46 ± 17.98</td></tr><tr><td rowspan="6">3g (camera)</td><td>Side lying time, %</td><td></td><td>54.96 ± 9.42</td></tr><tr><td>Ventral lying time, %</td><td></td><td>19.89 ± 5.18</td></tr><tr><td>Standing time, %</td><td></td><td>20.71 ± 5.36</td></tr><tr><td>Sitting time, %</td><td></td><td>1.11 ± 0.88</td></tr><tr><td>Eating time, %</td><td></td><td>2.68 ± 1.94</td></tr><tr><td>Drinking time, %</td><td></td><td>0.62 ± 0.34</td></tr><tr><td rowspan="5">4 (drinker)</td><td>Number of NNV<sup>1</sup></td><td>3.51 ± 4.50</td><td>3.04 ± 5.01</td></tr><tr><td>Number of NV<sup>2</sup></td><td>10.13 ± 7.20</td><td>11.27 ± 7.72</td></tr><tr><td>Duration of NNV<sup>1</sup>, min</td><td>1.07 ± 2.08</td><td>0.90 ± 1.91</td></tr><tr><td>Duration of NV<sup>2</sup>, min</td><td>5.92 ± 4.23</td><td>8.49 ± 7.09</td></tr><tr><td>Water drunk, mL</td><td>5.92 ± 4.21</td><td>8.81 ± 7.89</td></tr></tbody></table>

<footnote n="1">¹Non-nutritive visit (without consumption of feed or water).</footnote>

<footnote n="2">²Nutritive visit (with consumption of feed or water).</footnote>
France): the number and duration of visits with or without water consumption, and the total quantity of water drunk (in L) (Table 2, scenario 4).

Sensor data was cleaned to avoid outliers and regrouped on a daily scale (Table 2). All visits to the ESF lasting over 6 h (less than 1% of observations) and all hourly accelerometer data with a sum different from a 1 h duration (less than 1% of observations) were removed from the dataset.

## Algorithm hyper-parameter tuning and evaluation of performances

The supervised machine-learning algorithms were implemented in Python using the scikit-learn library (Pedregosa et al., 2011). The 8,323 observations (an observation being a sow per day of gestation, 'n' in the metrics formula) were randomly split 100 times ('t' in the metrics formula) into a training dataset (70% of the original dataset) and a test dataset (30%), to avoid possible overfitting of the predictive learning model. A K-fold learning strategy was also tested without giving better results, these K-fold results are therefore not presented in this paper.

To optimize the performance the hyper-parameter tuning (detailed in Table 3) was evaluated through a 3-fold cross-validation method on the training dataset due to the limited amount of data (70% of the global dataset) (Pedregosa et al., 2011). Hyper-parameter tuning was carried out for each tested ML algorithm and each scenario.

The relevance of sow and housing characteristics variables (Table 1) was tested in an ablation study for the best algorithm and scenario (one sensor). These variables were

excluded from the dataset one after the other, and the performance results were compared.

Three metrics were used to evaluate the performances of the prediction model (in the metrics formula) applied to the test dataset: the coefficient of determination R<fnref n="2" /> score (between 0 and 1), the root mean square error (RMSE, in the unit of the predicted variable), and the mean absolute percentage error (MAPE, in %). Let us recall that the reference values ('y' in the metrics formula) are given by the INRAPorc nutrition model applied to individual sows (Gaillard et al., 2020a). The R<fnref n="2" /> score measures the quality of the regression prediction and allows a comparison between models. The RMSE and MAPE values were used to measure the accuracy and prediction errors of the models. The higher the R<fnref n="2" /> score, and the lower the RMSE and MAPE values, the higher the accuracy of the prediction. A mean value of the metrics was calculated based on the 100 validation steps of the split dataset, to increase the repeatability of the presented results and avoid overfitting.

$$R^2 = 1 - \frac{\sum_{t=1}^{n} (y_t - \hat{y}_t)^2}{\sum_{t=1}^{n} (y_t - \bar{y})^2}$$

$$RMSE = \sqrt{\frac{1}{n} \sum_{t=1}^{n} (y_t - \hat{y}_t)^2}$$

$$MAPE = \frac{100}{n} \sum_{t=1}^{n} \left| \frac{y_t - \hat{y}_t}{y_t} \right|$$

<table><caption>**Table 2.** Description of the variables studied per scenario, as a daily mean value by parity (primiparous and multiparous sows)</caption><thead><tr><th rowspan="2">Scenario</th><th>Variables</th><th>Primiparous</th><th>Multiparous</th></tr><tr><th>n =</th><th>8</th><th>65</th></tr></thead><tbody><tr><td rowspan="4">1 (feeder)</td><td>Number of NNV<sup>1</sup></td><td>3.93 ± 2.77</td><td>5.27 ± 3.60</td></tr><tr><td>Number of NV<sup>2</sup></td><td>1.01 ± 0.14</td><td>1.02 ± 0.16</td></tr><tr><td>Duration of NNV<sup>1</sup>, min</td><td>21.75 ± 37.25</td><td>31.63 ± 42.14</td></tr><tr><td>Duration of NV<sup>2</sup>, min</td><td>33.80 ± 15.79</td><td>33.81 ± 25.33</td></tr><tr><td rowspan="2">2 (weight scale)</td><td>Feeder order</td><td>15.81 ± 2.07</td><td>8.84 ± 3.73</td></tr><tr><td>Live body weight mean, kg</td><td>191.17 ± 22.47</td><td>266.23 ± 35.43</td></tr><tr><td rowspan="4">3i (accelerometer)</td><td>Lying time, h</td><td>17.28 ± 3.10</td><td>18.12 ± 3.17</td></tr><tr><td>Standing time, h</td><td>4.26 ± 1.28</td><td>3.93 ± 1.99</td></tr><tr><td>Moving time, h</td><td>1.29 ± 0.75</td><td>1.10 ± 0.77</td></tr><tr><td>Postures changes, n</td><td>39.77 ± 14.70</td><td>34.46 ± 17.98</td></tr><tr><td rowspan="6">3g (camera)</td><td>Side lying time, %</td><td></td><td>54.96 ± 9.42</td></tr><tr><td>Ventral lying time, %</td><td></td><td>19.89 ± 5.18</td></tr><tr><td>Standing time, %</td><td></td><td>20.71 ± 5.36</td></tr><tr><td>Sitting time, %</td><td></td><td>1.11 ± 0.88</td></tr><tr><td>Eating time, %</td><td></td><td>2.68 ± 1.94</td></tr><tr><td>Drinking time, %</td><td></td><td>0.62 ± 0.34</td></tr><tr><td rowspan="5">4 (drinker)</td><td>Number of NNV<sup>1</sup></td><td>3.51 ± 4.50</td><td>3.04 ± 5.01</td></tr><tr><td>Number of NV<sup>2</sup></td><td>10.13 ± 7.20</td><td>11.27 ± 7.72</td></tr><tr><td>Duration of NNV<sup>1</sup>, min</td><td>1.07 ± 2.08</td><td>0.90 ± 1.91</td></tr><tr><td>Duration of NV<sup>2</sup>, min</td><td>5.92 ± 4.23</td><td>8.49 ± 7.09</td></tr><tr><td>Water drunk, mL</td><td>5.92 ± 4.21</td><td>8.81 ± 7.89</td></tr></tbody></table>

<footnote n="1">¹Non-nutritive visit (without consumption of feed or water).</footnote>

<footnote n="2">²Nutritive visit (with consumption of feed or water).</footnote>
<table><caption>**Table 3.** Hyper-parameters tested on the selected supervised learning algorithms</caption><thead><tr><th>Algorithms</th><th>Hyper-parameters</th><th>Description</th><th>Values</th></tr></thead><tbody><tr><td>Linear regression</td><td></td><td></td><td></td></tr><tr><td>LASSO regression</td><td>alpha</td><td>Constant that controlling the regularization strength.</td><td>[10<sup>-5</sup> ; 10<sup>1</sup>]</td></tr><tr><td>RIDGE regression</td><td>alpha</td><td>Constant that controlling the regularization strength.</td><td>[10<sup>-5</sup> ; 10<sup>1</sup>]</td></tr><tr><td>Polynomial regression</td><td>degree</td><td>Degree of the polynomial features.</td><td>2, 3</td></tr><tr><td>Random forest</td><td>Bootstrap</td><td>Whether bootstrap samples are used when building trees.</td><td>True</td></tr><tr><td></td><td>max_depth</td><td>The maximum depth of the tree.</td><td>80, 90, 100, 110</td></tr><tr><td></td><td>max_features</td><td>The number of features to consider when looking for the best split.</td><td>2, 3</td></tr><tr><td></td><td>min Samples leaf</td><td>The minimum number of samples required to be at a leaf node.</td><td>3, 4, 5</td></tr><tr><td></td><td>min samples split</td><td>The minimum number of samples required to split an internal node.</td><td>8, 10, 12</td></tr><tr><td></td><td>n-estimators</td><td>The number of trees in the forest.</td><td>100, 200, 300, 1000</td></tr><tr><td>Support vector machine</td><td>kernel</td><td>Specifies the kernel type to be used in the algorithm.</td><td>Linear, rbf</td></tr><tr><td></td><td>gamma</td><td>Kernel coefficient for 'rbf'.</td><td>Scale, 1, 0.1, 0.001, 0.0001</td></tr><tr><td></td><td>C</td><td>The strength of the regularization is inversely proportional to C.</td><td>0.1, 1, 10, 50, 80, 100</td></tr><tr><td>K-nearest-neighbors</td><td>n_neighbors</td><td>Number of neighbors to use.</td><td>[1 ; 50]</td></tr><tr><td>Gradient tree boost</td><td>n-estimators</td><td>The number of boosting stages to perform.</td><td>1, 8, 16, 32,64, 100, 1000</td></tr><tr><td></td><td>learning rate</td><td>Learning rate shrinks the contribution of each tree.</td><td>0.01, 0.05, 0.1, 0.25, 0.5, 1</td></tr><tr><td></td><td>max_depth</td><td>Maximum depth of the individual regression estimators.</td><td>1, 2, 3, 4, 5, 6, 7, 8</td></tr><tr><td>Multilayer perceptron</td><td>hidden layer sizes</td><td>The number of neurons in the hidden layer.</td><td>2, 10, 20, 30, 40, 50, 80, 100, 200</td></tr><tr><td></td><td>activation</td><td>Activation function for the hidden layer.</td><td>Tanh, relu, logistic</td></tr><tr><td></td><td>solver</td><td>The solver for weight optimization.</td><td>sgd, adam, lbfgs</td></tr></tbody></table>

## Results

Overall, sensor-based scenarios with sow and housing characteristics had lower RMSE and MAPE mean values for standard ileal digestible lysine (SID Lys) than scenarios without that information (0.70 vs. 1.28 g/d, and 5.54% vs. 11.12%, respectively). When using data from a single sensor, the prediction for ME was more accurate for scenarios with sow and housing characteristics (Table 4) than for scenarios without (Table 5), while it was similar when using data from two sensors (Tables 4 and 5). First, the results of the scenarios that only use data from sensors were presented, followed by those of scenarios that include sow and housing characteristics. The latter was developed based on an ablation study.

### Sensor-based scenarios without sow or housing characteristics

Among these scenarios, the differences in MAPE values between scenarios 3i (individual level) and 3g (group level) were small, with a slight superiority of individual levels (14.81% vs. 15.45%, respectively, for SID Lys and 7.52% vs. 7.76%, respectively, for ME Table 4). For that reason, only scenario 3i with the combination of two sensors was used.

For SID Lys, the scenarios combining feeder data with data from another sensor (1 + 4 drinker, 1 + 3i accelerometer, and 1 + 2 scale, in order of performance) had the highest R² score (0.88 to 0.91, Table 4) and lowest RMSE and MAPE values, followed by the scale data only (2, Table 4). For ME, the 1 + 3i (R² = 0.75) followed by the 1 + 4 scenarios (R² = 0.73) gave the best performances for two sensors, and scenario 1

(feeder, R² = 0.50) among the single-sensor scenarios (Table 4).

The lowest MAPE and RMSE values (Table 6) and the highest R² scores (0.78 to 0.80 for SID Lys and 0.60 to 0.65 for ME) were obtained with GTB first, followed by RF, then MLP. The lowest prediction performances for SID Lys and ME were obtained with LR, LASSO, and RIDGE (Table 6).

### Sensor-based scenarios with sow and housing characteristics

Among these scenarios, the differences in MAPE values between scenarios 3i (individual level) and 3g (group level) were small, with a superiority of individual levels (5.41% vs. 6.92%, respectively, for SID Lys and 4.26% vs. 4.31%, respectively, for ME Table 5). That is why only scenario 3i with the combination of two sensors, was used.

For SID Lys, scenarios 1 (feeder) and 2 (weighing scale) using unique sensors had the highest R² score (0.92, Table 5) and lowest RMSE and MAPE values (Table 5). These results are followed by scenario 1 + 2 which combines feeder and scale data (MAPE = 5.31%, Table 5). For ME, the most accurate predictions were obtained for scenarios 1 + 2 (feeder + scale), 1 + 3i (feeder + accelerometer), and 1 + 4 (feeder + drinker, R² = 0.75, Table 5), and finally 1 (feeder, R² = 0.74, Table 5).

The lowest MAPE and RMSE values (Table 6) and the highest R² scores (0.97 to 0.99 for SID Lys and 0.89 to 0.95 for ME) were obtained with GTB first (Figures 3 and 4, in red), followed by RF (Figure 3 and 4, in light purple), then MLP (Figure 3 and 4, in brown). The lowest prediction performances for SID Lys and ME were obtained with LR,
<table><caption>**Table 3.** Hyper-parameters tested on the selected supervised learning algorithms</caption><thead><tr><th>Algorithms</th><th>Hyper-parameters</th><th>Description</th><th>Values</th></tr></thead><tbody><tr><td>Linear regression</td><td></td><td></td><td></td></tr><tr><td>LASSO regression</td><td>alpha</td><td>Constant that controlling the regularization strength.</td><td>[10<sup>-5</sup> ; 10<sup>1</sup>]</td></tr><tr><td>RIDGE regression</td><td>alpha</td><td>Constant that controlling the regularization strength.</td><td>[10<sup>-5</sup> ; 10<sup>1</sup>]</td></tr><tr><td>Polynomial regression</td><td>degree</td><td>Degree of the polynomial features.</td><td>2, 3</td></tr><tr><td>Random forest</td><td>Bootstrap</td><td>Whether bootstrap samples are used when building trees.</td><td>True</td></tr><tr><td></td><td>max_depth</td><td>The maximum depth of the tree.</td><td>80, 90, 100, 110</td></tr><tr><td></td><td>max_features</td><td>The number of features to consider when looking for the best split.</td><td>2, 3</td></tr><tr><td></td><td>min Samples leaf</td><td>The minimum number of samples required to be at a leaf node.</td><td>3, 4, 5</td></tr><tr><td></td><td>min samples split</td><td>The minimum number of samples required to split an internal node.</td><td>8, 10, 12</td></tr><tr><td></td><td>n-estimators</td><td>The number of trees in the forest.</td><td>100, 200, 300, 1000</td></tr><tr><td rowspan="3">Support vector machine</td><td>kernel</td><td>Specifies the kernel type to be used in the algorithm.</td><td>Linear, rbf</td></tr><tr><td>gamma</td><td>Kernel coefficient for 'rbf'.</td><td>Scale, 1, 0.1, 0.001, 0.0001</td></tr><tr><td>C</td><td>The strength of the regularization is inversely proportional to C.</td><td>0.1, 1, 10, 50, 80, 100</td></tr><tr><td>K-nearest-neighbors</td><td>n_neighbors</td><td>Number of neighbors to use.</td><td>[1 ; 50]</td></tr><tr><td rowspan="3">Gradient tree boost</td><td>n-estimators</td><td>The number of boosting stages to perform.</td><td>1, 8, 16, 32,64, 100, 1000</td></tr><tr><td>learning rate</td><td>Learning rate shrinks the contribution of each tree.</td><td>0.01, 0.05, 0.1, 0.25, 0.5, 1</td></tr><tr><td>max_depth</td><td>Maximum depth of the individual regression estimators.</td><td>1, 2, 3, 4, 5, 6, 7, 8</td></tr><tr><td rowspan="3">Multilayer perceptron</td><td>hidden layer sizes</td><td>The number of neurons in the hidden layer.</td><td>2, 10, 20, 30, 40, 50, 80, 100, 200</td></tr><tr><td>activation</td><td>Activation function for the hidden layer.</td><td>Tanh, relu, logistic</td></tr><tr><td>solver</td><td>The solver for weight optimization.</td><td>sgd, adam, lbfgs</td></tr></tbody></table>

## Results

Overall, sensor-based scenarios with sow and housing characteristics had lower RMSE and MAPE mean values for standard ileal digestible lysine (SID Lys) than scenarios without that information (0.70 vs. 1.28 g/d, and 5.54% vs. 11.12%, respectively). When using data from a single sensor, the prediction for ME was more accurate for scenarios with sow and housing characteristics (Table 4) than for scenarios without (Table 5), while it was similar when using data from two sensors (Tables 4 and 5). First, the results of the scenarios that only use data from sensors were presented, followed by those of scenarios that include sow and housing characteristics. The latter was developed based on an ablation study.

### Sensor-based scenarios without sow or housing characteristics

Among these scenarios, the differences in MAPE values between scenarios 3i (individual level) and 3g (group level) were small, with a slight superiority of individual levels (14.81% vs. 15.45%, respectively, for SID Lys and 7.52% vs. 7.76%, respectively, for ME Table 4). For that reason, only scenario 3i with the combination of two sensors was used.

For SID Lys, the scenarios combining feeder data with data from another sensor (1 + 4 drinker, 1 + 3i accelerometer, and 1 + 2 scale, in order of performance) had the highest R² score (0.88 to 0.91, Table 4) and lowest RMSE and MAPE values, followed by the scale data only (2, Table 4). For ME, the 1 + 3i (R² = 0.75) followed by the 1 + 4 scenarios (R² = 0.73) gave the best performances for two sensors, and scenario 1

(feeder, R² = 0.50) among the single-sensor scenarios (Table 4).

The lowest MAPE and RMSE values (Table 6) and the highest R² scores (0.78 to 0.80 for SID Lys and 0.60 to 0.65 for ME) were obtained with GTB first, followed by RF, then MLP. The lowest prediction performances for SID Lys and ME were obtained with LR, LASSO, and RIDGE (Table 6).

### Sensor-based scenarios with sow and housing characteristics

Among these scenarios, the differences in MAPE values between scenarios 3i (individual level) and 3g (group level) were small, with a superiority of individual levels (5.41% vs. 6.92%, respectively, for SID Lys and 4.26% vs. 4.31%, respectively, for ME Table 5). That is why only scenario 3i with the combination of two sensors, was used.

For SID Lys, scenarios 1 (feeder) and 2 (weighing scale) using unique sensors had the highest R² score (0.92, Table 5) and lowest RMSE and MAPE values (Table 5). These results are followed by scenario 1 + 2 which combines feeder and scale data (MAPE = 5.31%, Table 5). For ME, the most accurate predictions were obtained for scenarios 1 + 2 (feeder + scale), 1 + 3i (feeder + accelerometer), and 1 + 4 (feeder + drinker, R² = 0.75, Table 5), and finally 1 (feeder, R² = 0.74, Table 5).

The lowest MAPE and RMSE values (Table 6) and the highest R² scores (0.97 to 0.99 for SID Lys and 0.89 to 0.95 for ME) were obtained with GTB first (Figures 3 and 4, in red), followed by RF (Figure 3 and 4, in light purple), then MLP (Figure 3 and 4, in brown). The lowest prediction performances for SID Lys and ME were obtained with LR,
<table><caption>**Table 4.** Prediction performances (RMSE, MAPE, R²) of standard ileal digestible lysine (SID Lys) and metabolizable energy (ME) with sensor-based scenarios (one or two) only (as a mean value ± SD of the 9 algorithms)</caption><thead><tr><th rowspan="2"></th><th colspan="4">One sensor</th><th colspan="7">Two sensors<sup>*</sup></th></tr><tr><th>1</th><th>2</th><th>3i</th><th>3g</th><th>4</th><th>1 + 2</th><th>1 + 3<sub>i</sub></th><th>1 + 4</th><th>2 + 3<sub>i</sub></th><th>2 + 4</th><th>3<sub>i</sub> + 4</th></tr></thead><tbody><tr><td><strong>SID Lys</strong></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>RMSE, g/d</td><td>1.39 ± 0.21</td><td>1.00 ± 0.20</td><td>1.65 ± 0.07</td><td>1.71 ± 0.06</td><td>1.68 ± 0.07</td><td>0.85 ± 0.30</td><td>0.71 ± 0.32</td><td>0.69 ± 0.33</td><td>1.72 ± 0.07</td><td>1.65 ± 0.09</td><td>1.71 ± 0.07</td></tr><tr><td>MAPE, %</td><td>11.49 ± 2.28</td><td>7.92 ± 2.01</td><td>14.81 ± 0.82</td><td>15.45 ± 0.45</td><td>15.80 ± 0.81</td><td>6.78 ± 2.86</td><td>6.18 ± 2.90</td><td>5.48 ± 2.94</td><td>14.83 ± 2.92</td><td>15.31 ± 1.09</td><td>15.95 ± 0.49</td></tr><tr><td>R<sup>2</sup></td><td>0.71 ± 0.08</td><td>0.85 ± 0.06</td><td>0.60 ± 0.03</td><td>0.58 ± 0.03</td><td>0.59 ± 0.03</td><td>0.88 ± 0.07</td><td>0.91 ± 0.06</td><td>0.91 ± 0.07</td><td>0.58 ± 0.03</td><td>0.60 ± 0.05</td><td>0.58 ± 0.03</td></tr><tr><td><strong>ME</strong></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>RMSE, MJ/d</td><td>2.88 ± 0.42</td><td>3.10 ± 0.51</td><td>3.31 ± 0.26</td><td>3.40 ± 0.25</td><td>3.36 ± 0.30</td><td>2.46 ± 0.76</td><td>2.03 ± 0.66</td><td>2.01 ± 0.66</td><td>3.49 ± 0.19</td><td>3.36 ± 0.31</td><td>3.41 ± 0.24</td></tr><tr><td>MAPE, %</td><td>6.24 ± 1.08</td><td>6.87 ± 1.32</td><td>7.52 ± 0.58</td><td>7.76 ± 0.54</td><td>7.62 ± 0.72</td><td>5.27 ± 1.82</td><td>4.23 ± 1.56</td><td>4.23 ± 1.60</td><td>8.04 ± 0.40</td><td>7.60 ± 0.74</td><td>7.73 ± 0.56</td></tr><tr><td>R<sup>2</sup></td><td>0.50 ± 0.15</td><td>0.42 ± 0.19</td><td>0.35 ± 0.10</td><td>0.31 ± 0.10</td><td>0.32 ± 0.12</td><td>0.61 ± 0.22</td><td>0.73 ± 0.15</td><td>0.73 ± 0.16</td><td>0.28 ± 0.08</td><td>0.33 ± 0.12</td><td>0.31 ± 0.10</td></tr></tbody></table>

Sensors: sensor 1 = feeder; sensor 2 = weight scale; sensor 3i = accelerometer; 3g = camera; sensor 4 = drinker.

Bold values indicate the best result of prediction on the table.

<table><caption>**Table 5.** Prediction performances (RMSE, MAPE, R²) of standard ileal digestible lysine (SID Lys) and metabolizable energy (ME) with sensor-based scenarios (one or two) including sow and housing characteristics (as a mean value ± SD of the 9 algorithms)</caption><thead><tr><th rowspan="2"></th><th colspan="4">One sensor</th><th colspan="7">Two sensors<sup>*</sup></th></tr><tr><th>1</th><th>2</th><th>3i</th><th>3g</th><th>4</th><th>1 + 2</th><th>1 + 3<sub>i</sub></th><th>1 + 4</th><th>2 + 3<sub>i</sub></th><th>2 + 4</th><th>3<sub>i</sub> + 4</th></tr></thead><tbody><tr><td><strong>SID Lys</strong></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>RMSE, g/d</td><td>0.64 ± 0.36</td><td>0.65 ± 0.39</td><td>0.70 ± 0.33</td><td>0.86 ± 0.23</td><td>0.70 ± 0.34</td><td>0.67 ± 0.36</td><td>0.69 ± 0.32</td><td>0.68 ± 0.33</td><td>0.96 ± 0.17</td><td>0.79 ± 0.31</td><td>0.89 ± 0.17</td></tr><tr><td>MAPE, %</td><td>5.10 ± 3.17</td><td>5.16 ± 3.46</td><td>5.41 ± 2.93</td><td>6.92 ± 2.01</td><td>5.44 ± 3.07</td><td>5.31 ± 3.11</td><td>5.44 ± 2.88</td><td>5.40 ± 2.99</td><td>7.70 ± 1.61</td><td>6.24 ± 2.97</td><td>6.97 ± 1.61</td></tr><tr><td>R<sup>2</sup></td><td>0.92 ± 0.07</td><td>0.92 ± 0.07</td><td>0.91 ± 0.06</td><td>0.88 ± 0.05</td><td>0.91 ± 0.07</td><td>0.92 ± 0.07</td><td>0.92 ± 0.06</td><td>0.92 ± 0.06</td><td>0.86 ± 0.05</td><td>0.89 ± 0.07</td><td>0.88 ± 0.05</td></tr><tr><td><strong>ME</strong></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>RMSE, MJ/d</td><td>1.99 ± 0.70</td><td>1.96 ± 0.83</td><td>2.00 ± 0.77</td><td>2.02 ± 0.73</td><td>2.01 ± 0.79</td><td>1.94 ± 0.70</td><td>1.94 ± 0.68</td><td>1.95 ± 0.70</td><td>2.37 ± 0.49</td><td>2.11 ± 0.73</td><td>2.22 ± 0.58</td></tr><tr><td>MAPE, %</td><td>4.17 ± 1.67</td><td>4.15 ± 2.03</td><td>4.26 ± 1.90</td><td>4.31 ± 1.79</td><td>4.22 ± 1.93</td><td>4.04 ± 1.70</td><td>4.07 ± 1.66</td><td>4.03 ± 1.63</td><td>5.16 ± 1.20</td><td>4.49 ± 1.77</td><td>4.73 ± 1.44</td></tr><tr><td>R<sup>2</sup></td><td>0.74 ± 0.16</td><td>0.73 ± 0.20</td><td>0.73 ± 0.18</td><td>0.73 ± 0.18</td><td>0.73 ± 0.19</td><td>0.75 ± 0.16</td><td>0.75 ± 0.15</td><td>0.75 ± 0.15</td><td>0.65 ± 0.13</td><td>0.71 ± 0.18</td><td>0.69 ± 0.16</td></tr></tbody></table>

Sensors: sensor 1 = feeder; sensor 2 = weight scale; sensor 3i = accelerometer; 3g = camera; sensor 4 = drinker.

Bold values indicate the best result of prediction on the table.

LASSO, and RIDGE (Table 6). All the algorithms showed low variations between the 100 validation steps (Figures 3 and 4), except for PR (in dark blue).

Due to their higher R² result with the single-sensor scenario, the ablation study was carried out on scenario 1 (feeder) using the gradient tree boosting (GTB) algorithm for SID Lys and ME. Excluding ‘rank_cat’ from the feeder features in scenario 1 increased the MAPE values for SID Lys by 0.22% (Figure 5A), compared to scenario 1 with all the features (feeder with sow and housing characteristics). Only the exclusion of ‘nb_NNV’ decreased the MAPE values of SID Lys (Figure 5A). For ME, all the features excluded increased the MAPE values, the highest increase being 0.11% with the exclusion of ‘time_NV’ (Figure 5B). Among the sow and housing characteristics, the exclusion of ‘day’ and ‘body -weight’ from scenario 1 increased the MAPE values by 2.41% and 0.60% (Figure 5A) for SID Lys, respectively. For ME, excluding the ‘temperature’

and ‘day’ features increased the MAPE values by 0.29% and 0.69% (Figure 5B), respectively.

## Discussion

### Overall performances

Digestible lysine and ME are key components of the sows' feed costs during their gestation. A requirement prediction error under 5% is considered relatively satisfactory. The MAPE values showed that the machine-learning methods gave low prediction errors (under 5 and 7% for ME and SID Lys, respectively). The coefficient of determination (the R² score) showed that the nine supervised algorithms offered accurate prediction, especially for scenarios with sow and housing characteristics with all of the sensor data, for SID Lys (0.88 to 0.92) as well as ME (0.71 to 0.76). This study highlights the fact that predicting the daily nutrient requirement

<footnote>*Only activity scenarios 3i was tested due to their higher performances compared to 3g.</footnote>

<footnote>*Only activity scenarios 3i was tested due to their higher performances compared to 3g.</footnote>
<table><caption>**Table 4.** Prediction performances (RMSE, MAPE, R²) of standard ileal digestible lysine (SID Lys) and metabolizable energy (ME) with sensor-based scenarios (one or two) only (as a mean value ± SD of the 9 algorithms)</caption><thead><tr><th rowspan="2"></th><th colspan="4">One sensor</th><th colspan="7">Two sensors<sup>*</sup></th></tr><tr><th>1</th><th>2</th><th>3i</th><th>3g</th><th>4</th><th>1 + 2</th><th>1 + 3<sub>i</sub></th><th>1 + 4</th><th>2 + 3<sub>i</sub></th><th>2 + 4</th><th>3<sub>i</sub> + 4</th></tr></thead><tbody><tr><td><strong>SID Lys</strong></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>RMSE, g/d</td><td>1.39 ± 0.21</td><td>1.00 ± 0.20</td><td>1.65 ± 0.07</td><td>1.71 ± 0.06</td><td>1.68 ± 0.07</td><td>0.85 ± 0.30</td><td>0.71 ± 0.32</td><td>0.69 ± 0.33</td><td>1.72 ± 0.07</td><td>1.65 ± 0.09</td><td>1.71 ± 0.07</td></tr><tr><td>MAPE, %</td><td>11.49 ± 2.28</td><td>7.92 ± 2.01</td><td>14.81 ± 0.82</td><td>15.45 ± 0.45</td><td>15.80 ± 0.81</td><td>6.78 ± 2.86</td><td>6.18 ± 2.90</td><td>5.48 ± 2.94</td><td>14.83 ± 2.92</td><td>15.31 ± 1.09</td><td>15.95 ± 0.49</td></tr><tr><td>R<sup>2</sup></td><td>0.71 ± 0.08</td><td>0.85 ± 0.06</td><td>0.60 ± 0.03</td><td>0.58 ± 0.03</td><td>0.59 ± 0.03</td><td>0.88 ± 0.07</td><td>0.91 ± 0.06</td><td>0.91 ± 0.07</td><td>0.58 ± 0.03</td><td>0.60 ± 0.05</td><td>0.58 ± 0.03</td></tr><tr><td><strong>ME</strong></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>RMSE, MJ/d</td><td>2.88 ± 0.42</td><td>3.10 ± 0.51</td><td>3.31 ± 0.26</td><td>3.40 ± 0.25</td><td>3.36 ± 0.30</td><td>2.46 ± 0.76</td><td>2.03 ± 0.66</td><td>2.01 ± 0.66</td><td>3.49 ± 0.19</td><td>3.36 ± 0.31</td><td>3.41 ± 0.24</td></tr><tr><td>MAPE, %</td><td>6.24 ± 1.08</td><td>6.87 ± 1.32</td><td>7.52 ± 0.58</td><td>7.76 ± 0.54</td><td>7.62 ± 0.72</td><td>5.27 ± 1.82</td><td>4.23 ± 1.56</td><td>4.23 ± 1.60</td><td>8.04 ± 0.40</td><td>7.60 ± 0.74</td><td>7.73 ± 0.56</td></tr><tr><td>R<sup>2</sup></td><td>0.50 ± 0.15</td><td>0.42 ± 0.19</td><td>0.35 ± 0.10</td><td>0.31 ± 0.10</td><td>0.32 ± 0.12</td><td>0.61 ± 0.22</td><td>0.73 ± 0.15</td><td>0.73 ± 0.16</td><td>0.28 ± 0.08</td><td>0.33 ± 0.12</td><td>0.31 ± 0.10</td></tr></tbody></table>

Sensors: sensor 1 = feeder; sensor 2 = weight scale; sensor 3i = accelerometer; 3g = camera; sensor 4 = drinker.

Bold values indicate the best result of prediction on the table.

<table><caption>**Table 5.** Prediction performances (RMSE, MAPE, R²) of standard ileal digestible lysine (SID Lys) and metabolizable energy (ME) with sensor-based scenarios (one or two) including sow and housing characteristics (as a mean value ± SD of the 9 algorithms)</caption><thead><tr><th rowspan="2"></th><th colspan="4">One sensor</th><th colspan="7">Two sensors<sup>*</sup></th></tr><tr><th>1</th><th>2</th><th>3i</th><th>3g</th><th>4</th><th>1 + 2</th><th>1 + 3<sub>i</sub></th><th>1 + 4</th><th>2 + 3<sub>i</sub></th><th>2 + 4</th><th>3<sub>i</sub> + 4</th></tr></thead><tbody><tr><td><strong>SID Lys</strong></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>RMSE, g/d</td><td>0.64 ± 0.36</td><td>0.65 ± 0.39</td><td>0.70 ± 0.33</td><td>0.86 ± 0.23</td><td>0.70 ± 0.34</td><td>0.67 ± 0.36</td><td>0.69 ± 0.32</td><td>0.68 ± 0.33</td><td>0.96 ± 0.17</td><td>0.79 ± 0.31</td><td>0.89 ± 0.17</td></tr><tr><td>MAPE, %</td><td>5.10 ± 3.17</td><td>5.16 ± 3.46</td><td>5.41 ± 2.93</td><td>6.92 ± 2.01</td><td>5.44 ± 3.07</td><td>5.31 ± 3.11</td><td>5.44 ± 2.88</td><td>5.40 ± 2.99</td><td>7.70 ± 1.61</td><td>6.24 ± 2.97</td><td>6.97 ± 1.61</td></tr><tr><td>R<sup>2</sup></td><td>0.92 ± 0.07</td><td>0.92 ± 0.07</td><td>0.91 ± 0.06</td><td>0.88 ± 0.05</td><td>0.91 ± 0.07</td><td>0.92 ± 0.07</td><td>0.92 ± 0.06</td><td>0.92 ± 0.06</td><td>0.86 ± 0.05</td><td>0.89 ± 0.07</td><td>0.88 ± 0.05</td></tr><tr><td><strong>ME</strong></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>RMSE, MJ/d</td><td>1.99 ± 0.70</td><td>1.96 ± 0.83</td><td>2.00 ± 0.77</td><td>2.02 ± 0.73</td><td>2.01 ± 0.79</td><td>1.94 ± 0.70</td><td>1.94 ± 0.68</td><td>1.95 ± 0.70</td><td>2.37 ± 0.49</td><td>2.11 ± 0.73</td><td>2.22 ± 0.58</td></tr><tr><td>MAPE, %</td><td>4.17 ± 1.67</td><td>4.15 ± 2.03</td><td>4.26 ± 1.90</td><td>4.31 ± 1.79</td><td>4.22 ± 1.93</td><td>4.04 ± 1.70</td><td>4.07 ± 1.66</td><td>4.03 ± 1.63</td><td>5.16 ± 1.20</td><td>4.49 ± 1.77</td><td>4.73 ± 1.44</td></tr><tr><td>R<sup>2</sup></td><td>0.74 ± 0.16</td><td>0.73 ± 0.20</td><td>0.73 ± 0.18</td><td>0.73 ± 0.18</td><td>0.73 ± 0.19</td><td>0.75 ± 0.16</td><td>0.75 ± 0.15</td><td>0.75 ± 0.15</td><td>0.65 ± 0.13</td><td>0.71 ± 0.18</td><td>0.69 ± 0.16</td></tr></tbody></table>

Sensors: sensor 1 = feeder; sensor 2 = weight scale; sensor 3i = accelerometer; 3g = camera; sensor 4 = drinker.

Bold values indicate the best result of prediction on the table.

LASSO, and RIDGE (Table 6). All the algorithms showed low variations between the 100 validation steps (Figures 3 and 4), except for PR (in dark blue).

Due to their higher R² result with the single-sensor scenario, the ablation study was carried out on scenario 1 (feeder) using the gradient tree boosting (GTB) algorithm for SID Lys and ME. Excluding ‘rank_cat’ from the feeder features in scenario 1 increased the MAPE values for SID Lys by 0.22% (Figure 5A), compared to scenario 1 with all the features (feeder with sow and housing characteristics). Only the exclusion of ‘nb_NNV’ decreased the MAPE values of SID Lys (Figure 5A). For ME, all the features excluded increased the MAPE values, the highest increase being 0.11% with the exclusion of ‘time_NV’ (Figure 5B). Among the sow and housing characteristics, the exclusion of ‘day’ and ‘body -weight’ from scenario 1 increased the MAPE values by 2.41% and 0.60% (Figure 5A) for SID Lys, respectively. For ME, excluding the ‘temperature’

and ‘day’ features increased the MAPE values by 0.29% and 0.69% (Figure 5B), respectively.

## Discussion

### Overall performances

Digestible lysine and ME are key components of the sows’ feed costs during their gestation. A requirement prediction error under 5% is considered relatively satisfactory. The MAPE values showed that the machine-learning methods gave low prediction errors (under 5 and 7% for ME and SID Lys, respectively). The coefficient of determination (the R² score) showed that the nine supervised algorithms offered accurate prediction, especially for scenarios with sow and housing characteristics with all of the sensor data, for SID Lys (0.88 to 0.92) as well as ME (0.71 to 0.76). This study highlights the fact that predicting the daily nutrient requirement

<footnote>*Only activity scenarios 3i was tested due to their higher performances compared to 3g.</footnote>

<footnote>*Only activity scenarios 3i was tested due to their higher performances compared to 3g.</footnote>
<table><caption>**Table 6:** Prediction performances (RMSE, MAPE, R²) of metabolizable energy (ME) and standard ileal digestible lysine (SID Lys) per algorithm (as a mean value ± SD of the 22 scenarios with or without sow and housing characteristics)</caption><thead><tr><th></th><th>LR</th><th>LASSO</th><th>RIDGE</th><th>PR</th><th>RF</th><th>SVR</th><th>KNN</th><th>GTB</th><th>MLP</th></tr></thead><tbody><tr><td colspan="10">Scenario sensors with sow and housing characteristics</td></tr><tr><td colspan="10">SID Lys</td></tr><tr><td>RMSE, g/d</td><td>1.09 ± 0.03</td><td>1.09 ± 0.03</td><td>1.09 ± 0.03</td><td>0.86 ± 0.05</td><td>0.44 ± 0.12</td><td>0.51 ± 0.12</td><td>0.65 ± 0.12</td><td><strong>0.12 ± 0.04</strong></td><td>0.48 ± 0.07</td></tr><tr><td>MAPE, %</td><td>9.15 ± 0.33</td><td>9.15 ± 0.32</td><td>9.15 ± 0.32</td><td>7.09 ± 0.53</td><td>3.22 ± 0.94</td><td>3.19 ± 0.83</td><td>4.53 ± 0.93</td><td><strong>0.82 ± 0.18</strong></td><td>3.56 ± 0.51</td></tr><tr><td>R²</td><td>0.83 ± 0.01</td><td>0.83 ± 0.01</td><td>0.83 ± 0.01</td><td>0.89 ± 0.01</td><td>0.97 ± 0.02</td><td>0.96 ± 0.02</td><td>0.94 ± 0.02</td><td><strong>0.99 ± 0.01</strong></td><td>0.97 ± 0.01</td></tr><tr><td colspan="10">ME</td></tr><tr><td>RMSE, MJ/d</td><td>2.86 ± 0.08</td><td>2.84 ± 0.10</td><td>2.84 ± 0.10</td><td>2.30 ± 0.15</td><td>1.15 ± 0.12</td><td>1.73 ± 0.18</td><td>1.85 ± 0.16</td><td><strong>0.91 ± 0.02</strong></td><td>1.37 ± 0.09</td></tr><tr><td>MAPE, %</td><td>6.39 ± 0.23</td><td>6.32 ± 0.28</td><td>6.31 ± 0.28</td><td>4.93 ± 0.33</td><td>2.25 ± 0.26</td><td>3.39 ± 0.43</td><td>3.46 ± 0.36</td><td><strong>1.55 ± 0.21</strong></td><td>2.78 ± 0.22</td></tr><tr><td>R²</td><td>0.52 ± 0.03</td><td>0.52 ± 0.03</td><td>0.52 ± 0.03</td><td>0.69 ± 0.04</td><td>0.92 ± 0.02</td><td>0.82 ± 0.04</td><td>0.80 ± 0.03</td><td><strong>0.95 ± 0.01</strong></td><td>0.89 ± 0.02</td></tr><tr><td colspan="10">Scenarios sensors without sow and housing characteristics</td></tr><tr><td colspan="10">SID Lys</td></tr><tr><td>RMSE, g/d</td><td>1.50 ± 0.29</td><td>1.49 ± 0.29</td><td>1.49 ± 0.29</td><td>1.37 ± 0.34</td><td>1.13 ± 0.47</td><td>1.18 ± 0.44</td><td>1.22 ± 0.42</td><td><strong>0.99 ± 0.58</strong></td><td>1.13 ± 0.46</td></tr><tr><td>MAPE, %</td><td>13.29 ± 3.16</td><td>13.25 ± 3.14</td><td>13.26 ± 3.16</td><td>12.22 ± 3.47</td><td>9.76 ± 4.68</td><td>9.43 ± 4.30</td><td>10.25 ± 4.42</td><td><strong>8.79 ± 5.54</strong></td><td>9.80 ± 4.53</td></tr><tr><td>R²</td><td>0.66 ± 0.12</td><td>0.67 ± 0.12</td><td>0.67 ± 0.12</td><td>0.71 ± 0.13</td><td>0.78 ± 0.14</td><td>0.77 ± 0.14</td><td>0.76 ± 0.14</td><td><strong>0.80 ± 0.15</strong></td><td>0.78 ± 0.14</td></tr><tr><td colspan="10">ME</td></tr><tr><td>RMSE, MJ/d</td><td>3.44 ± 0.36</td><td>3.43 ± 0.37</td><td>3.43 ± 0.38</td><td>3.11 ± 0.43</td><td>2.36 ± 0.72</td><td>2.70 ± 0.55</td><td>2.68 ± 0.49</td><td><strong>2.29 ± 0.80</strong></td><td>2.52 ± 0.63</td></tr><tr><td>MAPE, %</td><td>7.76 ± 0.89</td><td>7.73 ± 0.94</td><td>7.73 ± 0.94</td><td>6.91 ± 1.05</td><td>5.17 ± 1.82</td><td>5.76 ± 1.38</td><td>5.75 ± 1.42</td><td><strong>4.99 ± 2.03</strong></td><td>5.56 ± 1.55</td></tr><tr><td>R²</td><td>0.29 ± 0.14</td><td>0.30 ± 0.14</td><td>0.29 ± 0.14</td><td>0.42 ± 0.15</td><td>0.64 ± 0.18</td><td>0.55 ± 0.16</td><td>0.56 ± 0.15</td><td><strong>0.65 ± 0.19</strong></td><td>0.60 ± 0.17</td></tr></tbody></table>

LR, linear regression; LASSO, linear regression with a LASSO regularization, RIDGE, linear regression with a RIDGE regularization, PR, polynomial regression, SVR, support vector machine for regression, RF, random forest, KNN, k-nearest-neighbors, GTB, gradient tree boosting, MLP, multilayer perceptron.

Bold values indicate the best result of prediction on the table.

<figure><img src="image_6.png" /><figcaption>**Figure 3.** Evaluation of the 11 scenarios with sow and housing characteristics: R² scores for SID Lys prediction, according to the 9 algorithms evaluated, with 1 or 2 sensor(s).</figcaption></figure>
<table><caption>**Table 6:** Prediction performances (RMSE, MAPE, R²) of metabolizable energy (ME) and standard ileal digestible lysine (SID Lys) per algorithm (as a mean value ± SD of the 22 scenarios with or without sow and housing characteristics)</caption><thead><tr><th></th><th>LR</th><th>LASSO</th><th>RIDGE</th><th>PR</th><th>RF</th><th>SVR</th><th>KNN</th><th>GTB</th><th>MLP</th></tr></thead><tbody><tr><td colspan="10">Scenario sensors with sow and housing characteristics</td></tr><tr><td colspan="10">SID Lys</td></tr><tr><td>RMSE, g/d</td><td>1.09 ± 0.03</td><td>1.09 ± 0.03</td><td>1.09 ± 0.03</td><td>0.86 ± 0.05</td><td>0.44 ± 0.12</td><td>0.51 ± 0.12</td><td>0.65 ± 0.12</td><td><strong>0.12 ± 0.04</strong></td><td>0.48 ± 0.07</td></tr><tr><td>MAPE, %</td><td>9.15 ± 0.33</td><td>9.15 ± 0.32</td><td>9.15 ± 0.32</td><td>7.09 ± 0.53</td><td>3.22 ± 0.94</td><td>3.19 ± 0.83</td><td>4.53 ± 0.93</td><td><strong>0.82 ± 0.18</strong></td><td>3.56 ± 0.51</td></tr><tr><td>R²</td><td>0.83 ± 0.01</td><td>0.83 ± 0.01</td><td>0.83 ± 0.01</td><td>0.89 ± 0.01</td><td>0.97 ± 0.02</td><td>0.96 ± 0.02</td><td>0.94 ± 0.02</td><td><strong>0.99 ± 0.01</strong></td><td>0.97 ± 0.01</td></tr><tr><td colspan="10">ME</td></tr><tr><td>RMSE, MJ/d</td><td>2.86 ± 0.08</td><td>2.84 ± 0.10</td><td>2.84 ± 0.10</td><td>2.30 ± 0.15</td><td>1.15 ± 0.12</td><td>1.73 ± 0.18</td><td>1.85 ± 0.16</td><td><strong>0.91 ± 0.02</strong></td><td>1.37 ± 0.09</td></tr><tr><td>MAPE, %</td><td>6.39 ± 0.23</td><td>6.32 ± 0.28</td><td>6.31 ± 0.28</td><td>4.93 ± 0.33</td><td>2.25 ± 0.26</td><td>3.39 ± 0.43</td><td>3.46 ± 0.36</td><td><strong>1.55 ± 0.21</strong></td><td>2.78 ± 0.22</td></tr><tr><td>R²</td><td>0.52 ± 0.03</td><td>0.52 ± 0.03</td><td>0.52 ± 0.03</td><td>0.69 ± 0.04</td><td>0.92 ± 0.02</td><td>0.82 ± 0.04</td><td>0.80 ± 0.03</td><td><strong>0.95 ± 0.01</strong></td><td>0.89 ± 0.02</td></tr><tr><td colspan="10">Scenarios sensors without sow and housing characteristics</td></tr><tr><td colspan="10">SID Lys</td></tr><tr><td>RMSE, g/d</td><td>1.50 ± 0.29</td><td>1.49 ± 0.29</td><td>1.49 ± 0.29</td><td>1.37 ± 0.34</td><td>1.13 ± 0.47</td><td>1.18 ± 0.44</td><td>1.22 ± 0.42</td><td><strong>0.99 ± 0.58</strong></td><td>1.13 ± 0.46</td></tr><tr><td>MAPE, %</td><td>13.29 ± 3.16</td><td>13.25 ± 3.14</td><td>13.26 ± 3.16</td><td>12.22 ± 3.47</td><td>9.76 ± 4.68</td><td>9.43 ± 4.30</td><td>10.25 ± 4.42</td><td><strong>8.79 ± 5.54</strong></td><td>9.80 ± 4.53</td></tr><tr><td>R²</td><td>0.66 ± 0.12</td><td>0.67 ± 0.12</td><td>0.67 ± 0.12</td><td>0.71 ± 0.13</td><td>0.78 ± 0.14</td><td>0.77 ± 0.14</td><td>0.76 ± 0.14</td><td><strong>0.80 ± 0.15</strong></td><td>0.78 ± 0.14</td></tr><tr><td colspan="10">ME</td></tr><tr><td>RMSE, MJ/d</td><td>3.44 ± 0.36</td><td>3.43 ± 0.37</td><td>3.43 ± 0.38</td><td>3.11 ± 0.43</td><td>2.36 ± 0.72</td><td>2.70 ± 0.55</td><td>2.68 ± 0.49</td><td><strong>2.29 ± 0.80</strong></td><td>2.52 ± 0.63</td></tr><tr><td>MAPE, %</td><td>7.76 ± 0.89</td><td>7.73 ± 0.94</td><td>7.73 ± 0.94</td><td>6.91 ± 1.05</td><td>5.17 ± 1.82</td><td>5.76 ± 1.38</td><td>5.75 ± 1.42</td><td><strong>4.99 ± 2.03</strong></td><td>5.56 ± 1.55</td></tr><tr><td>R²</td><td>0.29 ± 0.14</td><td>0.30 ± 0.14</td><td>0.29 ± 0.14</td><td>0.42 ± 0.15</td><td>0.64 ± 0.18</td><td>0.55 ± 0.16</td><td>0.56 ± 0.15</td><td><strong>0.65 ± 0.19</strong></td><td>0.60 ± 0.17</td></tr></tbody></table>

LR, linear regression; LASSO, linear regression with a LASSO regularization, RIDGE, linear regression with a RIDGE regularization, PR, polynomial regression, SVR, support vector machine for regression, RF, random forest, KNN, k-nearest-neighbors, GTB, gradient tree boosting, MLP, multilayer perceptron.

Bold values indicate the best result of prediction on the table.

<figure><img src="image_6.png" /><figcaption>**Figure 3.** Evaluation of the 11 scenarios with sow and housing characteristics: R² scores for SID Lys prediction, according to the 9 algorithms evaluated, with 1 or 2 sensor(s).</figcaption></figure>
<figure><img src="image_7.png" /><figcaption>**Figure 4.** Evaluation of the 11 scenarios with sow and housing characteristics: R² scores for ME prediction, according to the 9 algorithms evaluated, with 1 or 2 sensor(s).</figcaption></figure>

<figure><img src="image_8.png" /><figcaption>**Figure 5.** Ablation study: MAPE values (%) of GTB for standard ileal digestible lysine (SID Lys) and for metabolizable energy (ME) according to the all the features excluded from scenario 1 (feeder data) with sow and housing characteristics.</figcaption></figure>

of gestating sows is possible using data measured by sensors and machine-learning methods. Moreover, in the case of two sensors, the prediction was conducted without requiring information on sow characteristics (such as their farrowing performance), which allows the integration of new sows into the herd for future application. A simple application of precision farming at an individual level in farms equipped with sensors or automatons is possible, despite using a complex mechanistic model that requires several data inputs and a prediction of farrowing performances (based on historical

data). Such use of only one or two sensors, already used for other tasks on the farm, paves the way for a 'Green Artificial Intelligence' (Ferrag et al., 2020; Sharma et al., 2022). Sensors could be expensive for farmers, but also expensive in terms of valuable metal resources with complicated recycling processes, therefore optimizing the use of existing on-farm sensors is relevant. In addition, the nutrition prediction algorithms used in this work consume little energy, with no need for the cloud or internet, and could be run on any basic computer available on a farm.
<figure><img src="image_7.png" /><figcaption>**Figure 4.** Evaluation of the 11 scenarios with sow and housing characteristics: R² scores for ME prediction, according to the 9 algorithms evaluated, with 1 or 2 sensor(s).</figcaption></figure>

<figure><img src="image_8.png" /><figcaption>**Figure 5.** Ablation study: MAPE values (%) of GTB for standard ileal digestible lysine (SID Lys) and for metabolizable energy (ME) according to the all the features excluded from scenario 1 (feeder data) with sow and housing characteristics.</figcaption></figure>

of gestating sows is possible using data measured by sensors and machine-learning methods. Moreover, in the case of two sensors, the prediction was conducted without requiring information on sow characteristics (such as their farrowing performance), which allows the integration of new sows into the herd for future application. A simple application of precision farming at an individual level in farms equipped with sensors or automatons is possible, despite using a complex mechanistic model that requires several data inputs and a prediction of farrowing performances (based on historical

data). Such use of only one or two sensors, already used for other tasks on the farm, paves the way for a 'Green Artificial Intelligence' (Ferrag et al., 2020; Sharma et al., 2022). Sensors could be expensive for farmers, but also expensive in terms of valuable metal resources with complicated recycling processes, therefore optimizing the use of existing on-farm sensors is relevant. In addition, the nutrition prediction algorithms used in this work consume little energy, with no need for the cloud or internet, and could be run on any basic computer available on a farm.
The learning process was based on the outputs of the InraPorc model (Dourmad et al., 2008) modified by Gaillard et al. (2020a) for gestating sows. This model was set up thanks to numerous validated equations determined by invasive measures such as the metabolic chamber. The use of these techniques is increasingly limited in research, which reinforces the use of models such as this one. However, the question of genetic progress and its possible impact on these equations, determined several decades ago, could be raised. In this case, the model will be improved, or the learning process will have to be carried out again to predict other nutrient requirements (e.g., mineral requirements).

## Different prediction results due to diverse digital farm configurations

The overall results showed that the feeder alone (scenario 1) or combined with other sensors (such as body weight scales) gave higher performance results for predicting ME or SID Lys. The diurnal pattern of sow physical activity (especially the time spent in a standing position) was linked to the daily feeding behavior pattern and meal schedule (Haskell et al., 2000; Chapinal et al., 2010). This feeding behavior could thus be used as a proxy of the time spent in a standing position, a key predictor of daily requirements in ME (Gaillard et al., 2019). The importance of the time spent eating (for feeding visits) on the best model was shown by the ablation study results. The lysine requirement of the model was calculated based on body weight and parity (Gaillard et al., 2019). In fact, Lanthony et al. (2022) showed that the feeder order could be an indicator of dominance hierarchy, which is linked to parity (or sow age) and body weight. That is why combined feeder data and daily body weight had approximately the same level of prediction performances with scenarios with or without sow and housing characteristics. This dominance hierarchy was also shown in the ablation study as a principal component of the best prediction model for lysine.

Moreover, the electronic feeder (best sensor performance) may possibly use precision feeding, which could decrease feed costs by $3.67 per gestation (Gaillard et al., 2020a). A renovation of gestation rooms from individual stalls into a group pen with electronic feeder costs between $108 and 210 (Turcotte, 2015). The return on investment was estimated as being between 9 and 18 yr.

Scenario 3i, which included individual activity measures, gave a better performance for SID Lys than a prediction based on group data (scenario 3g). This could be explained by the fact that the group activity values were considered to be the same for primiparous and multiparous sows (one value for all the sows within a group), while other studies showed that there was a difference in activity between parities (Chapinal et al., 2010), as with the accelerometer in this study. However, this difference was slight for ME, which is relatively surprising. However, the group activity measures give more detailed information than individual measures, with the ventral and lateral lying positions, and the drinking and eating activities. This lateral/ventral lying behavior is linked to thermoregulation mechanisms (Geers, 2007). Therefore, room temperature could affect nutrient and energy requirements (Gaillard et al., 2021), as also shown in the ablation study (MAPE values increased by 0.21% without it). An improvement of the individual level with more details on activity may thus improve prediction performances.

## Importance of sow and housing characteristics for prediction

Including sow and housing characteristics are relevant when only one sensor or automaton is available on the farm. It will give more accurate prediction results. When two sensors are used for prediction, these characteristics are not needed, and even decrease the prediction performance. These variables were also inputs of the model due to their impact on the calculation of requirements. The ‘Day of gestation’ variable had an effect on prediction, as the requirements for energy and lysine (showed with the ablation study) increased during gestation due to the fetus’s growth (Trottier et al., 2015). Despite the scenario or algorithm chosen, this variable had to be included in the dataset for prediction. The ‘Backfat thickness’ and ‘Body Weight’ variables at insemination were also important predictors because they are indicators of the body’s reserves status before gestation, and the calculation of requirements was based on this information (Gaillard et al., 2019). Real-time technology for measuring this feature would also be a good scenario to test in terms of prediction, as detailed in the study of Fernandes et al. (2020).

## Different prediction results due to various supervised algorithms

The most accurate algorithms were GTB and RF followed by MLP ($R^2$ = 0.97 to 0.99 for SID Lys and 0.89 to 0.95 for ME, for scenarios with sow and housing characteristics). The GTB, RF, or MLP machine-learning algorithms were also used in some studies, with good results. For instance, Kleanthous et al. (2018) obtained good performances with RF, GTB, and MLP algorithms (especially with RF, accuracy = 96%) to classify livestock behavior, based on accelerometer data. Moreover, training GBT and RF models can be computationally expensive and time-consuming. GBT models have several hyperparameters that need to be tuned and are sensitive to noisy data. Despite these limitations, these techniques are widely used and highly effective in various machine learning applications due to their higher performances, simplicity, and interpretability (Schapire, 1999; Breiman, 2001; Valetta et al., 2017). Their interpretability may be a key determinant of the adoption of these algorithms for users in non-informatics domains, such as animal nutritionists or breeders. For example, with a particularly low amount of ME requirements, farmers may need to check why the algorithm gave this specific value and increase their trust in the system used.

The algorithms of linear regression (LR, LASSO, and RIDGE) obtained the worst prediction performances ($R^2$ = 0.83 for SID Lys and 0.52 for ME, for scenarios with sow and housing characteristics), which means that the relationship between predictors and nutrient requirements was not linear. Misiura et al. (2021) also obtained accurate results with a non-linear model compared to a linear model for precision feeding for growing-finishing pigs, by predicting feed intake and growth. The prediction of the body weight of piglets at 30 d had a MAPE value of 11.0% with the linear model, and 2.1% with the allometric model.

## Conclusion

This study showed that using machine-learning methods on behavioral data to predict the daily nutrient requirements of sows is possible and accurate. Among the different digital
The learning process was based on the outputs of the InraPorc model (Dourmad et al., 2008) modified by Gaillard et al. (2020a) for gestating sows. This model was set up thanks to numerous validated equations determined by invasive measures such as the metabolic chamber. The use of these techniques is increasingly limited in research, which reinforces the use of models such as this one. However, the question of genetic progress and its possible impact on these equations, determined several decades ago, could be raised. In this case, the model will be improved, or the learning process will have to be carried out again to predict other nutrient requirements (e.g., mineral requirements).

## Different prediction results due to diverse digital farm configurations

The overall results showed that the feeder alone (scenario 1) or combined with other sensors (such as body weight scales) gave higher performance results for predicting ME or SID Lys. The diurnal pattern of sow physical activity (especially the time spent in a standing position) was linked to the daily feeding behavior pattern and meal schedule (Haskell et al., 2000; Chapinal et al., 2010). This feeding behavior could thus be used as a proxy of the time spent in a standing position, a key predictor of daily requirements in ME (Gaillard et al., 2019). The importance of the time spent eating (for feeding visits) on the best model was shown by the ablation study results. The lysine requirement of the model was calculated based on body weight and parity (Gaillard et al., 2019). In fact, Lanthony et al. (2022) showed that the feeder order could be an indicator of dominance hierarchy, which is linked to parity (or sow age) and body weight. That is why combined feeder data and daily body weight had approximately the same level of prediction performances with scenarios with or without sow and housing characteristics. This dominance hierarchy was also shown in the ablation study as a principal component of the best prediction model for lysine.

Moreover, the electronic feeder (best sensor performance) may possibly use precision feeding, which could decrease feed costs by $3.67 per gestation (Gaillard et al., 2020a). A renovation of gestation rooms from individual stalls into a group pen with electronic feeder costs between $108 and 210 (Turcotte, 2015). The return on investment was estimated as being between 9 and 18 yr.

Scenario 3i, which included individual activity measures, gave a better performance for SID Lys than a prediction based on group data (scenario 3g). This could be explained by the fact that the group activity values were considered to be the same for primiparous and multiparous sows (one value for all the sows within a group), while other studies showed that there was a difference in activity between parities (Chapinal et al., 2010), as with the accelerometer in this study. However, this difference was slight for ME, which is relatively surprising. However, the group activity measures give more detailed information than individual measures, with the ventral and lateral lying positions, and the drinking and eating activities. This lateral/ventral lying behavior is linked to thermoregulation mechanisms (Geers, 2007). Therefore, room temperature could affect nutrient and energy requirements (Gaillard et al., 2021), as also shown in the ablation study (MAPE values increased by 0.21% without it). An improvement of the individual level with more details on activity may thus improve prediction performances.

## Importance of sow and housing characteristics for prediction

Including sow and housing characteristics are relevant when only one sensor or automaton is available on the farm. It will give more accurate prediction results. When two sensors are used for prediction, these characteristics are not needed, and even decrease the prediction performance. These variables were also inputs of the model due to their impact on the calculation of requirements. The ‘Day of gestation’ variable had an effect on prediction, as the requirements for energy and lysine (showed with the ablation study) increased during gestation due to the fetus’s growth (Trottier et al., 2015). Despite the scenario or algorithm chosen, this variable had to be included in the dataset for prediction. The ‘Backfat thickness’ and ‘Body Weight’ variables at insemination were also important predictors because they are indicators of the body’s reserves status before gestation, and the calculation of requirements was based on this information (Gaillard et al., 2019). Real-time technology for measuring this feature would also be a good scenario to test in terms of prediction, as detailed in the study of Fernandes et al. (2020).

## Different prediction results due to various supervised algorithms

The most accurate algorithms were GTB and RF followed by MLP ($R^2$ = 0.97 to 0.99 for SID Lys and 0.89 to 0.95 for ME, for scenarios with sow and housing characteristics). The GTB, RF, or MLP machine-learning algorithms were also used in some studies, with good results. For instance, Kleanthous et al. (2018) obtained good performances with RF, GTB, and MLP algorithms (especially with RF, accuracy = 96%) to classify livestock behavior, based on accelerometer data. Moreover, training GBT and RF models can be computationally expensive and time-consuming. GBT models have several hyperparameters that need to be tuned and are sensitive to noisy data. Despite these limitations, these techniques are widely used and highly effective in various machine learning applications due to their higher performances, simplicity, and interpretability (Schapire, 1999; Breiman, 2001; Valetta et al., 2017). Their interpretability may be a key determinant of the adoption of these algorithms for users in non-informatics domains, such as animal nutritionists or breeders. For example, with a particularly low amount of ME requirements, farmers may need to check why the algorithm gave this specific value and increase their trust in the system used.

The algorithms of linear regression (LR, LASSO, and RIDGE) obtained the worst prediction performances ($R^2$ = 0.83 for SID Lys and 0.52 for ME, for scenarios with sow and housing characteristics), which means that the relationship between predictors and nutrient requirements was not linear. Misiura et al. (2021) also obtained accurate results with a non-linear model compared to a linear model for precision feeding for growing-finishing pigs, by predicting feed intake and growth. The prediction of the body weight of piglets at 30 d had a MAPE value of 11.0% with the linear model, and 2.1% with the allometric model.

## Conclusion

This study showed that using machine-learning methods on behavioral data to predict the daily nutrient requirements of sows is possible and accurate. Among the different digital
farm configurations tested, the feeder data (alone or combined with another sensor) obtained better performances for predicting ME and for standard ileal digestible lysine. The inclusion of sow and housing characteristics in the sensor data improves prediction performance. However, the two pieces of equipment combined without these characteristics obtained the same level of performance as the one obtained using data from one equipment and these characteristics. When the linear regression models obtained the worst accuracy and highest prediction error, the GTB, RF, and MLP obtained high prediction performances. This study paves the way for an easier application of precision feeding on farms with available sensors.

## Acknowledgments

This work was supported by the French National Research Agency under the investments for the future Program [ANR-16-CONV-0001 (#DIGITAG)] and the department PHASE of INRAE.

## Conflict of Interest Statement

The authors disclose any actual or potential conflicts of interest that may affect their ability to objectively present or review research or data.

## Literature Cited

Berckmans, D. 2017. General introduction to precision livestock farming. Anim. Front. 7:6–11. doi:10.2527/af.2017.0102

Breiman, L. 2001. Random forests. Mach. Learn. 45:5–32. doi:10.1023/A:1010933404324

Chapinal, N., J. L. Ruiz de la Torre, A. Cerisuelo, J. Gasa, M. D. Baucells, J. Coma, A. Vidal, and X. Manteca. 2010. Evaluation of welfare and productivity in pregnant sows kept in stalls or in 2 different group housing systems. J. Vet. Behav. 5:82–93. doi:10.1016/j.jveb.2009.09.046

Cooper, D. R., J. F. Patience, R. T. Zijlstra, and M. Rademacher. 2001. Effect of energy and lysine intake in gestation on sow performance. J. Anim. Sci. 79:2367–2377. doi:10.2527/2001.7992367x

Dourmad, J. Y., M. Etienne, A. Valancogne, S. Dubois, J. van Milgen, and J. Noblet. 2008. InraPorc: a model and decision support tool for the nutrition of sows. Anim. Feed Sci. Technol. 143:372–386. doi:10.1016/j.anifeedsci.2007.05.019

Durand, M., M. Simon, J. Foisil, J. Y. Dourmad, C. Largouët, and C. Gaillard. 2021. Evaluation of the physical activity of a group of gestating sows using an artificial neural network. In: Book of Abstracts of the 73rd Annual Meeting of the European Association of Animal Production, Porto, Portugal: Wageningen Academic publishers; p. 455. doi:10.3920/978-90-8686-937-4

Durand, M., C. Largouët, L. Bonneau, J. Y. Dourmad, and C. Gaillard. 2023. A dataset to study group-housed sows' individual behaviours and production responses to different short-term events. Anim. Open Space. 2:100039. doi:10.1016/j.anopes.2023.100039

Fernandes, A. F. A., J. R. R. Dorea, B. Dourado Valente, R. Fitzgerald, W. Herring, and G. J. M. Rosa. 2020. Comparison of data analytics strategies in computer vision systems to predict pig body composition traits from 3D images. J. Anim. Sci. 98:1–9. doi:10.1093/jas/skaa250

Ferrag, M. A., L. Shu, X. Yang, A. Derhab, and L. Maglaras. 2020. Security and privacy for Green IoT-based agriculture: review, blockchain solutions, and challenges. IEEE Access 8:32031–32053. doi:10.1109/access.2020.2973178

Gaillard, C., and J. Y. Dourmad. 2022. Application of a precision feeding strategy for gestating sows. Anim. Feed Sci. Technol. 287:115280. doi:10.1016/j.anifeedsci.2022.115280

Gaillard, C., R. Gauthier, L. Cloutier, and J. Y. Dourmad. 2019. Exploration of individual variability to better predict the nutrient requirements of gestating sows. J. Anim. Sci. 97:4934–4945. doi:10.1093/jas/szk320

Gaillard, C., N. Quiniou, R. Gauthier, L. Cloutier, and J. Y. Dourmad. 2020a. Evaluation of a decision support system for precision feeding of gestating sows. J. Anim. Sci. 98:1–12. doi:10.1093/jas/skaa255

Gaillard, C., L. Brossard, and J. Y. Dourmad. 2020b. Improvement of feed and nutrient efficiency in pig production through precision feeding. Anim. Feed Sci. Technol. 268:114611. doi:10.1016/j.anifeedsci.2020.114611

Gaillard, C., M. Durand, C. Largouët, J. Y. Dourmad, and C. Tallet. 2021. Effects of the environment and animal behavior on nutrient requirements for gestating sows: future improvements in precision feeding. Anim. Feed Sci. Technol. 279:115034. doi:10.1016/j.anifeedsci.2021.115034

Galaz, V., M. A. Centeno, P. W. Callahan, A. Causevic, T. Patterson, I. Brass, S. Baum, D. Farber, J. Fischer, D. Garcia, et al. 2021. Artificial intelligence, systemic risks, and sustainability. Technol. Soc. 67:101741. doi:10.1016/j.techsoc.2021.101741

Geers, R. 2007. Lying behaviour (location, posture and duration). In: A. Velarde, R. Geers, editors. On farm monitoring of pig welfare. Wageningen, The Netherlands: Wageningen Academic Publishers; p. 19–23. doi:10.3920/978-90-8686-591-8

Géron, A. 2019. Hands-on machine learning with Scikit-Learn, Keras, and TensorFlow: concepts, tools, and techniques to build intelligent systems. Sebastopol, CA: O'Reilly Media.

Hansen, A. V, A. B. Strathe, P. K. Theil, and E. Kebreab. 2014. Energy and nutrient deposition and excretion in the reproducing sow: model development and evaluation. J. Anim. Sci. 92:2458–2472. doi:10.2527/jas.2013-6540

Haskell, M. J., M. T. Mendl, A. B. Lawrence, and E. Austin. 2000. The effect of delayed feeding on the post-feeding behaviour of sows. Behav. Process. 49:85–97. doi:10.1016/s0376-6357(00)00077-2

He, Y., F. Tiezzi, J. Howard, and C. Maltecca. 2021. Predicting body weight in growing pigs from feeding behavior data using machine learning algorithms. Comput. Electron. Agric. 184:106085. doi:10.1016/j.compag.2021.106085

Kleanthous, N., A. Hussain, A. Mason, J. Sneddon, A. Shaw, P. Fergus, P. Chalmers, and D. Al-Jumeily. 2018. Machine learning techniques for classification of livestock behavior. In: ICONIP 2018: Neural Information Processing, Cambodia: Siem Reap; p. 304–315. doi:10.1007/978-3-030-04212-7_26

Lanthony, M., M. Danglot, M. Spinka, and C. Tallet. 2022. Dominance hierarchy in groups of pregnant sows: characteristics and identification of related indicators. Appl. Anim. Behav. Sci. 254:105683. doi:10.1016/j.applanim.2022.105683

Llonch, P., S. Neethirajan, and C. Morgan-Davies. 2022. Editorial: understanding animals' phenotype through automatic behavior assessment. Front. Anim. Sci. 3:1069387. doi:10.3389/fanim.2022.1069387

Mahfuz, S., H. S. Mun, M. A. Dilawar, and C. J. Yang. 2022. Applications of smart technology as a sustainable strategy in modern swine farming. Sustainability. 14:2607. doi:10.3390/su14052607

Misiura, M. M., J. A. N. Filipe, L. Brossard, and I. Kyriazakis. 2021. Bayesian comparison of models for precision feeding and management in growing-finishing pigs. Biosyst. Eng. 211:205–218. doi:10.1016/j.biosystemseng.2021.08.027

Neethirajan, S. 2020. The role of sensors, big data and machine learning in modern animal farming. Sens. Bio-Sens. Res. 29:100367. doi:10.1016/j.sbsr.2020.100367

Ollagnier, C., C. Kasper, A. Wallenbeck, L. Keeling, G. Bee, and S. A. Bigdeli. 2023. Machine learning algorithms can predict tail biting outbreaks in pigs using feeding behaviour records. PLoS One 18:e0252002. doi:10.1371/journal.pone.0252002

Pedregosa, F., G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, et al. 2011. Scikit-learn: machine learning in Python. J. Machine Learn. Res. 12:2825–2830
farm configurations tested, the feeder data (alone or combined with another sensor) obtained better performances for predicting ME and for standard ileal digestible lysine. The inclusion of sow and housing characteristics in the sensor data improves prediction performance. However, the two pieces of equipment combined without these characteristics obtained the same level of performance as the one obtained using data from one equipment and these characteristics. When the linear regression models obtained the worst accuracy and highest prediction error, the GTB, RF, and MLP obtained high prediction performances. This study paves the way for an easier application of precision feeding on farms with available sensors.

## Acknowledgments

This work was supported by the French National Research Agency under the investments for the future Program [ANR-16-CONV-0001 (#DIGITAG)] and the department PHASE of INRAE.

## Conflict of Interest Statement

The authors disclose any actual or potential conflicts of interest that may affect their ability to objectively present or review research or data.

## Literature Cited

Berckmans, D. 2017. General introduction to precision livestock farming. Anim. Front. 7:6–11. doi:10.2527/af.2017.0102

Breiman, L. 2001. Random forests. Mach. Learn. 45:5–32. doi:10.1023/A:1010933404324

Chapinal, N., J. L. Ruiz de la Torre, A. Cerisuelo, J. Gasa, M. D. Baucells, J. Coma, A. Vidal, and X. Manteca. 2010. Evaluation of welfare and productivity in pregnant sows kept in stalls or in 2 different group housing systems. J. Vet. Behav. 5:82–93. doi:10.1016/j.jveb.2009.09.046

Cooper, D. R., J. F. Patience, R. T. Zijlstra, and M. Rademacher. 2001. Effect of energy and lysine intake in gestation on sow performance. J. Anim. Sci. 79:2367–2377. doi:10.2527/2001.7992367x

Dourmad, J. Y., M. Etienne, A. Valancogne, S. Dubois, J. van Milgen, and J. Noblet. 2008. InraPorc: a model and decision support tool for the nutrition of sows. Anim. Feed Sci. Technol. 143:372–386. doi:10.1016/j.anifeedsci.2007.05.019

Durand, M., M. Simon, J. Foisil, J. Y. Dourmad, C. Largouët, and C. Gaillard. 2021. Evaluation of the physical activity of a group of gestating sows using an artificial neural network. In: Book of Abstracts of the 73rd Annual Meeting of the European Association of Animal Production, Porto, Portugal: Wageningen Academic publishers; p. 455. doi:10.3920/978-90-8686-937-4

Durand, M., C. Largouët, L. Bonneau, J. Y. Dourmad, and C. Gaillard. 2023. A dataset to study group-housed sows' individual behaviours and production responses to different short-term events. Anim. Open Space. 2:100039. doi:10.1016/j.anopes.2023.100039

Fernandes, A. F. A., J. R. R. Dorea, B. Dourado Valente, R. Fitzgerald, W. Herring, and G. J. M. Rosa. 2020. Comparison of data analytics strategies in computer vision systems to predict pig body composition traits from 3D images. J. Anim. Sci. 98:1–9. doi:10.1093/jas/skaa250

Ferrag, M. A., L. Shu, X. Yang, A. Derhab, and L. Maglaras. 2020. Security and privacy for Green IoT-based agriculture: review, blockchain solutions, and challenges. IEEE Access 8:32031–32053. doi:10.1109/access.2020.2973178

Gaillard, C., and J. Y. Dourmad. 2022. Application of a precision feeding strategy for gestating sows. Anim. Feed Sci. Technol. 287:115280. doi:10.1016/j.anifeedsci.2022.115280

Gaillard, C., R. Gauthier, L. Cloutier, and J. Y. Dourmad. 2019. Exploration of individual variability to better predict the nutrient requirements of gestating sows. J. Anim. Sci. 97:4934–4945. doi:10.1093/jas/szk320

Gaillard, C., N. Quiniou, R. Gauthier, L. Cloutier, and J. Y. Dourmad. 2020a. Evaluation of a decision support system for precision feeding of gestating sows. J. Anim. Sci. 98:1–12. doi:10.1093/jas/skaa255

Gaillard, C., L. Brossard, and J. Y. Dourmad. 2020b. Improvement of feed and nutrient efficiency in pig production through precision feeding. Anim. Feed Sci. Technol. 268:114611. doi:10.1016/j.anifeedsci.2020.114611

Gaillard, C., M. Durand, C. Largouët, J. Y. Dourmad, and C. Tallet. 2021. Effects of the environment and animal behavior on nutrient requirements for gestating sows: future improvements in precision feeding. Anim. Feed Sci. Technol. 279:115034. doi:10.1016/j.anifeedsci.2021.115034

Galaz, V., M. A. Centeno, P. W. Callahan, A. Causevic, T. Patterson, I. Brass, S. Baum, D. Farber, J. Fischer, D. Garcia, et al. 2021. Artificial intelligence, systemic risks, and sustainability. Technol. Soc. 67:101741. doi:10.1016/j.techsoc.2021.101741

Geers, R. 2007. Lying behaviour (location, posture and duration). In: A. Velarde, R. Geers, editors. On farm monitoring of pig welfare. Wageningen, The Netherlands: Wageningen Academic Publishers; p. 19–23. doi:10.3920/978-90-8686-591-8

Géron, A. 2019. Hands-on machine learning with Scikit-Learn, Keras, and TensorFlow: concepts, tools, and techniques to build intelligent systems. Sebastopol, CA: O'Reilly Media.

Hansen, A. V, A. B. Strathe, P. K. Theil, and E. Kebreab. 2014. Energy and nutrient deposition and excretion in the reproducing sow: model development and evaluation. J. Anim. Sci. 92:2458–2472. doi:10.2527/jas.2013-6540

Haskell, M. J., M. T. Mendl, A. B. Lawrence, and E. Austin. 2000. The effect of delayed feeding on the post-feeding behaviour of sows. Behav. Process. 49:85–97. doi:10.1016/s0376-6357(00)00077-2

He, Y., F. Tiezzi, J. Howard, and C. Maltecca. 2021. Predicting body weight in growing pigs from feeding behavior data using machine learning algorithms. Comput. Electron. Agric. 184:106085. doi:10.1016/j.compag.2021.106085

Kleanthous, N., A. Hussain, A. Mason, J. Sneddon, A. Shaw, P. Fergus, P. Chalmers, and D. Al-Jumeily. 2018. Machine learning techniques for classification of livestock behavior. In: ICONIP 2018: Neural Information Processing, Cambodia: Siem Reap; p. 304–315. doi:10.1007/978-3-030-04212-7_26

Lanthony, M., M. Danglot, M. Spinka, and C. Tallet. 2022. Dominance hierarchy in groups of pregnant sows: characteristics and identification of related indicators. Appl. Anim. Behav. Sci. 254:105683. doi:10.1016/j.applanim.2022.105683

Llonch, P., S. Neethirajan, and C. Morgan-Davies. 2022. Editorial: understanding animals' phenotype through automatic behavior assessment. Front. Anim. Sci. 3:1069387. doi:10.3389/fanim.2022.1069387

Mahfuz, S., H. S. Mun, M. A. Dilawar, and C. J. Yang. 2022. Applications of smart technology as a sustainable strategy in modern swine farming. Sustainability. 14:2607. doi:10.3390/su14052607

Misiura, M. M., J. A. N. Filipe, L. Brossard, and I. Kyriazakis. 2021. Bayesian comparison of models for precision feeding and management in growing-finishing pigs. Biosyst. Eng. 211:205–218. doi:10.1016/j.biosystemseng.2021.08.027

Neethirajan, S. 2020. The role of sensors, big data and machine learning in modern animal farming. Sens. Bio-Sens. Res. 29:100367. doi:10.1016/j.sbsr.2020.100367

Ollagnier, C., C. Kasper, A. Wallenbeck, L. Keeling, G. Bee, and S. A. Bigdeli. 2023. Machine learning algorithms can predict tail biting outbreaks in pigs using feeding behaviour records. PLoS One 18:e0252002. doi:10.1371/journal.pone.0252002

Pedregosa, F., G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, et al. 2011. Scikit-learn: machine learning in Python. J. Machine Learn. Res. 12:2825–2830
Pomar, C., J. van Milgen, and A. Remus. 2019. Precision livestock feed-
ing, principle and practice. In: W.H. Hendriks, M.W.A. Verstegen,
L. Babinszky, editors, Poultry and pig nutrition. The Netherlands:
Wageningen Academic Publishers; p. 397–418 doi:10.3920/978-
90-8686-884-1_18

Quiniou, N. 2021. Results of 15 years of precision feeding of hy-
per prolific gestating sows. Animals. 11:2908. doi:10.3390/
ani11102908

Sauvant, D., J. M. Perez, and G. Tran. 2004. Tables INRA-AFZ de com-
position et de valeur nutritive des matières premières destinées aux
animaux d'élevage: 2ème édition. France: INRA Editions Versailles

Schapire, R. E. 1999. A brief introduction to boosting. In: Proceedings of the IJCAI International Joint Conference on Artificial Intelligence, Volume 2, Stockholm, Sweden, p. 1401–1406

Sharma, A., M. Georgi, M. Tregubenko, A. Tselykh, and A. Tselykh. 2022. Enabling smart agriculture by implementing artificial intel-

ligence and embedded sensing. Comput. Ind. Eng. 165:107936.
doi:10.1016/j.cie.2022.107936

Siegford, J., and O. Guzhva. 2021. Editorial: Integration of ethical and social aspects into precision livestock farming-achieving real-world impact responsibly. Front. Anim. Sci. 2:780334. doi:10.3389/fanim.2021.780334

Trottier, N. L., L. J. Johnston, and C. F. M. de Lange. 2015. Applied amino acid and energy feeding of sows. In: C. Farmer, editor. The gestating and lactating sows. The Netherlands: Wageningen Academic Publishers; p. 117–145

Turcotte, S. 2015. Truies en groupe : l'expérience québécoise. Porc Québec, 26-38. https://www.cdpq.ca/cdpq.ca/files/65/652e0ea3-fca1-454a-9be6-de95645b0451.pdf

Valletta, J. J., C. Torney, M. Kings, A. Thornton, and J. Madden. 2017. Applications of machine learning in animal behaviour studies. Anim. Behav. 124:203–220. doi:10.1016/j.anbehav.2016.12.005
Pomar, C., J. van Milgen, and A. Remus. 2019. Precision livestock feed-
ing, principle and practice. In: W.H. Hendriks, M.W.A. Verstegen,
L. Babinszky, editors, Poultry and pig nutrition. The Netherlands:
Wageningen Academic Publishers; p. 397–418 doi:10.3920/978-
90-8686-884-1_18

Quiniou, N. 2021. Results of 15 years of precision feeding of hy-
per prolific gestating sows. Animals. 11:2908. doi:10.3390/
ani11102908

Sauvant, D., J. M. Perez, and G. Tran. 2004. Tables INRA-AFZ de com-
position et de valeur nutritive des matières premières destinées aux
animaux d'élevage: 2ème édition. France: INRA Editions Versailles

Schapire, R. E. 1999. A brief introduction to boosting. In: Proceedings of the IJCAI International Joint Conference on Artificial Intelligence, Volume 2, Stockholm, Sweden, p. 1401–1406

Sharma, A., M. Georgi, M. Tregubenko, A. Tselykh, and A. Tselykh. 2022. Enabling smart agriculture by implementing artificial intel-

ligence and embedded sensing. Comput. Ind. Eng. 165:107936.
doi:10.1016/j.cie.2022.107936

Siegford, J., and O. Guzhva. 2021. Editorial: Integration of ethical and social aspects into precision livestock farming-achieving real-world impact responsibly. Front. Anim. Sci. 2:780334. doi:10.3389/fanim.2021.780334

Trottier, N. L., L. J. Johnston, and C. F. M. de Lange. 2015. Applied amino acid and energy feeding of sows. In: C. Farmer, editor. The gestating and lactating sows. The Netherlands: Wageningen Academic Publishers; p. 117–145

Turcotte, S. 2015. Truies en groupe : l'expérience québécoise. Porc Québec, 26-38. https://www.cdpq.ca/cdpq.ca/files/65/652e0ea3-fca1-454a-9be6-de95645b0451.pdf

Valletta, J. J., C. Torney, M. Kings, A. Thornton, and J. Madden. 2017. Applications of machine learning in animal behaviour studies. Anim. Behav. 124:203–220. doi:10.1016/j.anbehav.2016.12.005