ARTIFICIAL NEURAL NETWORKS FOR PREDICTING ANIMAL THERMAL COMFORT

The objective of this study was to develop artificial neural networks (ANNs) for predicting animal thermal comfort based on temperature and relative humidity of the air for each day of the year. The data on temperature and relative humidity for a 25-year historical series collected at the Padre Ricardo Remetter Conventional Meteorological Station, located in the city of Santo Antônio de Leverger Mato Grosso (Brazil), were retrieved from the website of the National Institute of Meteorology. According to the day of the year, the temperature and humidity index was determined as a function of the climatic variables. Therefore, the day of the year was the input variable of the neural networks, and the temperature and humidity index (THI) was the output variable. The number of layers and neurons used for establishing different architectures was variable. Data were adjusted on the basis of mean square errors, performance and efficiency indexes, and normality tests. The values estimated by the networks and those obtained from the historical series did not differ significantly. The networks with the best performance were selected for graphical analysis of residuals. The ANNs developed in this study predicted animal thermal comfort with adequate reliability and precision.


INTRODUCTION
Thermal comfort is one of the main criteria for evaluating animal welfare because it characterizes the environmental and micrometeorological conditions of animal facilities.Some studies revealed that the productive and reproductive performance of animals was significantly decreased by thermal stress (Bertoncelli et al., 2013;Manteca et al., 2013;Viana et al., 2013;Coutinho et al., 2014;Cecchin et al., 2016;Navas et al., 2016;Silva et al., 2016;Fialho et al., 2018;Neto & Bittar, 2018;Oliveira et al. 2018).It is known that the temperature and relative humidity of the air significantly affect the stress level of animals.Another relevant factor to be considered is the location of most of the Brazilian territory within a tropical climate zone, where environmental variables fluctuate substantially throughout the year, limiting predicting these parameters with adequate accuracy.
The effects of the conditions of animal facilities have been evaluated using several thermal comfort indexes, including the temperature and humidity index (THI) proposed by Thom (1959), the black globe THI (BGTHI) developed by Buffington (1981), and the radiant heat load proposed by Esmay (1982).Among them, the THI has been widely used because it assesses the effect of temperature and relative humidity, which are easily accessible in databases, to characterize the environment quantitatively.Therefore, the THI can be measured on the basis of the temperature and relative humidity data, which are obtained directly from databases or by performing measurements in animal facilities, and the obtained results can serve as the basis for decision-making to alleviate animal heat stress.
The prediction of values of meteorological variables is based on the adjustment of empirical models using probabilistic distributions, i.e., stochastic generators of climatic conditions.Bayer et al. (2012), Arroio Júnior & Mauad (2015), Sousa et al. (2015), Andrade et al. (2016), and Machado et al. (2017) have shown that simulation models have several applications.However, the main deficiency of these models is the inability to recognize real data, i.e., they ignore or do not consider the instability of the duration of environmental conditions.These difficulties were overcome by Bilgili & Sahin (2010), Wu et al. (2010), Yasar et al. (2012), andDepiné et al. (2013) using artificial neural networks (ANNs).However, these authors emphasized that models used to estimate meteorological variables required a high amount of observable data to be reliable.
Engenharia Agrícola, Jaboticabal, v.38, n.6, p.844-856, nov./dec. 2018 The application of ANNs has been proposed to model biological processes.Santos et al. (2016) used these computational resources to monitor pigs and obtained accurate results with adequate reliability.Similarly, Miguel et al. (2015) applied neural networks using satellite data to model the volume of wood and biomass of a semi-deciduous seasonal forest.Borges et al. (2017) proposed the use of architectures to estimate the fuel consumption of tractors as a function of performance parameters of mechanized assemblies.Multilayer perceptron networks were used in these studies.Negrete (2018) also used this modeling technique and confirmed the feasibility of applying neural networks and their ability to predict information based on previous data.
These studies allow inferring that ANNs constitute a useful and powerful computational tool for processing meteorological data and that their use may be feasible to estimate the temperature and relative humidity of the air based on climatic information of historical series recorded near animal facilities.Therefore, the present study is based on the hypothesis that these models can provide the necessary elements to characterize the thermal environment of these facilities, helping decision-making for adequate animal husbandry.Problems related to animal heat stress motivated the elaboration of this study.The objective of this study is to predict animal thermal comfort using ANNs for each day of the year according to two meteorological variables: air temperature and relative humidity.

