Prediction of temperature and relative humidity in a greenhouse in South China based on machine learning

Machine Learning


Experimental materials

This study was conducted at the Baiyun test base (113°25'44'' E, 23°23'30'' n) at Guangzhou Academy of Agricultural Sciences. The greenhouse was 30 m long, 32 m wide and 5.6 m high. The Venlo greenhouse used in this experiment was equipped with a fan pad system, skylights, side windows, internal and external sunshade curtains, and cooled by a fan pad system. The length, width and thickness of the fan pad system were 16 m, 1.2 m, and 0.2 m, respectively. The greenhouse is equipped with four fans, with 1.2 m side length and 1.1 kW of power2. This study was conducted over a total of 44 days from April 27 to June 11, 2021. During the experiment, data on greenhouse temperature and relative humidity were collected. There are nine sensors (Elitech RC-4, -30-60°C ±0.1°C; 0–99%RH ±3%RH, Jiangsu Jinchuang Electric Co., Ltd., Xuzhou, China) (Figure 1). The data recording interval was 15 minutes, with a total sample of 4300. The average temperature and relative humidity of the 9 sensor was calculated as greenhouse temperature and relative humidity and used as a data set (Fig. 2). Data fusion was introduced due to the inherent differences in temperature and relative humidity readings at sensor locations and the possibility of inaccurate data caused by sensor failure or data redundancy.

Figure 1
Figure 1
Figure 2
Figure 2

Variations in average temperature and relative humidity in a greenhouse.

Radial basis function (RBF) model

The structure of an RBF network is similar to a multi-layer forward network, and is a three-layer forward network. The input layer consists of signal source nodes. The second layer is a hidden layer. The number of hidden elements depends on the needs of the problem described. The hidden element transformation function is the RBF radial basis function, a non-negative nonlinear function with central symmetry and attenuation to the center point. The third layer is the output layer, which responds to input mode behavior. The conversion from input space to hidden layer space is nonlinear, while the conversion from hidden layer space to output layer space is linear. RBF networks show significant advantages over other neural network types, such as simpler structures and faster learning models. This is a highly performant feedforward neural network model that proves universal approximation capabilities without local minimum problems.twenty two. The RBF network configuration is shown in Figure 3. The nonlinear activation output is linearly combined with the output layer weight vector to produce a network output ym.

$$ {y_m} = \sum \limits _ {{i = 0}}^{m} {{\beta _i} {\varphi _i}} $$

(1)

where, BetaI The joint weight value of itth The basis function. The most commonly used radial base is the Gaussian function given as follows:

$${\varphi _i}(x)=\exp\left({ -\frac {{{\left \|{x -c_i}}\right \|}}}}}}}}}}^{2}}}}}}}}}}}}

(2)

where, cI and σI It is the center and the spread of itth RBF node.

Figure 3
Figure 3

RBF network configuration.

Least Squares supports Vector Machine (LSSVM) models

The Support Vector Machine is a monitored learning model that can be used for classification and regression. In SVM, data is represented in N-dimensional space, allowing you to predict whether a new training example belongs to the same or different categories. The main goal of SVM is to find hyperplanes in N-dimensional space where logarithmic data points can be classified. To distinguish between two types of data points, several potential hyperplanes can be selected. However, the ideal hyperplane maximizes the margin between the two types of data points, as shown in Figure 4. Hyperplanes are decision boundaries and help to distinguish between data points. Data points on either side of the hyperplane can be attributed to a variety of classes. The size of the hyperplane depends on the number of featurestwenty three. Hyperplanes can use expressions. (3):

$$ \overrightArrow w \cdot \overrightArrow x +b = 0 $$

(3)

where \(\ overrightArrow w \) A normal vector of a hyperplane. \(\ overrightArrow x \) This is a set of points. The margin width is (2/w).

Figure 4
Figure 4

Supports vectors and spacing.

Traditional SVMs rely on quadratic programming solvers with high computational complexity and slow convergence. LSSVM solves linear equations, greatly reducing computational time, making it suitable for real-time prediction scenarios. The normalization term in LSSVM effectively suppresses outlier interference and, in combination with robust kernel functions, reduces the effect of small variations in input data on the model output. For time-varying data, LSSVM combines dynamic optimization models to adjust model parameters in real time to match changes in data distribution and improve long-term predictive stability. LSSVM transforms SVM quadratic programming problems to solve linear equations, replacing traditional SVM loss functions with least squares loss functions. This reduces resolution complexity and sensitivity to noise, and improves prediction accuracy.

Back propagation particle swarm optimization (BPPSO) model

Neural networks have excellent nonlinear mapping and self-learning capabilities, with the most popular being backpropagation (BP) neural networks.twenty four. This is a multi-layer feedforward neural network trained by an error-back propagation algorithm. However, some calculated values in the BP model are easily classified into local optimal values in the calculation process, so the weights and thresholds in the BP model must be optimized using optimization algorithms. ANNs are excessively excessive when dealing with complex network structures and redundant parameters, especially nonlinear dynamic data in greenhouses.twenty five. ANN-dependent gradient descent easily falls into local optimization and reduces prediction accuracy. Ann training relies on iterative gradient descent, slow convergence rates and requires much data support, making it difficult to meet real-time forecast demands. Anne is sensitive to input noise and when the network structure is fixed, prediction stability decreases.

