Applications of Artificial Neural Networks and Multiple Linear Regression Algorithms in Modelling of Pig’s Body Weight

Background: Experiments were conducted to analyze environmental parameters and growth-related factors to identify the most influential factors in estimating pig’s body weight (PBW) using artificial neural networks (ANNs) and multiple linear regression (MLR)-based models. Methods: Four different ANNs, including Cascade Forward Back-propagation (CFBP), Layer Recurrent (LR), Feed Forward Back-propagation (FFBP) and Elman (EL) and MLR models were developed to estimate the body weight of pigs. The current research was conducted for 92 days during the two experimental periods (2021-2022) in a pig barn. Result: The Levenberg-Marquardt training function, gradient descent weight and bias learning function, tan-sigmoid transfer function and two hidden layers with 16 neurons in each layer were shown to be the most effective architecture of the FFBP model in predicting PBW. According to the sensitivity analysis, length of pig (LP) was the most influential factor in estimating the PBW for MLR/ANN models. However, the environmental parameters along with growth-related factors could not always be the same association with PBW. Therefore, further research on viable alternative breeds with different management conditions may be considered to evaluate MLR and ANN model’s performance.


INTRODUCTION
In pig production, the weight of a pig is essential to know at a given time for several purposes, including quantifying feed supplies, identifying and prioritizing health conditions, estimating the rate of growth, space allowances, determining drug dosages, biological functions, readiness for the market etc. (Lee et al., 2020).It has been noted that timely and precise calculation of a pig's body weight (PBW ) results in profitability since feed expenses are reduced by up to 60% of overall production costs (Min et al., 2019).Additionally, it is crucial for the stockman and the company to accurately estimate the PBW before setting up procurement plans (Machebe et al., 2016) as well as for animal welfare issues which are connected to four main approaches, i.e., adequate feeding, housing, health and behaviour (Kang et al., 2022).
As PBW is one of the most crucial decision-making considerations in pig farming, it is important to know the variables that influence body weight during the growing period.To solve this issue, body weight can be estimated through related traits with more accuracy.Until now, linear regression, stepwise regression, multi-linear regression, simple correlation, path analysis, factor analysis and principal component analysis were the primary modelling techniques employed in studies on estimating PBW (Mutua et al., 2011), where a linear relationship between the measured variables and the PBW is expected.There are also some indirect methods, including Von Bertalanffy, Gompertz and logistic which provide different approaches for live weight measurement (Wu et al., 2004).Employing machine vision techniques is another indirect method for measuring PBW (Wang et al., 2008).Additionally, the threedimensional shape of pigs was extracted using the stereo photogrammetry technique to estimate their live weight (Wu et al., 2004).These techniques would decrease the number of input variables; however, they are insufficient and incomplete to demonstrate how growth performance parameters, surrounding environmental conditions and the PBW interact.They might be unable to understand the highly nonlinear and complex relationships between body weight and other parameters.Unlike linear-b ased models, Applications of Artificial Neural Networks and Multiple Linear Regression Algorithms in Modelling of Pig's Body Weight non-linear models such as ANNs, Bayesian classification and genetic expression are acceptable when the variables under consideration have complicated and non-linear correlation (Basak et al., 2020;Basak et al., 2022).It has been noted that non-linear methods accurately interpret variable relationship and are better able to predict output variables than linear-based approaches (Basak et al., 2022).
In agricultural sectors, ANNs models are frequently employed to estimate crop yields, including wheat, corn, soybean, potato, barley and others (Zhang et al., 2003).However, a limited number of studies have been conducted in estimating PBW in relation to dietary management, growth development parameters and environmental factors using MLR and ANN models.Hence, the current experiment aimed to analyze the environmental parameters and growth-related factors to identify the most influential factors in estimating PBW using MLR and ANNs-based models and to evaluate the performance of these models.

