Skip to main content
Veterinary Research Forum logoLink to Veterinary Research Forum
. 2021 Mar 15;12(1):33–37. doi: 10.30466/vrf.2019.98275.2346

Comparison of artificial neural networks and multiple linear regression for prediction of dairy cow locomotion score

Mohammad Ali Norouzian 1,*, Hossein Bayatani 1, Mona Vakili Alavijeh 2
PMCID: PMC8094148  PMID: 33953871

Abstract

In this study, artificial neural networks (ANNs) were employed to investigate the relationship between locomotion score and production traits. A total number of 123 dairy cows from a free-stall housing farm were used in this study. To compare the effectiveness of the ANNs for the prediction of locomotion score, the multiple linear regression (MLR) model was developed using the eight production traits, body condition score, parity, days in milk, daily milk yield, milk fat percent, milk protein percent, daily milk fat yield, and daily milk protein yield as input variables to predict the locomotion score. The ANN predictions gave a higher coefficient of determination (R2) values with lower mean squared error (MSE) than MLR. The R2 and MSE of the MLR model were 0.53 and 0.36, respectively. However, the ANN model for the same dataset produced much improved results with R2 = 0.80 ‏ and MSE = 0.16, respectively. Globally, the results of this study showed that the connectionist network model was a better tool to predict locomotion scores compared to the multiple linear regression.

Key Words: Dairy cow, Locomotion score, Neural network, Regression models

Introduction

Cattle lameness (or mobility) problems are a major health concern and one of the most significant welfare and productivity issues in dairy farming. Lameness is also an economic problem for farmers. Economic losses are caused by reduced milk yield, prolonged calving intervals, culling, and veterinary costs or treatment.1 Prevention of lameness is the most important step in reducing the negative welfare implications for cows and costs for the farmers.2

Although automated detection methods show potential for identifying lame cows, locomotion scoring likely remains the most practical method for evaluating lameness in dairy cows, and several approaches have been used.3-5 The common principle is that the cow is assigned a score describing the animal's condition based on posture and stride variables. The scoring scheme can be, for instance, from 1 to 5 (Table 1).4

Table 1.

Scoring system for lameness identified during the study and clinical description

Scores Description Assessment criteria
1 Normal The cow stands and walks with a level-back posture.
2 Mild The cow stands with a level-back posture but develops an arched-back posture while walking.
3 Moderate An arched-back posture is evident both whiles standing and walking.
4 Lame An arched-back posture is always evident.
5 Severe The cow additionally demonstrates an inability or extreme reluctance to bear weight on one or more of her limbs/feet.

A common problem in all of the visual scoring systems is that they require experience before the scoring becomes consistent, and they are also observer-dependent. Therefore, it is hardly done in practice, and when done for large herd sizes, it is often done on a subsample of the entire herd. Also, several studies have shown that the results of locomotion scoring are subjective. O’callaghan et al. reported that the intra-observer repeatability in gait scoring for the five-point numerical scoring system was only 56.00%, and the inter-observer repeatability was only 37.00%.6 Winkler and Willen found 68.00% repeatability of scores among three observers.7 Therefore, it is highly relevant to develop automated systems to identify cows experiencing lameness. Several approaches have been introduced to automate locomotion scoring in recent years-force plates, pressure-sensitive walkways, and accelerometers. These automated systems also have several problems. One of the challenges that decrease the accuracy of measurement is skin displacement during locomotion.8 Furthermore, Winckler and Willen7 suggest that locomotion scoring systems’ usefulness is limited to pain reaction indicators.

Artificial neural networks (ANNs) provide a method to characterize synthetic neurons to solve complex problems in the same manner as the human brain does. The comparative advantage of ANNs over more conventional econometric models, such as multiple linear regression (MLR), can model complex, possibly non-linear relation-ships without any prior assumptions on the underlying data-generating process. They can learn and generalize relations between input and output data from examples presented to the network.9

Even though the ANNs have applications in diverse areas such as medicine, engineering, and physics, their application in animal sciences is scanty. However, few studies on the application of ANN in predicting feed abrasive value,10 weekly milk on dairy goats,11 and plasma hormones in broiler12 have been reported.

There is no literature on neural network modeling for locomotion score prediction using linear body measure-ments and milk production traits in dairy cows to the best knowledge of the authors. In this study, ANNs were employed to investigate the relation-ship between locomotion score and body measurements, and milk production traits. Also, in the present study, we compared the performance of the classic approach, MLR and ANNs in estimating dairy cow locomotion score from empirical data that were obtained based on Sprecher et al.4

Materials and Methods

Animal Data. The current study was conducted at a dairy cow’s farm with approximately 160 cows outside the city of Varamin, in the center of Iran's derived wilderness zone. A total number of 123 dairy cows from a free-stall housing farm were used in this study. The cows were gait scored with the locomotion scoring system developed by Sprecher et al. (Table 1),4 based on a five-point scale (1 = normal locomotion, 2 = mildly lame, 3 = moderately lame, 4 = lame, and 5 = severely lame). Locomotion scoring was performed by the same experienced observer at the parlor’s exit after the afternoon milking. At the same time, cows were scored for body condition by the same experienced observer on a scale of 1 to 5, where, 1 = thin and 5 = obese.13 Production traits, including parity, days in milk, daily milk yield, milk fat percent, milk protein percent, daily milk fat yield, and daily milk protein, were obtained from farm records nearest to the visit’s time.

Development of artificial neural network models. The data were randomly divided into two subsets. The first subset was the training set (n = 92), used to build the model. The second subset was the testing set (n = 31), which was used to evaluate different models' performance. A 2-layer feed-forward network formed by 1 input neuron, 1 output layer and some hidden units fully connected to both input and output neurons were adopted in this study. The most used learning procedure was based on the backpropagation algorithm. The network read inputs and corresponding outputs from a valid data set (training set) and iteratively adjusted weights and biases to minimize the prediction error. In this study, training gradient descent with Levenberg Marquardt algorithm was applied, and the performance function was the mean square error (MSE), the average squared error between the network outputs and the actual output.

Development of multiple regression models. To compare the effectiveness of the ANNs for the prediction of locomotion score, the MLR model was developed using the eight production traits, body condition scores, parity, days in milk, daily milk yield, milk fat percent, milk protein percent, daily milk fat yield, and daily milk protein yield as input variables to predict the locomotion score. Multiple regression procedure will estimate b0, b1,…, bq parameters of the linear equation: y = b0 + b1x1 + … + bqxq, where the regression coefficients b0, b1,…, bq represent the independent contributions of each independent variable x1,…, xq to the prediction of the dependent variable y. The global statistical significance of the relationship between y with the independent variables was analyzed using an analysis of variance to ensure the validity of the model in a quantified manner. The same training data set was used to develop the regression equations, and the effectiveness of prediction from the MLR model a tested using test data set.The Neural Network Toolbox of MATLAB (version 8.3; Math Works Inc., Natick, USA) was employed to construct ANN and developing the MLR models.

Models evaluation. The following parameters were calculated to evaluate the performance and predictive ability of the model: R2 (coefficient of determination; the correlation coefficient between predicted and observed values) and MSE (mean squared error). The R2 and MSE values between predicted and observed data were calculated using the following equations:

MSE=t=1nyt-y^t2n

R2=SSRegSST=1-SSESST

SSReg=t=1n(y^t-y®)2

SST=t=1n(y^t-y®)2

SSE=t=1n(y^t-y®t)2

where, yt = observed value,  t = estimated value, n = number of observations, SSReg = sum of the square of a regression model, SST = sum of the square of the total, and SSE = sum of the square of residuals.

Statistical analysis. To compare the predicted values with the results of laboratory assays, Student t-test was used by SAS Software (version 8.0; SAS Institute Inc., Cary, USA).

Results

Table 2 describes the productive performance of all enrolled cows. The cows were grouped depending on their locomotion score into five groups: Group 1, which represented the locomotion score 1, consisted of 74 cows, and there were 39 cows in group 2, seven cows in group 3, 2 cows in group 4, and 1 cow in group 5. The prevalence of lameness (LS ≥3) was averaged 8.10%. This prevalence of lameness was lower than that of a previous study by Wells et al.14 Those authors estimated that the prevalence of lameness in 17 dairy farms in the USA was 13.70% during summer and 16.70% during spring.

Table 2.

Productive performance of the enrolled cows (n = 123)

Items LS BCS Parity DIM DMY MFP MPP DMFY DMPY
Maximum 5.00 4.00 8.00 562.00 55.40 5.07 3.85 2.80 1.40
Minimum 1.00 2.75 1.00 20.00 21.60 1.76 2.21 0.61 0.69
Means 1.46 3.17 2.13 200.20 37.20 3.48 2.88 1.28 1.06
SD 0.64 0.33 1.26 111.30 7.60 0.76 0.26 0.34 0.17

LS: locomotion score; BCS: body condition score; DIM: days in milk; DMY: daily milk yield (kg); MFP: milk fat percent; MPP: milk protein percent; DMFY: daily milk fat yield (kg); DMPY: daily milk protein yield (kg).

The architecture, specification, and statistic information of the neural networks are listed in Table 3. In the current study, the best number of layers, neurons in the hidden layer and neurons in the output layer were 2, 18, and 1, respectively.

Table 3.

Architecture, specification, and statistical information of the neural network model

Measurements Value
No. of layer 2
No. of neuron in a hidden layer 18
Transfer Function of hidden layer Tan Sigmoid
No. of neuron in the output layer 1
Transfer Function of the output layer Pure Line
Train Function Levenberg-Marquardt
Perform Function MSE
No. of training elements 86
No. of validation elements 18
No. of testing elements 18
Epoch 1000
Momentum 0.001

The statistical values of empirical and predicted values by ANN and MLR models and residues, the difference between predicted and observed values, and relative residues are listed in Table 4. Also, scatter plot comparing observed and estimated locomotion scores for the MLR and ANN and scatter plot comparing estimated locomotion scores and residues, observed minus estimated values, are shown in Figures 1, 2 and 3. There was no significant difference between actual and predicted locomotion scores using ANN and MLR models (Table 4). Relative error was 12.20 ± 8.00 and 11.70 ± 7.45 for MLR, and ANN approaches, respectively.

Table 4.

Mean, maximum, minimum, and standard deviation (SD) of empirical and predicted data, as well as residues

Items Empirical Predicted
Residuals
Relative Error
MLR ANNs MLR ANNs MLR ANNs
Maximum 4 3.14 3.884 1.26 0.86 95.20 120.10
Minimum 1 0.370 0.151 -0.95 -1.21 -63.00 -84.00
Means 1.46 1.47 1.55 0.44 0.38 12.20 11.70
SD 0.64 0.47 0.57 -0.04 -0.08 8.00 7.45

Relative Error = [(predicted - observed)/observed] ×100

Fig. 1.

Fig. 1

A) Scatter plot comparing observed and estimated locomotion scores for the artificial neural networks and B) scatter plot comparing estimated locomotion scores and residues, observed minus estimated values

Fig. 2.

Fig. 2

A) Scatter plot comparing observed and estimated locomotion scores for the multiple regression and B) scatter plot comparing estimated locomotion scores and residues, observed minus estimated values

Fig. 3.

Fig. 3

A bar graph shows R2 and MSE of MLR and ANN models for prediction of locomotion score

Discussion

Selecting architectural characteristics of neural networks such as inputs and outputs, number of layers, number of neurons in each layer, and the number of hidden layer nodes of the ANNs can significantly affect them. A previous study15 showed that one hidden layer neural network was enough to approximate any function if enough hidden nodes were presented. This ANNs structure can be effective on the accuracy, correct development of the model, and system behavior. Accordingly, network development's first important aim was to determine the optimal number of hidden layer nodes. There are no theoretical principles for determining this. However, there are many empirical rules.16 For example, the number of neurons in the hidden layer can be confirmed by the formula: m = log2 (n) + α where m is the number of neurons in a hidden layer, n is the number of input variables, α is the integer between 0 and 10.9 During the network development, series of neural networks with different numbers of hidden layer nodes were trained. According to its generalization ability for the testing set, MSE was calculated on different numbers of the hidden layer nodes. The model which gave the lowest value of MSE was chosen as the final ANN model. In this study, the best number of hidden layer nodes was 18 to predict locomotion score (Table 3). For ANN, the training was stopped after 1000 epochs because the error was increased. In this study, linear transfer for the output layer and the sigmoid transfer function for the input and hidden layer was used in the ANN. This transfer function gave an appropriate response for many applications concerning linear transfer function.

To compare different models in prediction of locomotion score, the ANN approach gave higher R2 values with lower MSE than the MLR model (Fig. 3). The R2 and MSE of MLR model were 0.53 and 0.36, respectively. However, the ANN model for the same data set produced much-improved results with R2 = 0.80 ‏ and MSE = 0.16, respectively. The ANN model improved the MSE of the MLR model by 125% and R2 by 51%. Compared to some previous MLR studies,16-17 current MLR models had limited prediction capability with low R2 value.

