Indian Journal of Animal Research

  • Chief EditorK.M.L. Pathak

  • Print ISSN 0367-6722

  • Online ISSN 0976-0555

  • NAAS Rating 6.50

  • SJR 0.263

  • Impact Factor 0.4 (2024)

Frequency :
Monthly (January, February, March, April, May, June, July, August, September, October, November and December)
Indexing Services :
Science Citation Index Expanded, BIOSIS Preview, ISI Citation Index, Biological Abstracts, Scopus, AGRICOLA, Google Scholar, CrossRef, CAB Abstracting Journals, Chemical Abstracts, Indian Science Abstracts, EBSCO Indexing Services, Index Copernicus
Indian Journal of Animal Research, volume 58 issue 12 (december 2024) : 2032-2039

Applications of artificial neural networks and multiple linear regression algorithms in modelling of pig’s body weight

Jayanta Kumar Basak1,2, Bhola Paudel3, Nibas Chandra Deb3, Dae Yeong Kang3, Sijan Karki3, Hyeon Tae Kim3,*
1Institute of Smart Farm, Gyeongsang National University, Jinju 52828, Korea.
2Department of Environmental Science and Disaster Management, Noakhali Science and Technology University, Noakhali-3814, Bangladesh.
3Department of Bio-systems Engineering, Gyeongsang National University (Institute of Smart Farm), Jinju 52828, Korea.
Cite article:- Basak Kumar Jayanta, Paudel Bhola, Deb Chandra Nibas, Kang Yeong Dae, Karki Sijan, Kim Tae Hyeon (2024). Applications of artificial neural networks and multiple linear regression algorithms in modelling of pig’s body weight . Indian Journal of Animal Research. 58(12): 2032-2039. doi: 10.18805/IJAR.BF-1635.
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.
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 three-dimensional 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-based models, 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.89 kg (mean±standard deviation) were used in two distinct experiments that were conducted from the 10th of September to the 10th 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, CO2 and humidity, livestock environment management systems (AgriRoboTech Co., Ltd, Republic of Korea) were installed inside the barn.
 

Table 1: Feed ingredients and their contents.



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


 
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).
 
 
 