Animal and experimental design
This study was conducted in a pig barn at Gyeongsang National University.Twenty American Yorkshire Duroc crossbreed pigs aged 10 weeks, with a preliminary weight of 29.4±0.89kg (mean±standard deviation) were used in two distinct experiments that were conducted from the 10 th of September to the 10 th of December in 2021 and 2022.Two weeks of observation were accomplished before the experiment started to observe the situation for data collection.On the first day, an individually numbered ear tag was placed in each pig's ear, for identification.Feed was given in equal quantities twice a day at 9:30 a.m. and 16:30 p.m. (Table 1).To determine the quantity of feed consumed by each pig, the amount of feed supplied and remained was recorded daily.The girth length was measured around the pig's body, just behind the forelegs and the body length was determined from the midpoint between the ears to the point where the tail joined the body.The height was measured directly behind the forelegs of the pig's body using a height-measuring scale.An auto flow meter (DN150 Flange, Autoflow, Gyeonggi-do, South Korea) was also integrated into the water pipeline with an accuracy of ±0.5% for measuring the quantity of water consumption in liter.The turbine flow meter is a combination of a flow sensor and display meter and it also has an RS485 cable to monitor the data with a data logger.Water intake data were taken as the difference between water supplied measured from the water meter and the water wastage calculated from troughs placed under the slatted floor.Additionally, body weight was calculated by averaging two measured weights that were recorded in a single day using a load cell (AD-4410, AandD Company Ltd., Tokyo, Japan).A setup with infrared sensors (model: MI3, Raytek corporation, California, USA) was prepared and used to measure the body temperature of each pig at four different body sections i.e., forehead (FH), back side (BS), left side (LS) and right side (RS) (Fig 1).In order to record data on the temperature, CO 2 and humidity, livestock environment management systems (AgriRoboTech Co., Ltd, Republic of Korea) were installed inside the barn.