In the ANN model, the regression between observed and estimated locomotion scores showed a slope very close to one and a low dispersion around the regression line (Figs. 2 and 3). On the other hand, estimated locomotion scores versus residues (observed values minus estimated values, showed a slope very close to zero and homogeneous deviations around this value. However, the MLR provides worse results compared to the ANN model. The mean relative error was 8.00 and 7.45 for MLR and ANN prediction, respectively, and was lower for ANN than MLR (Table 3).

For the prediction of locomotion scores of dairy cows, the model that gave maximum R2 value with the smallest MSE was considered better, and the results obtained in the present study revealed that the ANN model gave a more accurate prediction of locomotion score than MLR models. However, further studies with larger data sets are required to better determine the feasibility of rapidly predicting locomotion scores using ANN methods.

Acknowledgments

The authors acknowledge the University of Tehran for the approval and support of this research.

Conflict of interest

The authors disclose no conflict of interest.

References

  • 1.Enting H, Kooij D, Dijkhuizen AA, et al. Economic losses due to clinical lameness in dairy cattle. Livest Prod Sci. 1997;49(3):259–267. [Google Scholar]
  • 2.Green LE, Hedges VJ, Schukken YH, et al. The impact of clinical lameness on the milk yield of dairy cows. J Dairy Sci. 2002;85(9):2250–2256. doi: 10.3168/jds.S0022-0302(02)74304-X. [DOI] [PubMed] [Google Scholar]
  • 3.Manson FJ, Leaver JD. The influence of concentrate amount on locomotion and clinical lameness in dairy cattle. Anim Prod. 1988;47:185–190. [Google Scholar]
  • 4.Sprecher DJ, Hostetler DE, Kaneene JB. A lameness scoring system that uses posture and gait to predict dairy cattle reproductive performance. Theriogenology. 1997;47(6):1179–1187. doi: 10.1016/s0093-691x(97)00098-8. [DOI] [PubMed] [Google Scholar]
  • 5.Rajkondawar PG, Liu M, Dyer RM, et al. Comparison of models to identify lame cows based on gait and lesion scores, and limb movement variables. J Dairy Sci. 2006;89(11):4267–4275. doi: 10.3168/jds.S0022-0302(06)72473-0. [DOI] [PubMed] [Google Scholar]
  • 6.O’Callaghan KA, Cripps PJ, Downham DY, et al. Subjective and objective assessment of pain and discomfort due to lameness in dairy cattle. Anim Welf. 2003;12(4):605–610. [Google Scholar]
  • 7.Winckler C, Willen S. The reliability and repeatability of a lameness scoring system for use as an indicator of welfare in dairy cattle. Acta Agr Scand A-AN. 2001;51(sup030):103–107. [Google Scholar]
  • 8.Mokaram Ghotoorlar S, Ghamsari M, Nowrouzian I, et al. Lameness scoring system for dairy cows using force plates and artificial intelligence. Vet Rec. 2012;170(5) doi: 10.1136/vr.100429. [DOI] [PubMed] [Google Scholar]
  • 9.Norouzian M, Vakili Alavijeh M. Comparison of artificial neural network and multiple regression analysis ‎for ‎prediction of fat tail weight of sheep. Iran J Appl Anim Sci. 2016;6(4):895–900. [Google Scholar]
  • 10.Norouzian MA, Asadpour S. Prediction of feed abrasive value by artificial neural networks ‎and multiple linear regression. Neural Comput Appl. 2011;21:905–909. [Google Scholar]
  • 11.Fernández S, Olivas ES, Sánchez-Seiquer P, et al. Weekly milk prediction on dairy goats using neural networks. Neural Comput Appl. 2007;16(4):373–381. [Google Scholar]
  • 12.Moharrery A, Kargar A. Artificial Neural Network for prediction of plasma hormones, liver enzymes and performance in broilers. J Anim Feed Sci. 2007;16(20):293–304. [Google Scholar]
  • 13.Ferguson JD, Galligan DT, Thomsen N. Principal descriptors of body condition score in Holstein cows. J Dairy Sci. 1994;77(9):2695–2703. doi: 10.3168/jds.S0022-0302(94)77212-X. [DOI] [PubMed] [Google Scholar]
  • 14.Wells SJ, Trent AM, Marsh WE, et al. Prevalence and severity of lameness in lactating dairy cows in a sample of Minnesota and Wisconsin herds. J Am Vet Med Assoc. 1993;202(10):78–82. [PubMed] [Google Scholar]
  • 15.Cybenko G. Approximations by superpositions of a sigmoidal function. Math Control Signals Syst. 1989;2(3):303–314. [Google Scholar]
  • 16.Stevens RJ, O’Bric CJ, Carton OT. Estimating nutrient content of animal slurries using electrical conductivity. J Agric Sci. 1995;125(2):233–238. [Google Scholar]
  • 17.Moral R, Perez-Murcia MD, Perez-Espinosa A, et al. Estimation of nutrient values of pig slurries in Southeast Spain using easily determined properties. Waste Manag. 2005;25(7):719–725. doi: 10.1016/j.wasman.2004.09.010. [DOI] [PubMed] [Google Scholar]

Articles from Veterinary Research Forum are provided here courtesy of Faculty of Veterinary Medicine, Urmia University, Urmia, Iran

RESOURCES