Particle Swarm Optimization (PSO) algorithms rely heavily on determining the spatial velocity and location of updates in evolutionary particle populations.26. During the process of parameter optimization, standard PSO algorithms are prone to early convergence, making it difficult to find a global optimal solution that leads to limited accuracy of the model. Random initialization of particle groups results in unclear convergence paths, many iterations, and less efficient in traditional PSOs. The parameters of the standard PSO are fixed, which makes it difficult to adapt to the time-varying environment of the greenhouse, and the results of optimization vary widely.

By introducing dynamic inertial weights or gradient information, BPPSO balances global exploration and local development capabilities, avoiding early convergence and improving parameter optimization accuracy. At the same time, multiple hyperparameters in predictive models, such as neural networks and weights of kernel function parameters, are optimized to reduce artificial deviations in parameter adjustments, and improve model adaptability to complex greenhouse data. The learning factors of the particle cluster are dynamically adjusted according to the optimization stage, accelerating the convergence process. Combined with the gradient descent direction of the BP algorithm, it provides local and optimal solution guidance for particle swarms, and Shorters uses search paths to reduce invalid iterations. Dynamic adjustment of particle swarm parameters according to environmental data increases the adaptability to the time-varying properties of the greenhouse effect. Outlier interference is suppressed by normalization strategies or robust loss functions, and the model's interference prevention capabilities are improved by combining stable parameters optimized by the PSO. Therefore, the PSO algorithm can be used to optimize the BP model for temperature prediction in the greenhouse (Figure 5).

Figure 5
Figure 5

BPPSO working flow chart.

Data Processing

Samples were taken from the average temperature and relative humidity calculated by nine sensors collected in the greenhouse mentioned in the “Experimental Materials” section. The training set, validation set test set, and their ratio were set to 7:1:2. According to previous studies, six different time intervals were selected to study the effects of different time intervals on the prediction accuracy of different models (Table 1).

Table 1. Splitting of training and validation groups.

The model adopted for temperature prediction in this study was programmed with MATLAB 2018A on a second generation Intel(R) Core(TM) I9-12900 computer, and the LSSVM toolbox was adopted from MATLAB 2018A. The model time intervals are as follows:

Step 1: Historical temperature data was collected and cleaned to remove missing or outliers. Furthermore, the data were normalized to facilitate model training.

Step 2: Data was split into feature sets (inputs) and label sets (outputs), then further split into training sets, validation sets and test sets.

Step 3: Set the parameters for each of the three models. The fitness accuracy of the normalized sample was set to 0.001. The expansion rate of the radial basis function was set to 1000 for the RBF model. For BPPSO models, the training frequency was set to 1000 and the target error was set to 10– 6the learning rate was set to 0.01. c1 and c2 Both were set at 4.494, population size was set to 5, and population update frequency was set to 30. Kernel parameters, penalty parameters are set to 100 and used f Regression and c Classification of LSSVM models.

Step 4: Training the model and calculating the model's performance index. Analyze the model's prediction results to determine the accuracy and generalization capabilities of the model.

Step 5: We predicted the test set using the model and obtained the prediction results.

Model Evaluation Index

Root Mean Square Root Error (RMSE), Mean Absolute Error (MAE), Mean Absolute Percent Error (MAPE), and Measurement Coefficient (R r)2) was used to assess the predictive power of the above models. The best predictive model was chosen as the lowest error and best correlation. The index was calculated from the following equation:

$${\text {mae}} = \frac {1}{n} \sum \limits _{{i = 1}}^{n} {\left | {y_ {i} – x_ {i}} \right |} $$

(4)

$${\text{rmse}} = \sqrt{\frac{1}{n}\sum\limits_{{i=1}}^{n}{\left({y_{i} – x_{i}}\right)

(5)

$$ {\text {mape}} = \frac {1} {n} \sum \limits_ {i}^{n} {\frac {{| x_ {i} – y_ {i} |} {{x_ {i}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}

(6)

$$ {\text {r}}^{2} = \frac {{\left[ {\sum\nolimits_{{i = 1}}^{n} {\left( {X_{i} – \bar{X}} \right)} \left( {Y_{i} – \bar{Y}} \right)} \right]^{2}}} {{\sum \nolimits _{{i=1}}^{n} {\left({x_{i} – \bar {x}} \right)^{2}}} \sum \nolimit {y_{i} – \bar {y}} \right)^{2}}}} $$

(7)

where xI and yI Represents what was measured and predicted in ITime intervals for each. \(\overline {{{x_i}}} \) and \(\overline {{{y_i}}} \) Represents the corresponding average. n The number of data. Closer r2 From 1, a better model runs. Mae, Mape, and RMSE all range from 0 (the perfect fit) to ∞ (the worst fit).



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *