Environment humidity and temperature prediction in agriculture using Mamdani inference systems

ABSTRACT


INTRODUCTION
As humankind's part in agriculture evolves from survival and circumstantial crops to commercial ones, the system complexity evolves too, and the degree of knowledge required for successful cropping increases [1]. According to the changes on the climate, the best-suited areas for any crop can be modified and multiple variables like the temperature and humidity of the zone that can affect the crops' performance, and its impact on the soil use, the biodiversity, the region's socio-economics, the agricultural production, and other, must be carefully evaluated [2]. Bearing in mind the massive application of the information and communication technologies (ICT), its influence on agricultural production, and how it gathers the products of the internet and big data eras [3], management and environmental information during the cropping process play a key role in the prediction of fore-coming climate changes [4].
A web applied monitoring system that uses sensors located in strategic places along a plant field allows users to monitor the crop status anywhere, and anytime, from any device with remote access capabilities [5]; therefore, the prediction on variables as temperature and humidity can be made from different data attained from similar systems. Nevertheless, such forecasting requires efficient algorithms as the Stochastic gradient descent algorithm that would give it a greater accuracy, hence, it is necessary to apply  [6]. Ensuring a certain degree of interpretability is as important as accuracy so it could be understood by any person if needed, to accomplish that aim the use of an intuitive Mamdani fuzzy inference systems (configured by multiple conditional rule sets) could be a suitable solution [7,8].
Neural networking, usually used in black box systems, is a technology that also contributes to the study of the dynamic behavior of climate; in the agricultural field, its application eases the water use balance in irrigation [9,10]. Furthermore, computer models capable of predicting climate behavior and the impact of greenhouse gases on earth's temperature were developed some decades ago, however, these models only analyze the CO2 related variables [11], presence, and concentration, when research has shown there are many others involved [12]. The most recent models to predict temperature and humidity related variables are mathbased (using Navier-Stokes equations) or computer-based (simulations on the earth's physics for the atmosphere and oceans), both, commonly used to study climate change based on global predictions over atmospheric and oceanic phenomena [13][14][15][16][17]. As developed as the field appears to be, there are only a few models for both temperature and humidity prediction focused on local settings, some of these use just one model type (usually through mechanisms or experience) targeted for small mediums with equipment for heating and humidity control [18].
This research intends to combine a fuzzy inference system for both temperature and humidity prediction with an optimization technique to improve the interpretability of the fore-mentioned techniques and generate adequate data for the management of these variables. The use of Mamdani fuzzy inference systems allows a high degree of interpretability that is necessary for better understanding by non-specialized users [7,8]. The remainder of the paper is organized as section 2 research method, section 3 results and discussions and section 4 conclusion.

RESEARCH METHOD
This research is carried out in two stages: the first stage comprehends a process of data recollection while the second stage involves a proposal development process within an iterative and increasing short life cycle as shown in Figure 1. The proposal development follows a prototyping paradigm due to the uncertainty of the performance of the algorithms used [19].

Data recollection
For this research, the input set is determined by the measure values for both temperature and humidity registered 48 hours before the prediction day, and for the output set, the values were obtained during the prediction day. All the values were taken from the periodic register for Bogotá, Colombia, made by "Instituto de Hidrología, Meteorología y Estudios Ambientales" (IDEAM) [20].

Proposed methods
Two proposals based on Mamdani fuzzy inference systems are used for this research, both will be optimized whether through a genetic algorithm or a Quasi-Newton algorithm [21][22][23]. The proposal development process follows a quick method for evolutive models based on software prototyping [19] comprised for five steps: Communication, quick planning, modeling and quick design, prototype construction and application, delivery and feedback.  foster an adequate implementation and a correct optimization. -Prototype construction and application: If the design is feasible, the proposal is tested using the dataset and the predicted values for both temperature and humidity are verified using a MATLAB toolbox [24]. If any requirement cannot be fulfilled or it is necessary to add any function to the system, another complete cycle for the previous stages will be required. At the end of the development process, mean squared error (MSE) defined as ) and the effectiveness rate for each proposal is calculated in every variable as (%) = (1 − √ ) * 100. This final step would determine the best prediction model in this work [25].

RESULTS AND DISCUSSION
The Mamdani fuzzy inference system uses a centroid defuzzification. The model is made up of three fuzzy sets with three membership functions and a set of rules that relates them all and describes the system. The initial parameters of the fuzzy sets in the genetic algorithm were defined randomly from a range between minimum and maximum values determined by statistical analysis. The parameters in the Quasi-Newton algorithm were obtained by the best performance of the genetic algorithm. This excerpt presents the results for both model proposals and the comparison of their outcomes on the prediction of the values for both temperature and humidity.