MATERIAL AND METHODS
This study evaluated hourly data on dry-bulb temperature and relative air humidity for a 25-year historical series collected at the Padre Ricardo Remetter Conventional Meteorological Station (code OMN 83364, in operation since January 1, 1986), which is located at the city of Santo Antônio de Leverger (latitude of -15.7833°, longitude of -56.0667°, and altitude of 140 m), in Mato Grosso state (Brazil).These data were available at the Meteorological Database for Teaching and Research of the National Institute of Meteorology and had been collected from January 1, 1992, to December 31, 2017, at 12:00 a.m., 12:00 p.m., and 6:00 p.m.The climate of the region is classified as Aw (tropical climate) according to Peel et al. (2007), with an annual mean temperature of 26.1 °C and annual mean rainfall of 1267 mm (INMET, 2018).
The obtained data were stored in text files and spreadsheets.The maximum THI values on each day of the year were obtained using the filtering and classification tools available in the spreadsheets.The THI was estimated using the equation proposed by Thom (1959) The THI values on each day of the year in the Julian calendar were input and processed using the statistical program R to define the possible architectures of artificial neural networks -ANNs (R CORE TEAM, 2018).Taking as a reference the studies by Binoti et al. (2014a, b), Valente et al. (2014), andBorges et al. (2017), multilayer perceptron ANNs were chosen for predicting this index as a function of the day of the year.After that, several network architectures were defined using the Julian day as the independent input variable and the THI as the dependent output variable, in addition to one or two intermediate layers with up to 25 neurons each.The input and output variables were normalized between 0 and 1 to avoid saturation and consequently errors in the estimated result and then denormalized by applying the equation: Where: Vdnor -Denormalized value (dimensionless); Vnor -Normalized value (dimensionless); Vmin -Minimum value of the dataset (dimensionless), Vmax -Maximum value of the dataset (dimensionless).
Engenharia Agrícola, Jaboticabal, v.38, n.6, p.844-856, nov./dec.2018 Cansian et al. (2014), Georgens et al. (2014), Valente et al. (2014), andBorges et al. (2017) reported that the dataset was randomly divided into two subsets for network training and data validation, corresponding to 75% and 25%, respectively.In all architectures, the logistic function was used to activate the networks, and initial weights between -0.5 and +0.5 were randomly generated.The layers were interconnected by complete synapses, i.e., each neuron of layer i was connected to all neurons of the next layer (i + 1), and each synapse was oriented only forward (feedforward).Moreover, the back propagation of the error was used as a learning algorithm.The learning rate was 0.2, and the momentum rate was 0.8.The stopping criterion of network training was defined as an error rate of less than 0.05.Since the values of the dependent variable ranged between 0 and 1, the chosen function for transfer in the output layer was sigmoid.These procedures were performed in software R using tools for ANNs (R CORE TEAM, 2018).
Sousa & Menezes (2013), Binoti et al. (2014a, b), Georgens et al. (2014), andBorges et al. (2017) indicated that the number of obtained networks could be reduced, and the most appropriate ones should be selected by calculating the coefficient of determination (R 2 ), mean absolute error (MAE), mean square error (MSE), root mean square error (RMSE), and mean percentage absolute error according to the following equations: The normality of residuals of the neural networks with the best indexes was assessed using the Kolmogorov-Smirnov, Lilliefors, and Shapiro-Wilk tests, and the adjustment between the observed and estimated values was confirmed using the Student's t-test, as suggested by Borges et al. (2017).Moreover, taking as reference the studies of Binoti et al. (2014a, b), Georgens et al. (2014), Soares et al. (2014), and Borges et al. (2017), the correlation coefficients (r), Willmott's index of agreement (Iw), and performance index (Id) were calculated, and the latter index measures the proximity between the observed and estimated values.Dai et al. (2014), Rodrigues et al. (2015), Sousa et al. (2015), Brighenti et al. (2016), Chaves et al. (2016), Lopes et al. (2016), andMachado et al. (2017) recommend evaluating the efficiency of the networks using the Nash-Sutcliffe coefficient (NSC) (Nash & Sutcliffe, 1970) according to equation: Although the presented analytical criteria confirmed the accuracy of the networks in predicting the THI, Borges et al. (2014Borges et al. ( , 2017) ) recommend graphically evaluating the characteristics of the residuals to assess the presence of inadequate trends in their distribution.For this purpose, different graphs should be prepared, including the histogram of residuals, a quantile-quantile plot with confidence intervals, a graph with the values of the residuals as a function of the estimated values, a graph with the values of the residuals according to the day of the year (independent variable), and a scatter plot with the observed values and values estimated by each selected network for each day of the year.