Development of ANN and MLR model and data analysis
A basic ANN topology is developed using three primary layers: input, hidden and output layers as shown in Fig 2 .According to Arulmozhi et al., (2021), the ANN network is represented by the following Equation (1).
W here, y t = Network output (pig's body weight).
 o and = Weights leading from the bias terms.n = Count of hidden nodes, input nodes are denoted by m. f = Transfer function.
In this experiment, neural network toolbox in Matlab (2022a) was used to develop ANN models.Four different ANN models, i.e., Cascade Forward Back-propagation (CFBP), Layer Recurrent (LR), Feed Forward Backpropagation (FFBP) and Elman (EL), including various learning algorithms, transfer functions, hidden layers, as well as neurons in each layer, were carried out to estimate the PBW.Two hidden layers and the neurons in each hidden layer (ranging from 4 to 20) were tested to determine which topology performed the best for each ANN system.Three transfer functions i.e., Tan-sigmoid (TS), Linear (purelin) (LI) and Log-sigmoid transfer functions (LS), the Levenberg-Marquardt training function (LM) and the Gradient descent weight and bias learning function (GB) were used in the hidden and the output layers (Table 2).A maximum of 1000 epochs (iterations) and a threshold value of 0.01 were employed during training, testing and cross-validation dataset on each run.To train, test and validate the ANNs and MLR models, the dataset was split into three subsets randomly i.e., 65%, 20% and 15%, respectively.
MLR model aims to represent the linear association between two or more explanatory variables and one response variable (Basak et al., 2022).Equation ( 2) was employed to develop MLR model: W here, y i = Body weight. 0 - n = Coefficients of regression.X 1 -X n = Input variables. = Error associated with the i th observation.Three statistical quality metrics, which include coefficient of determination (R 2 ), root mean square error (RMSE) and mean absolute error (MAE) were applied to estimate the ANN and MLR models' ability to predict pigs' body weight.

Input variables selection
The descriptive statistics for input variables of American Yorkshire Duroc crossbreed pigs from 10 th September to 10 th December in 2021 are shown in Table 3.In this study, the correlation coefficient method was performed to examine the association between input and output variables.From Fig 3, there was a positive correlation between growthrelated factors and body weights, specifically the height of pig (HP), age (AG), length (LP) and girth length (GL).Other researchers have reported similar findings, in where FI (Pierozan et al., 2016), DW (Arulmozhi et al., 2020), HP (Yang et al., 2019), AG (Birteeb et al., 2015), LP (Banik et al., 2021), GL (Banik et al., 2021) and RCO 2 (Basak et al., 2022) are highly associated with pig's body weight.In addition, a negative correlation existed between PBW and the pig's body temperature (PBT).The negative correlation was noted may be due to the transition from autumn (September to November) to winter (December to March) in Korea.This observation was in accordance with previous research on a variation of temperature stress on growth parameters in pigs (Caldara et al., 2014).The present study found that the inside room temperature (RT), relative humidity (RRH) and temperature-humidity index (RTHI) had no significant relationship with PBW.Result of correlation analysis showed that FI, DW, HP, AG, LP, GL, CO 2 and PBT were the most important factors (r0.5) in determining PBW.Therefore, these factors were used for developing and evaluating the performance of MLR and ANNs models.

FFBP and MLR model performance
The precise model selection is important for estimating PBW.Table 4 and 5 showed the goodness of fit of four ANN models in predicting PBW with different transfer functions and neurons in hidden layers.It was found that the FFBP model with a TS transfer function, CFBP with a TS transfer function, EL with a LS transfer function and LR with LS transfer function had the best outcomes.Among these ANN models, the results of the study also showed that the FFBP model with 16 neurons in its hidden layers gave the best result during training (R 2 = 0.991 and RMSE = 0.926), validation (R 2 = 0.970 and RMSE = 1.076) and testing (R 2 = 0.954 and RMSE = 1.260) for the TS transfer function (Fig 4).
The current study also found that ANN models using a linear transfer function (purelin) performed the worst.This decrease in efficiency was most likely due to the nature of the function (Bhujel et al., 2022).Adding 16 neurons into the two hidden layers of the FFBP model with linear transfer function (purelin) resulted in lower prediction accuracy.When the linear transfer function was changed to the tansigmoid transfer function, an increase in precision of predicted body weight was observed.Wang et al., (2008) used a number of physical features obtained from pig images and connected those with the pig's live weight.The experimental result indicated that the best performance was achieved when hidden layers had three nodes (Wang et al.,  2008).It was also noted that a higher level of uncertainty in a model is directly connected to the individual parameter coefficient and the architecture of ANN models (Arulmozhi et al., 2021;Basak et al., 2022;Jaihuni et al., 2022).
The performance of the MLR model was also measured using the same input variables that were used in ANN models for predicting PBW.Equation ( 3) was employed to measure PBW: PBW = -7.261+ 0.004FI + 1.804AG -0.578HP + 1.376GL -2.313LP -0.486DW + 0.175PBT + 0.001CO 2 ....( 3)   Equation (3) helps to understand how PBW changes as a function of FI, AG, HP, GL, LP, DW, PBT and CO 2 .This model determined PBW as a linear relationship between PBW and independent variables.When compared with ANN models, the MLR model had a lower performance in predicting PBW during training (with R 2 = 0.917, RMSE = 1.863 and MAE = 1.532), validation (with R 2 = 0.902, RMSE = 1.952 and MAE = 1.978) and testing (R 2 = 0.897, RMSE = 2.104, MAE = 1.681).The distribution pattern of actual and predicted PBW values for entire datasets were demonstrated using scatter and box plot (Fig 5).
The MLR models are simple and easy to handle and can be used to predict PBW, similar to the other techniques.However, the performance variations between the two models showed the importance of selecting the best one.The ANN methods were shown better performance than MLR   in explaining the highly nonlinear relation between the measured and predicted values.Overall, the ANN models predicted PBW more accurately than the MLR model.When compared to MLR, the recommended ANN model (FFBP) predicted PBW with an 8.07%, 7.54% and 7.25% increase in R 2 and a reduction of 50.29%, 44.88% and 46.39% in RMSE during training, validation and testing periods, respectively.By applying the cumulative distribution function, it was found that the predicted PBW data obtained from ANN models were more accurate than the PBW estimated from the MLR (Fig 6).As shown in Figure 6, 90.22% of the data for the ANN model had a residual value between -2 and 2, whereas 67.12% for the MLR had the same range.Furthermore, the relationships between the input variables and PBW were found to be a nonlinear relationship, which may also affect the MLR models' performance (Fig 6).The

Applications of Artificial Neural Networks and Multiple Linear Regression Algorithms in Modelling of Pig's Body Weight
high performance in estimating the outcome of ANN modelling compared to the MLR methods for capturing the highly nonlinear and complex relationship between output and input variables has been reported in different studies (Jaihuni et al., 2022;Sihalath et al., 2021).

Sensitivity analysis of environmental factors
Sensitivity testing was carried out to determine the effect of the individual independent factors in estimating PBW.When the ANN and MLR models were tested without LP, their ability to predict PBW was slightly reduced (Fig 7).It was noted that the ANN and MLR models without LP had the least R 2 (0.919, 0.889) and the maximum RMSE (1.987, 2.918) and MAE (1.595, 2.577), respectively.The study results showed that LP was the most prominent factor in predicting PBW, followed by AG, GL, HP, FI, DW, CO 2 and PBT.The selected trait without LP could predict PBW with a 48.58% and 28.26% increase in RMSE and a reduction of 4.60% and 3.50% in R 2 for ANN and MLR models, respectively as compared to the most influential trait, i.e. without PBT.The significance of these variables in determining the PBW has led to the introduction of these variables in many modelling studies as a crucial indirect indicator to estimate PBW (Caldara et al., 2014).Along with LP, the four additional traits (i.e., AG, GL, HP and FI) also significantly affected in predicting PBW in the two models.According to research findings, the ANN model in FFBP network was suggested for modelling PBW in American Yorkshire Duroc crossbreed pigs.

CONCLUSION
Modelling the relationship between pig's body weight and other factors including, feed intake, age of pig, height, girth length, length of pig, amount of drinking water, pig's body temperature and CO 2 concentration in barn is a useful method for indirect estimation of PBW.The results in the present study showed a worse performance rate for the MLR model compared to all the ANN models.The effectiveness of ANN models estimating PBW could be owing to a nonlinear association between pig's body weight and environmental variables, along with growth-related parameters.Length of pig (LP) was found the most influential variable in predicting PBW for MLR and ANN models, followed by age of pig (AG), girth length (GL), height of pig (HP), feed intake (FI), the quantity of drinking water (DW ), room CO 2 concentration (CO 2 ) and body temperature (PBT).However, the above-mentioned input variables may not be the same at all times when correlated with PBW and trying to obtain a high PBW prediction efficiency with the same parameters may change the model's performance.In conclusion, additional research on viable alternative breeds under different management conditions may be considered for the evaluation of MLR/ANN models.

Table 2 :Fig 1 :
Fig 1: Graphical representation for estimating pig's body temperature and body weight using IR sensor and load cell, respectively.

Fig 2 :
Fig 2: Topology of ANN models for 12 neurons in each hidden layer.

Fig 3 :
Fig 3: Correlation coefficients of measured variables with pig's body weight.

Fig 4 :
Fig 4: Performance of FFBP model with 16 neurons in two hidden layers and tan-sigmoid transfer function.(a) Scatter plot and (b) Box plot of measured and predicted body weight.

Fig 5 :
Fig 5: MLR model development.(a) Scatter plot and (b) Box plot of measured and predicted body weight.

Fig 6 :
Fig 6: Cumulative distribution function results for ANN and MLR models.(a) ANN models.(b) MLR model.

Table 1 :
Feed ingredients and their contents.

Table 4 :
Performance of different transfer functions in artificial neural network models in estimating body weight of pig.

Table 3 :
Descriptive statistics of input variables in the experimental

Table 5 :
Performance of different neurons in hidden layers of artificial neural network models for the selected transfer function.