Mamdani fuzzy inference system optimized with genetic algorithm
The genetic algorithm is set to a 50 individuals population, 200 generations, and an initial population range between |0.6, 2| for temperature measured in Celsius degrees and |0.5, 1| for percent relative humidity. The fitness function, for both variables, is defined as the MSE for normalized data. The Mamdani system in which the algorithm is applied possesses two inputs divided into triangular type sets (trimf) and a triangular output for both variables. The optimization method was applied to a set of 27 parameters that represent the values of the points of the triangular membership functions. After 30 iterations, the minimum and maximum errors, as well as the MSE, are calculated for each iteration. The average MSE for humidity and temperature are 9.09 E-04 and 5.39 E-03. with standard deviations of 2.80 E-40 and 1.95 E-03, respectively. The series, E1..., E30, correspond to the genetic algorithm iterations with random configurations in every execution and ̅ relates to the mean value of each column as shown in Table 1.
The comparison between the predicted and obtained humidity data is shown in Figure 2, where the x-axis represents the period analyzed (24 hours) and the y-axis the humidity values. As observed in the Figure 2, iteration E19 had the best performance values as presented in Table 1. E19 also reports an MSE of 4.24 E-04 as shown in Figure 3, where the error through time relationship for the predicted and obtained humidity data oscillates between 0.06 and 0.03. The comparison between the predicted and obtained temperature data is shown in Figure 4, where the iteration E26 shows the best performance values see in Table 1 and an MSE of 2.84 E-03. Figure 5 shows the error through time relationship for the predicted and obtained temperature data oscillates between 0.1 and -0.2.

Mamdani fuzzy inference system optimized with Quasi-Newton algorithm
The Quasi-Newton algorithm is set to an initial configuration based on the feedback from the aforementioned Mamdani fuzzy inference system optimized with a genetic algorithm. The optimization method was applied to a set of 27 parameters that represent the values of the points of the triangular membership functions. The fitness function for both variables is defined as the MSE for normalized data. The minimum, maximum, and average error values for this configuration are shown in Table 2.
The comparison between the predicted and obtained humidity data for the period analyzed (24 hours) is shown in Figure 6. Figure 7 presents the model MSE, 1.21 E-04, and the error through time relationship for the predicted and obtained humidity data that oscillates between 0.02 and -0.03. The comparison between the predicted and obtained temperature data for the period analyzed (24 hours) is shown in Figure 8. Figure 9 presents the model MSE, 2.03 E-03, and the error through time relationship for the predicted and obtained humidity data that oscillates between 0.01 and -0.15. Table 3 shows the results and effectiveness percentages (calculated from the RMSE) for both configurations; the best performance configuration is the proposal for Mamdani fuzzy inference system optimized with a Quasi-      Figure 10 shows the humidity Mamdani fuzzy inference system optimized with a Quasi-Newton algorithm, where (a) is the first-day input sets; (b) is the second-day input sets; (c) is the output set that represents the third-day prediction. The mentioned sets are related through qualitative ranges for humidity (high, medium, low) and their membership degree between zero and one for each domain. Figure 11 shows the temperature Mamdani fuzzy inference system optimized with a Qasi-Newton algorithm, where (a) is the first-day input sets; (b) is the second-day input sets; (c) is the output set that represents the third-day prediction. The mentioned sets (defined using membership functions type trimf) are related through qualitative ranges for temperature (high, medium, low).

Results' comparison
The correspondence between humidity and temperature values obtained from the set of rules, as well as its interaction with the fuzzy sets generated by the algorithm, is graphically described in the   If humidity value is low the previous two days, humidity value on the forecast day will be low. If humidity value oscillates between high and medium the previous two days respectively, humidity value on the forecast day will be medium. If humidity value is high the previous two days, humidity value on the forecast day will be high. If humidity value is low the previous two days, humidity value on the forecast day will be low. If humidity value oscillates between high and medium the previous two days respectively, humidity value on the forecast day will be medium. If humidity value is high the previous two days, humidity value on the forecast day will be high.

CONCLUSION
The use of fuzzy logic to present a solution has great advantages as this system is highly rated for interpretability, furthermore, by relating the obtained values for environment humidity and temperature to qualitative categories as high, medium or low, it allows non-specialized users to understand the system dynamics. Through this research, we have generated two models highly interpretable and accurate to predict the environment humidity and temperature values based on two fuzzy inference systems with three membership functions (low, medium, and high values) each. According to the results, the best prediction performance is obtained when using a Mamdani fuzzy inference system optimized with a Quasi-Newton algorithm: 1.21 E-04 MSE for humidity values and 2.03 E-03 for temperature values. It is important to note that the initial values for this model are attained through an optimization process with a genetic algorithm.