Neural prediction of cows ’ milk yield according to environment temperature

Medium and maximum air temperatures around the milk cowsheds were measured and these empirical data were used to create a neural prediction model evaluating the cows’ milk yield under varying thermal conditions. We found out that artificial neural networks were an effective tool supporting the process of short-term milk yield forecasting. An analysis of sensitivity to input variables performed for the generated neural model allowed for identifying the dominant input variable for the proposed neural model. The dominant variable was the maximum temperature of the day, a key risk factor of the heat stress in cows.


INTRODUCTION
Heat stress in cows results in a reduced breeding rate and shorter oestrus, while temperatures above +30°C can decrease milk yield even by 20% (Jaśkowski et al., 2005).Thermal shock reduces the activity of cows during fodder consumption and it accelerates the rotting of fodder in an overheated barn (Daniel, 2008).Numerous authors reported the unfavourable seasonality of milk production (Ludwiczak et al., 2001;Matysik-Pejas, 2007).According to the studies conducted in Poland, a 10°C increase in outdoor temperature can be accompanied by a 1.0 L decrease in daily milk yield (Chaberski et al., 2012;Alphonsus and Essien, 2012).Since the warming of our climate is in all likelihood inevitable, increased vigilance is required to prevent heat stress effects in cows (Lipiński, 2012).Israel is the global leader in national average annual milk yield.The average production level was 11,991 kg milk per cow in 2010 (Israel Cattle Breeders Association: "The dairy industry in Israel 2011").Record yield is obtained in extremely unfavourable thermal conditions, under constant threat of heat stress.In the summer, milk production is assessed to be 7% lower (Flamenbaum and Galon, 2010).Israeli experience in preventing the effects of overheating in cows can and should be used in in Poland country (Lipiński, 2012).
Problems at a scale similar to that in Israel occur in subtropical conditions all over the world.In California, annual losses as calculated per cow reach 110,US $ while in Texas this value is approximately 698 USD.Data concerning the effects of heat stress from over 110 publications were thoroughly consolidated in the USA (West, 2003).
Artificial neural networks (ANNs) with supervised learning, that is, created "with a teacher," are becoming increasingly important in agricultural scientific studies (Boniecki et al., 2012;Ślósarz et al., 2011).Neural models are in fact simplified simulators of brain function (Karaman et al. 2012).They have adapting properties acquired through learning, and then they are able to generalise the knowledge they have gained (Nowakowski et al., 2009;Fadare and Babayemi, 2007).At the same time, they are not too sensitive to incomplete and noise- corrupted input data.It should be noticed that ANNs can process new information in the form of input signals to produce real-time results as the output (Boniecki et al., 2009;Boniecki et al., 2011;Qotbi et al., 2010).Due to their characteristics, neural models are increasingly used in practice and in agricultural engineering (Yalcin et al., 2011;Cabrera and Prieto, 2010;Bouharati et al., 2008).

Study area
The following hypothesis has been adopted in the paper: The information provided as empirical data obtained via measurements of average and maximum outdoor temperatures around a barn of milk cows is enough to create a predictive neural model intended for short-term forecasting of cows' milk yield under continuous changing heat conditions.It had to be checked whether artificial neural networks are an appropriate scientific study tool for developing a model that would give a correct and effective forecast.The following specific questions appeared: 1) What ANN topology is optimum in the process of forecasting cows' milk yield? 2) Which of the two selected measurement parameters is a representative (dominant) characteristic in the neural model under development?
The purpose of the paper was to investigate the possibility of using artificial neural networks as a prediction tool to support the process of forecasting cows' milk yield.A set of regressive neural models was designed and then built to forecast cows' milk yield based on temperature data.Project implementation stages included: 1) Defining and analysing the scientific study problem; 2) acquiring empirical data; 3) Producing training sets which included measurement data in a form acceptable by the computer ANN simulator; 4) creating an ANN topology set; 5) testing the created ANN structures and choosing the optimum neural model; 6) forecasting cows' milk yield.