RESULTS AND DISCUSSION
In this study, 62 artificial neural network architectures were tested.Each network contained an input layer, one or two intermediate layers (hidden), and one output layer.The increase from one intermediate layer to two increased the accuracy of the results.However, the increase in the number of neurons in these layers did not improve the performance of the networks.The results of 10 ANNs with satisfactory coefficients are shown in Table 1.The best indexes were obtained using architectures 2, 4, 6, and 7, evidenced by the highest coefficient of determination (R²) and the smallest values for MAE, MSE, RMSE, and MAPE.The obtained coefficients of determination (>0.9) were lower than those estimated by Binoti et al. (2014a, b), Georgens et al. (2014), andBorges et al. (2017).These differences may be due to the high daily oscillation of temperature and humidity values over the years, resulting in differences between the observed and estimated values.However, these four architectures presented coefficients of determination higher than 0.7, which is the minimum value accepted in this study to indicate adequate adjustment.
The Kolmogorov-Smirnov, Shapiro-Wilk, and Lilliefors tests applied to the residuals of these four networks showed a probability higher than 0.05 (Table 2), indicating that the hypothesis of normality of data distribution can be accepted.No significant difference was found between the observed values and the values estimated by these four networks according to Student's t-test considering the high probability value obtained (>0.99) (Table 2).These results are essential to obtain an adequate adjustment between observed and estimated values.Legend: D, W, and t, statistics; p, p-value; ns, not significant.
Engenharia Agrícola, Jaboticabal, v.38, n.6, p.844-856, nov./dec. 2018 In this study, the results of the three normality tests were similar.Nonetheless, the Shapiro-Wilk test was very efficient for all data distributions and sample sizes, as reported by Amador et al. (2011) andPino (2014).Student's t-test provided higher data reliability considering the assumption of normality of residuals, although this test was robust to small variations in data distribution.The results indicate that the values of the residuals follow a symmetrical distribution, and the estimated values were not significantly different from the observed values.
Table 3 shows a summary of determination coefficients and performance and efficiency indexes.A good performance and excellent efficiency were demonstrated by the high NSC.These values were similar for the four neural networks, indicating that they were satisfactorily predicted the THI and might yield similar results with high accuracy.However, the results of the architecture of neural network seven were better (Table 3).TABLE 3. Summary of the results of performance and efficiency of the artificial neural networks.For the four neural networks, the distribution was symmetrical and similar to a normal distribution, i.e., most values were concentrated around the mean, and few values were found at the extremities (Figure 1).Most of the coordinate points formed by the theoretical quantiles and residuals were close to the reference line or bisector, a few points were located on the tails, and all points were located within the 95% confidence intervals (Figure 1).This result indicates that the distribution of the residuals was normal, which increases the reliability of the estimation of THI values by these networks.
The validity of the assumption of independence can be qualified using the scatter plot of the residuals according to the order of collection of the observed data.For this purpose, standardized residual diagrams were created as a function of the estimated temperature and humidity and day of the year (Figures 3 and 4).At the vertical axis, two horizontal lines, which passed through the values corresponding to standardized residuals -2 and +2, were included to facilitate the identification of the number of points with the largest deviations from the observed data (Figures 3 and 4).Most residuals were located near the horizontal line with a value of zero and concentrated predominantly in the range from -2 to +2, and few points in the four ANNs were located outside this range (Figures 3 and 4).Continuous sequences of positive and negative residuals were absent.
Furthermore, patterns of signal alternation were absent, i.e., the residuals were randomly distributed along the horizontal line centered on the value 0 (Figures 3 and 4).This satisfactory distribution confirms the independence of the residuals according to the order of data collection and corroborates the high efficiency of the networks in estimating the THI with adequate precision.
After confirming the adequate performance and high efficiency of these four networks selected by analytical and graphical analyses, a scatter plot was created to represent the observed and estimated THI values as a function of the day of the year (Figure 5).The estimated values followed the same trend of the observed values of the said variable and were not significantly different between them, and the corresponding curves were similar.
Engenharia Agrícola, Jaboticabal, v.38, n.6, p.844-856, nov./dec.2018 The values estimated by the four ANNs followed the same trend of the observed values (Figure 5).It is worth noting that the existence of five well-defined stages in the variability in the THI throughout the year: increase in the index in the first 4 months, decrease in the fifth month, constancy in the sixth and seventh months, increase up to the ninth month, and decrease until the last month of the year (Figure 5).The THI values were higher than 78 along the year and reached peaks above 82 during the ninth and tenth months (Figure 5).According to the scale proposed by Thom (1959), THI values between 78 and 82 indicate a dangerous situation, i.e., the animals are stressed, and values above this range indicate a state of emergency, which may lead to death.Therefore, these results demonstrate the usefulness of the networks developed to assist farmers in adopting measures that guarantee the well-being of animals during handling.
Furthermore, these findings indicate the excellent ability of ANNs to estimate or predict values with adequate accuracy, despite the high variability of the daily temperature and humidity data used in computational processing, and corroborate the results of Binoti et al. (2014a, b), Georgens et al. (2014), and Borges et al. (2017).It should be noted that the evaluated networks satisfactorily detected the climatic seasonality of the region, indicated by the THI, which is essential for the adequate husbandry of animals, especially those in confinement.

CONCLUSIONS
Multilayer perceptron artificial neural networks formed by two hidden layers containing three to seven neurons were efficient in predicting the thermal comfort of animals as a function of the day of the year.These networks made predictions with adequate reliability and precision, which justifies their use in the husbandry and management of animals, especially those in confinement.
10) Engenharia Agrícola, Jaboticabal, v.38, n.6, p.844-856, nov./dec.2018 Where: r -Correlation coefficient (dimensionless); N -Total number of observations (dimensionless); THIobsi -Real THI for observation i (dimensionless); THIesti -Estimated THI for observation i (dimensionless); THIMobs -Real mean THI (dimensionless), THIMest -Estimated mean THI (dimensionless).'s index of agreement (dimensionless); N -Total number of observations (dimensionless); THIobsi -Real THI for observation i (dimensionless); THIesti -Estimated THI for observation i (dimensionless); THIMobs -Real mean THI (dimensionless), THIMest -Estimated mean THI (dimensionless).-Sutcliffe efficiency coefficient (dimensionless); N -Total number of observations (dimensionless); THIobsi -Real THI for observation i (dimensionless); THIesti -Estimated THI for observation i (dimensionless), THIMobs -Real mean THI (dimensionless).EngenhariaAgrícola, Jaboticabal, v.38, n.6, p.844-856, nov./dec.2018 .9999 (ns) 7) MLP 1:1-7-5-1:1 D = 0.0293 p = 0.9130 (ns) W = 0.9974 p = 0.8295 (ns) D = 0.0293 p = 0.6268 (ns) t = 0.0052 p = 0.9958 (ns) coefficient (r) values for the four selected neural networks were lower than those obtained byBinoti et al. (2014a, b),Georgens et al. (2014), andBorges et al. (2017).These differences may be due to the initial data on temperature and relative air humidity used in this study, which were affected by variations in the climatic conditions of the region.In contrast, the obtained NSC values were higher than those estimated bySousa et al. (2015),Brighenti et al. (2016),Chaves et al. (2016),Lopes et al. (2016), andMachado et al. (2017).These differences may be because of the high number of observations used in the present study, which increased the efficiency of the networks.Moreover, the architectures defined in this study may have contributed to an adequate approximation between estimated and observed values and, consequently, to the increased efficiency of these architectures.The results of the analytical tests confirmed the normality of the residuals of the neural networks, and their adequate adjustment, performance, and efficiency.However, the graphical analysis allowed visualizing the distribution of the residuals for the assumptions of normality and independence, and the presence of values significantly different from observed values (outliers).In this respect, the premise of data normality was assessed using a histogram of the probability density corresponding to the standardized residuals and a normal probability plot of the standardized residuals with 95% confidence intervals (Figures1 and 2

FIGURE 4 .
FIGURE 4. Scatter plots of standardized residuals as a function of the day of the year.

FIGURE 5 .
FIGURE 5. Scatter plot of the temperature and humidity index as a function of the day of the year.

TABLE 1 .
Indexes of the studied artificial neural network architectures.

TABLE 2 .
Results of normality tests and adjustment of four artificial neural networks. ).