Where,
yt =  Network output (pig’s body weight).
ao  and =  Weights leading from the bias terms.
n = Count of hidden nodes, input nodes are denoted by m.
f = Transfer function.
bij = {i=1, 2,…, m; j=0, 1,…, n} is the weight from the input nodes to hidden nodes.
        {j=0, 1, …, n} is the vectors of weights from the hidden nodes to the output nodes.

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


       
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 Back-propagation (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.
 

Table 2: Transfer function used in ANN models in the study.


      
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:

 
 
Where,
yi = Body weight.
b0-bn = Coefficients of regression.
X1-Xn = Input variables.
e = Error associated with the ith observation.
       
Three statistical quality metrics, which include coefficient of determination (R2), 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 10th September to 10th 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 growth-related 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 RCO2 (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, CO2 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.
 

Table 3: Descriptive statistics of input variables in the experimental period 2021.


 

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.


 
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 (R2 = 0.991 and RMSE = 0.926), validation (R2 = 0.970 and RMSE = 1.076) and testing (R2 = 0.954 and RMSE = 1.260) for the TS transfer function (Fig 4).
 

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


 

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


 

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.


       
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 tan-sigmoid 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:
 
 
 
 
 Equation (3) helps to understand how PBW changes as a function of FI, AG, HP, GL, LP, DW, PBT and CO2. 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 R2 = 0.917, RMSE = 1.863 and MAE = 1.532), validation (with R2 = 0.902, RMSE = 1.952 and MAE = 1.978) and testing (R2 = 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).
 

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


       
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 R2 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 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).
 

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


 
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 R2 (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, CO2 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 R2 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.
 

Fig 7: Analysis of sensitivity using input variables.


 
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 CO2 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 for 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 CO2 concentration (CO2) 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.
This work was supported by Korea Institute of Planning and Evaluation for Technology in Food, Agriculture, Forestry and Fisheries (IPET) through Agriculture, Food and Rural Affairs Research Center Support Program, funded by Ministry of Agriculture, Food and Rural Affairs (MAFRA) (717001-7) and in part by Brain Pool program through the National Research Foundation of Korea (2021H1D3A2A02038875) for financial support to conduct the research.
All authors declare that they have no conflict of interest.

  1. Arulmozhi, E., Basak, J.K., Sihalath, T., Park, J., Kim, H.T., Moon, B.E. (2021). Machine learning-based microclimate model for indoor air temperature and relative humidity prediction in a swine building. Animals. 11(1): 222. https://doi.org/ 10.3390/ani11010222. 

  2. Arulmozhi, E., Basak, J.K., Park, J., Okyere, F.G., Khan, F., Lee, Y., Lee, J., Lee, D.,  Kim, H.T. (2020). Impacts of nipple drinker position on water intake, water wastage and drinking duration of pigs. Turkish Journal of Veterinary and Animal Sciences. 44. https://doi.org/10.3906/vet- 1909-54.

  3. Banik, S., Naskar, S., Barman, K., Das, P.J., Kumar S., Rajkhowa, S. (2021). Nonlinear prediction models for estimation of pre-weaning body weight of pigs using morphometric traits. Indian Journal of Animal Research. 55(11): 1383- 1386. https://doi.org/10.18805/IJAR.B-4174. 

  4. Basak, J.K., Eun, N., Shihab, K., Shahriar, A., Paudel, B.,  Eun, B. (2022). Applicability of statistical and machine learning- based regression algorithms in modeling of carbon dioxide emission in experimental pig barns. Air Quality, Atmosphere and Health. 15(8): 1-14. https://doi.org/ 10.1007/s11869-022-01225-9. 

  5. Basak, J.K., Arulmozhi, E., Khan, F., Okyere, F. G., Park, J. Lee. D.H., Kim, H.T. (2020). Assessment of the influence of environmental variables on pig’s body temperature using ANN and MLR models. Indian Journal of Animal Research.  54(9): 1165-1170. https://doi.org/10.18805/ijar.B-1199. 

  6. Bhujel, A., Kim, N.E., Arulmozhi, E., Basak, J.K., Kim, H.T. (2022). A lightweight attention-based convolutional neural networks  for tomato leaf disease classification. Agriculture (Switzerland), 12(2): 1-18. https://doi.org/10.3390/agriculture12020228. 

  7. Birteeb, P.T., Tetteh, S.O., Salifu, A.S. (2015). Growth performance and weight estimation of large white piglets weaned at different ages. Research and Reviews: Journal of Veterinary Science and Technology. 4(3): 15-23.

  8. Caldara, F.R., Santos, L.S. dos, Machado, S.T., Moi, M., de Alencar Nääs, I., Foppa, L., Garcia, R. G., de Kássia Silva dos Santos, R. (2014). Piglets’ surface temperature change at different weights at birth. Asian-Australasian Journal of Animal Sciences. 27(3): 431-438. https://doi.org/ 10.5713/ajas.2013.13505

  9. Jaihuni, M., Basak, J.K., Khan, F., Okyere, F.G., Sihalath, T., Bhujel, A., Park, J., Lee, D.H., Kim, H.T. (2022). A novel recurrent neural network approach in forecasting short term solar irradiance. ISA Transactions. 121: 63-74. https://doi.org/ 10.1016/j.isatra.2021.03.043. 

  10. Kang, H.J., Bae, S.,  Lee, H. (2022). Correlation of animal-based parameters with environment-based parameters in an on- farm welfare assessment of growing pigs. Journal of Animal Science and Technology. 64(3): 539-563. https:/ /doi.org/10.5187/jast.2022.e23.

  11. Lee, J.J., Kang, J., Park, S., Cho, J.H., Oh, S., Park, D.J., Perez- Maldonado, R., Cho, J.Y., Park, I.H., Kim, H.B., Song, M. (2020). Effects of dietary protease on immune responses  of weaned pigs. Journal of Animal Science and Technology. 62(2): 174-179. https://doi.org/10.5187/jast.2020.62.2.174. 

  12. Machebe N.S., Ezekwe A.G., Okeke G.C., Banik S. (2016). Path analysis of body weight in grower and finisher pigs. Indian Journal of Animal Research. 50(5): 794-798. https:// doi.org/10.18805/ijar.11319. 

  13. Min, Y., Choi, Y., Kim, Y., Jeong, Y., Kim, D., Kim, J., Jung, H., Song, M. (2019). Effects of protease supplementation on growth performance, blood constituents and carcass characteristics of growing-finishing pigs. Journal of Animal Science and Technology. 61(4): 234-238. https:/ /doi.org/10.5187/jast.2019.61.4.234.

  14. Mutua, F.K., Dewey, C.E., Arimi, S.M., Schelling, E., Ogara, W.O. (2011). Prediction of live body weight using length and girth measurements for pigs in rural Western Kenya. Journal of Swine Health and Production. 19(1): 26-33.

  15. Pierozan, C.R., Agostini, P.S., Gasa, J., Novais, A.K., Dias, C.P., Santos, R.S.K., Pereira Jr, M., Nagi, J.G., Alves, J.B., Silva, C.A. (2016). Factors affecting the daily feed intake and feed conversion ratio of pigs in grow-finishing units: the case of a company. Porcine Health Management. 2(1): 7. https://doi.org/10.1186/s40813-016-0023-4. 

  16. Sihalath, T., Basak, J.K., Bhujel, A., Arulmozhi, E., Moon, B.E., Kim, H.T. (2021). Pig identification using deep convolutional  neural network based on different age range. Journal of Biosystems Engineering. 46(2): 182-195. https://doi.org/ 10.1007/s42853-021-00098-7.

  17. Wang, Y., Yang, W., Winter, P., Walker, L. (2008). Walk-through weighing of pigs using machine vision and an artificial neural network. Biosystems Engineering. 100(1): 117- 125. https://doi.org/10.1016/j.biosystemseng.2007.08.008.

  18. Wu, J., Tillett, R., McFarlane, N., Ju, X., Siebert, J.P., Schofield, P. (2004). Extracting the three-dimensional shape of live pigs using stereo photogrammetry. Computers and Electronics in Agriculture. 44(3): 203-222. https://doi.org/ 10.1016/j.compag.2004.05.003.

  19. Yang, K.Y., Jeon, J.H., Kwon, K.S., Choi, H.C., Kim, J.B., Lee, J.Y. (2019). Effect of different parities on reproductive performance, birth intervals and tail behavior in sows. Journal of Animal Science and Technology. 61(3): 147- 153. https://doi.org/10.5187/jast.2019.61.3.147.

  20. Zhang, H., Balaban, M. Ö., Principe, J. C. (2003). Improving pattern recognition of electronic nose data with time-delay neural networks. Sensors and Actuators B: Chemical. 96(1-2): 385-389. https://doi.org/10.1016/S0925-4005(03)00574-4. 

Editorial Board

View all (0)