Methodology
The study evaluated the winter and summer milk yield of Holstein-Friesian cows from a farm in Wielkopolska.The winter season lasted from November 28th, 2011 to March 4th, 2012, and the summer season from May 30th, 2011 to September 4th, 2011.The farm comprised three barns, housing 250 dairy cows with excellent average annual milk yield of over 10 kg.
The farm was an old facility, built in 1973 and thoroughly altered in 2008, when stalls for cows had been moved outside the buildings, to the adjacent shelters.The cow maintenance method was based on open barns, which were considered the standard in subtropical areas, for instance in Israel.The original barn buildings currently function as roofed feeding tables, and cows -which stay mostly outside-have good access to them.The cattle are fed according to the TMR (a mixture containing all feeding ingredients, covering all the nutritional needs of cows) method.Cows are milked three times a day in a parallel parlour.
The numerical data, that is, the number of milking cows and the quantity of milk obtained each day, came from the farm's reports, used to calculate average daily milk yields from average cows.This helped in eliminating the potential impact of fluctuations caused by the natural rotation of animals in herds resulting from changes to physiological states, such as labour, lactation, dried-off period and culling.Meteorological information regarding the weather during summer and winter days came from materials available on the internet (www.poznan.pios.gov.pl).Automatically recorded temperatures were used: average daily temperatures and maximum temperatures.This data came from the container measurement station in Krzyżówka near Witkowo, located in the Gniezno Forest District (Poland).The station is installed outside an urban area, in an agricultural and forest location just above 20 km from the farm.

Neural modelling
The following process was proposed and applied to perform the task (Figure 1): Predictive neural models were created using the neural network simulator implemented in the Statistica package.The most important stage of creating an ANN is development of a suitable training set, with empirical data encoded in its structure.For this purpose, numerical input variables were defined along with the forecast output variable, which were based on the structure of the formulated scientific problem.Two input variables were adopted: 1) X1-Average daily temperature (°C); 2) X2-maximum temperature (°C).
One output variable was adopted: Y-average daily milk yield (kg).
Using the obtained experimental results, a set of empirical data was created which consisted of 197 measurement cases.The set was divided as usual into 3 subsets: 1) A training set, with 98 cases; 2) a validation set, with 49 cases; 3) a testing set, with 49 cases.
The structure of the training set consisted of 2 input variables and 1 output variable.A screenshot presenting a part of the training set is shown in Table 1 where: Y-output variable, X1, X2-input variables.
Neural models were designed using the artificial neural network simulator implemented in the Statistica package.The following types of neural networks were subjected to testing: 1) linear networks; 2) MULTILAYER Perceptron (MLP) networks with three (one hidden layer) and four layers (two hidden layers); 3) radial basic function (RBF) networks; 4) generalized regression neural network (GRNNs).
Neural models were created in two stages.First, Automatic Network Designer was used -an effective option supporting the process of designing artificial neural networks, implemented in the statistical IT system Statistica.The tool permitted automating and simplifying the procedures for the initial search of a set of prognostic neural networks that would model the studied process in the best possible way.
At the second stage of building neural models, the User Network Designer tool was applied.It permitted advanced interference in the

RESULTS AND DISCUSSION
Ten neural topologies were identified among the 100 neural models created.Table 2 shows a set of the best ANNs as a screenshot of a dialogue box in Statistica: where: RMS error is the root mean square error: It is the total error made by the network on a set of data (training, testing or validation data).It is determined by adding squares of individual errors, dividing the total by the number of the values considered, and determining the square root of the quotient.For interpretation purposes, the RMS error is the most convenient of all the single values describing the total network error.The most optimum network was chosen from the set of the 10 best ANNs, and it turned out to be an MLP network with a structure (Figure 2).The low value of the RMS error for this network (equalling 0.95) implies good predictive properties of the created model.The input layer consists of two neurons with a linear postsynaptic (PSP) function and a linear activation function.The only hidden layer was comprised of 31 sigmoid neurons, that is, neurons with a linear PSP function and a logistic activation function.One sigmoid neuron formed the output of the network.The created neural model was trained using the back propagation (BP) method in three cycles of 200 epochs and was optimised with the conjugate gradients (CG) algorithm for 150 epochs.In the additional network training process, the Levenberg-Marquardt algorithm was used to adjust the network for 50 epochs (Kisi, 2007).In the process of training with the BP algorithm, the following parameters were adopted: 1) decreasing learning rate: η = 0.4 up to η = 0.01; 2) momentum factor: α = 0.45.The structure of the created network is shown in Figure 2.

Neural modelling analysis
Feed-forward MLP neural networks are among ANN topologies that are the most often used in practice.Multi-Layer Perceptron represents the class of parametric neural models.Its characteristics include the fact that the number of neurons building its structure is considerably lower than the number of training set cases.The basic properties of an MLP network are:  1. MLP is a feed-forward network, 2. MLP is trained "with a teacher," 3. It has a multilayer architecture-there are three layers: the input layer, hidden layers and the output layer, 4. The architecture of connections within the network permits communication only between the neurons in the neighbouring layers, 5.The neurons forming an MLP-type ANN perform aggregation of the input data by determining the weighted sums of inputs (using a linear aggregation formula), 6.The activation function is linear for input neurons, nonlinear for hidden neurons and generally non-linear for output neurons, 7. Due to the saturation level (in sigmoid activation functions), the data processed through the network require proper calibration (pre-processing and postprocessing).Good quality of the MLP network as a predictive model is identified through the regression statistics shown in Table 3 as a screenshot of a dialogue box from the Statistica package: Where, 1.Average -The average value of the output variable calculated based on the entered values of this variable gathered (as appropriate) in the training, validation or testing sets.Regression statistics are determined independently on the training, validation and testing sets.2. Standard deviation-standard deviation calculated for the entered (as above) values of the output variable.3. Average error-average error (modulus of the difference between the entered value and the obtained output value) for the output variable.4. Error deviation-standard error deviation for the output variable.5. Average absolute error-average absolute error (difference between the entered value and the obtained output value) for the output variable.6. S.D. ratio-quotient of standard deviations for errors and data.It is the main indicator of the quality of the regression model built by the network.7. Correlation-a standard Pearson's correlation coefficient for the entered value and the output value obtained.
The two latter indicators, that is standard deviation quotient and correlation, are crucial for assessing the predictive capacity of the created neural network.The lower, the standard deviation quotient (closer to 0) and the greater the correlation (closer to 1), the better is the network.Table 3 shows that the correlation value is 0.99 for the training, validation and testing sets.The standard deviation quotient for errors and for data falls within the range of 0.09 for the validation set to 0.13 for the testing set.
To determine the significance of representative parameters used to build a neural model, the obtained MLP network was analysed for sensitivity to individual input variables.The sensitivity analysis procedure is implemented in the Statistica package as a tool used to assess the impact of individual input variables on the functional quality of the created neural model (Table 4).A sensitivity analysis shows how useful individual input data is.It indicates high-rank variables that can be omitted without compromising the network's quality.It also indicates key variables (low rank value) that must not be omitted.
The analysis shows that the significance of representative characteristics (adopted as input variables) for the MLP-type ANN is as follows (sequence: rank from 1 to 2): 1. X2-maximum temperature during the day (°C), 2. X1 -average daily temperature (°C).

Conclusions
Neural modelling used as a predictive instrument to forecast cows' milk yield based on weather (temperature) information has proven to be a method that can effectively support the decision-making processes accompanying milk production.The simulation studies led to the following conclusions: 1.The obtained study results confirm the hypothesis that artificial neural networks are an affective tool supporting the process of short-term forecasting of cows' milk yield.2. A qualitative analysis of the created neural models has shown that the best predictive capacity characterised the MLP neural topology with a structure of 2:2-31-1:1, trained using the back propagation (BP) method and then optimised with the conjugate gradients (CG) algorithm.Boniecki et al. 4711 3.An analysis checking the sensitivity of the created neural model to input variables made it possible to indicate the dominant input data of the proposed neural model, that is, the maximum daily temperature.So the risk of heat stress in cows is determined mostly by the maximum temperature in the surroundings of the barn.4. The studies have shown that the developed model is a useful instrument supporting the decision-making processes accompanying milk production.

Figure 2 .
Figure 2. Structure of the optimal ANN type MLP.

Table 1 .
Fragment of learning file.

Table 2 .
File of 10 generated ANN.

Table 3 .
Regression statistics of generated ANN type MLP.

Table 4 .
Results of the sensitivity analysis generated for ANN type MLP for input variables.