Prediction Model of Greenhouse Tomato Yield Using Data Based on Different Soil Fertility Conditions

.


Introduction
The greenhouse environment is a complex system with multivariable, nonlinear, and strong coupling [1][2][3].In China, the tomato is the main cultivated greenhouse crop; therefore, predicting greenhouse tomato yield has important practical significance and application value.Recently, many scholars have studied prediction models of greenhouse tomato yield, with the research methods mainly being divided into two types: mechanism models and data-driven models [4][5][6].Mechanism models express the relationship among greenhouse environmental factors, cultivation methods, and the crop growth and development process.Classic mechanism models include the TOMSIM model [7,8], the TOMGRO model [9][10][11], the Vanthoor model [12][13][14], and the integrated model [15].Datadriven models can determine the correlation between research factors by analyzing a large amount of available data.The structure of a data-driven model is simple and focuses on predictability and practical application.This paper investigates a data-driven greenhouse tomato yield prediction model.In recent years, data-driven technology has been proved to overcome the shortcomings of mechanism models and be more accurate in modeling complex engineering problems [16][17][18].
In recent years, neural networks (NN) have received extensive attention in the application of prediction models [19][20][21][22].A neural network has a large-scale parallel processing structure, efficient computing speed, strong adaptability, and good self-organizing and self-learning abilities, possessing certain advantages for nonlinear system modeling.These characteristics enable the neural network to be widely used in numerous fields.Many researchers have applied neural networks to greenhouse production systems by garnering its ability to learn and simulate complex nonlinear relations.Therefore, neural network technology is widely used in the prediction modeling of different agricultural indexes, such as yield, growth, and biophysical processes [23][24][25].Fitz-Rodríguez proposed using a dynamic neural network to model and predict the weekly yield of greenhouse tomatoes, employing fuzzy logic to describe the growth pattern of the greenhouse tomato plants [26].Based on a genetic algorithm, Qaddoum proposed a modified hybrid adaptive neural network with a modified adaptive smoothing error; the model used the environmental variables measured in the greenhouse as input to predict the weekly yield of tomatoes [27].Chen proposed a tomato yield prediction model based on a wavelet and back-propagation (BP) neural network [28].Salazar proposed a dynamic artificial neural network model based on a layered digital neural network (LDDN) to predict greenhouse tomato yields; the experimental results showed that LDDN can be used to predict greenhouse tomato yields one week in advance [29].Liu captured video surveillance images of the tomato-ripening process: neural networks identified images and extracted growth features to identify the number of tomatoes hanging on plants, thereby establishing an estimation model of tomato yield [30]. Ashapure proposed a new machine learning model based on artificial neural networks to predict tomato yield [31].Alhnaity used long short-term memory (LSTM) neural networks for modeling; machine learning and deep learning techniques were used to predict yield and plant-growth changes under different scenarios [32].In order to avoid the problem of a gradient-descent learning algorithm falling into a local minimum, Wang adopted a wavelet neural network with faster convergence [33,34], finally proposing a wavelet neural network model based on a genetic algorithm to improve the prediction accuracy of tomato yield in a Chinese solar greenhouse [35].Belouz used an artificial neural network combined with sensitivity analysis to predict greenhouse tomato yield and compared the results of the artificial neural network model to those of a multiple linear regression (MLR) model; the results showed that the predictive effect of the artificial neural network model was more accurate than that of the MLR model [36].
Previous studies have shown that neural network models are effective in predicting greenhouse tomato yield.However, the above model still has limitations, such as high computational complexity and slow convergence speed, and can easily fall into local optimum.The particle swarm optimization algorithm (PSO) can avoid the above problems [37][38][39], and its implementation process is mainly to update the position and speed of each particle, thus reducing the computational complexity and implementation difficulty.Particularly when dealing with large-scale problems, the PSO algorithm has higher computational efficiency and can quickly find the global optimal solution.Consequently, this paper employs the PSO algorithm to optimize the parameters in the neural network prediction model.
At the same time, in order to predict the greenhouse tomato yield more accurately, this paper improved the PSO algorithm by an adaptive inertia weight and escape strategy, which further improved the robustness and stability of the model and the global optimization ability of the algorithm.The advantage of the neural network prediction model based on the improved PSO algorithm is that not only does it have a simple structure, but it also improves the accuracy of the prediction results, thereby demonstrating the effectiveness and superiority of the proposed greenhouse tomato yield prediction model.
The objectives of the research described in the paper are as follows: 1.
To apply a PSO algorithm to a pre-trained neural network model to predict greenhouse tomato yield.

2.
Based on the existing defects of the PSO algorithm, to propose improvement measures to improve the performance of the PSO algorithm.

3.
To evaluate and compare the performance of different improved PSO algorithms in greenhouse tomato yield prediction. 4.
To determine which neural network prediction model performs best in terms of greenhouse tomato yield prediction.
The main contributions of this paper are as follows: 1.
In this paper, a total of 390 sets of experimental data were extracted from 12 provinces and cities from 1999 to 2020.The extracted experimental data were classified according to three different soil fertility grades (low, medium, and high) based on the classification standard of soil nutrient indexes for tomato production in solar greenhouse facilities.

2.
In order to address the problem of the PSO algorithm easily falling into the local optimal value, this paper is the first to employ a dynamic adaptive inertia weight to improve the PSO algorithm, enabling it to jump out of the local optimal value in time, to improve its efficiency.

3.
The PSO algorithm based on dynamic adaptive inertia weight is further improved by using an escape strategy; this increases the diversity of the particle population through a mutating operation, thus improving the possibility of particles jumping out of the local optimal value.4.
We compared the performance of the NN prediction model, the neural network prediction model based on the PSO algorithm (PSO-NN), the neural network prediction model based on the PSO algorithm with adaptive inertia weight (AIWPSO-NN), and the neural network prediction model based on the improved PSO algorithm (IPSO-NN) in greenhouse tomato yield prediction experiments under different soil fertility conditions.We demonstrate that the IPSO-NN prediction model is the optimal prediction model for greenhouse tomato yield.
The remainder of this paper is structured as follows: in Section 2, the materials and methods are introduced, and the sources of data used in modeling, the four different prediction models and evaluation index are described.In Section 3, the objective function and evaluation index of the model are given, the model parameters are determined, and four different greenhouse tomato yield prediction models under different soil fertility conditions are simulated.Section 4 discusses the effectiveness and superiority of the proposed greenhouse tomato yield prediction model.Finally, the content of this paper is summarized in Section 5.

Data Source
The experimental data used in this paper were extracted from the Web of Science and CNKI databases; the literature was screened based on the following criteria: (1) large tomatoes (excluding potted tomatoes, processing tomatoes, and cherry tomatoes); (2) solar greenhouses (excluding multi-span greenhouses and cold greenhouses); (3) data on fertilizer application rate containing N, P, and K (excluding foliar spraying); (4) yield data; (5) soil background nutrient data; (6) planting density data; (7) sufficient information provided to calculate the effective accumulated temperature during the growth period; and (8) experimental area within China.
Based on the classification standard for soil nutrient indexes for tomato production in solar greenhouse facilities, 390 sets of experimental data were divided into low, medium, and high soil fertility grades (see Tables 1-3).In this paper, planting density, organic fertilizer N, P, and K data, inorganic fertilizer N, P, and K data, and effective accumulated temperature data (based on the effective accumulated temperature calculation method to calculate the meteorological data during the production period in the production area) were selected as the eight input data points for the greenhouse tomato yield prediction models; greenhouse tomato yield was selected as the output data of the model.

Prediction Model Based on Neural Network
A neural network model is composed of an input layer, hidden layer, and output layer, and possesses the characteristics of self-organized learning, strong adaptability, and excellent prediction ability, so it is widely used in various fields [40][41][42][43].
A BP neural network is a feedforward neural network; its learning process is divided into two parts: forward transmission and backward transmission.In the forward transmission, the information is transferred from the input layer to the hidden layer and finally to the output layer, and in which the state of each neuron is only related to the neurons connected to it in the previous layer.If the deviation between the output of the neural network and the real target value is large, reverse learning occurs.The learning rule is to use the steepest descent method to continuously adjust the weight and threshold of the network through back propagation to minimize the sum of the square of errors of the network, so that the predicted output of the BP neural network can approach the expected output.The structure of a three-layer BP neural network is shown in Figure 1.
use the steepest descent method to continuously adjust the weight and threshold of the network through back propagation to minimize the sum of the square of errors of the network, so that the predicted output of the BP neural network can approach the expected output.The structure of a three-layer BP neural network is shown in Figure 1. ; the weight from the input layer to the hidden layer is , and the threshold is ) 2 ( j  ; the weight from the hidden layer to the output layer is , and the threshold is The neuron output j u in the hidden layer and the neuron output k y in the output layer are, respectively: where the activation function can select different functions according to the actual situation.

Neural Network Prediction Model Based on Particle Swarm Optimization Algorithm
For the neural network model, if the error back-propagation algorithm is used to train the model, it easily falls into the local extremum problem because of the local search characteristic of the algorithm.The PSO algorithm is an evolutionary algorithm proposed by Kennedy and Eberhart that imitates bird foraging behavior through particles.It relies on the memory of the bird's own position and the information exchange mechanism within the swarm, so that the bird can quickly locate the target position [44][45][46].The PSO algorithm can greatly reduce the possibility of falling into the local optimal solution, and has the characteristics of easy implementation and fast convergence.
In the PSO algorithm, each particle has its own position, velocity, and memory, and serves as a point in the search space.After initializing the particle population, the fitness value of each particle is calculated.In each iteration, each particle updates its own historical best position and global best position found in the entire population.The goal of each particle is to search the space of the feasible solution so that the optimal solution can be found.At the beginning of the algorithm, the initial particles may be far away from the Suppose the input x is a real vector, x ∈ R l , x = (x 1 , x 2 , • • • , x l ) T ; the output y is a real vector, y ∈ R n , y = (y 1 , y 2 , • • • , y n ) T ; the hidden layer has m nodes, and its output u is a real vector, u ∈ R m , u = (u 1 , u 2 , • • • , u m ) T ; the weight from the input layer to the hidden layer is w , and the threshold is θ k ; and they are all real numbers.The neuron output u j in the hidden layer and the neuron output y k in the output layer are, respectively: where the activation function f (•) can select different functions according to the actual situation.

Neural Network Prediction Model Based on Particle Swarm Optimization Algorithm
For the neural network model, if the error back-propagation algorithm is used to train the model, it easily falls into the local extremum problem because of the local search characteristic of the algorithm.The PSO algorithm is an evolutionary algorithm proposed by Kennedy and Eberhart that imitates bird foraging behavior through particles.It relies on the memory of the bird's own position and the information exchange mechanism within the swarm, so that the bird can quickly locate the target position [44][45][46].The PSO algorithm can greatly reduce the possibility of falling into the local optimal solution, and has the characteristics of easy implementation and fast convergence.
In the PSO algorithm, each particle has its own position, velocity, and memory, and serves as a point in the search space.After initializing the particle population, the fitness value of each particle is calculated.In each iteration, each particle updates its own historical best position and global best position found in the entire population.The goal of each particle is to search the space of the feasible solution so that the optimal solution can be found.At the beginning of the algorithm, the initial particles may be far away from the optimal solution and scattered in the search space.However, with the continuous iteration of the algorithm, the particle can track the global optimal position of the population and the individual historical optimal position by exchanging these information points with each other, so that it can constantly update its velocity and position, and gradually move closer to the optimal solution.
The key of the PSO algorithm is to update the velocity and position of individual particles.In the iterative process of the algorithm, the particle constantly adjusts its velocity and position through the individual historical optimal position and the global optimal Agronomy 2023, 13, 1892 6 of 19 position, so that the particle can always move closer to the optimal solution.The update equations for the velocity and position of the particles are as follows: where k is the current number of iterations; ζ and η are the random numbers in the range of [0, 1]; V k i and X k i are the velocity and position of the ith particle in the kth iteration; P k i and P k g are the historical optimal position of the ith particle and the global optimal position of all particles in the kth iteration; c 1 and c 2 are learning factors, and they are non-negative real numbers; when the value of c 1 is large, most of the particles in the population will fluctuate in the local space; when the value of c 2 is large, it will cause the phenomenon of premature convergence.Generally, c 1 = c 2 , and their range is [0,4].ω is the inertia weight, which represents the influence of the previous velocity of the particle on the velocity of the particle at the present moment.If ω is larger, the global optimization performance of the particle is enhanced, which reduces the risk of the algorithm falling into the local optimal value; if ω is smaller, the local optimization performance of the particles is enhanced, and accurate optimization can be achieved.
In the velocity update Equation ( 3), the first term, ωV k i , reflects the trend of particles flying in the original direction and plays a role in balancing global optimization and local optimization.The second term, c 1 ζ(P k i − X k i ), expresses the particle moving towards its previously optimal position, so that the particle has the ability of global optimization.The third term, c 2 η(P k g − X k i ), reflects the phenomenon that the information exchange within the population makes the particles move towards the global optimal position in the search space, and reflects the ability of cooperation among particles in the population.The position update Equation (4) expresses the information that the particles are moving closer to the optimal position.
In order to better optimize the parameters of the neural network, this section selects the PSO algorithm to solve this problem.In the PSO algorithm, each individual particle achieves the optimal value in the search space through continuous iterative search and information exchange within the swarm.The flow of the neural network prediction model based on PSO algorithm (PSO-NN) is shown in Figure 2. Step 1: Data segmentation.The dataset is divided into the training set (80%) and the test set (20%).
Step 2: Determine the optimal neural network structure.For each candidate neural network structure, the training set is used to train it, and the optimal neural network structure is selected according to the output results.
Step 3: Initialize the relevant parameters for the neural network and PSO algorithm.
Step 4: According to the fitness function calculation equation, the fitness function value of each particle is calculated:  Step 2: Determine the optimal neural network structure.For each candidate neural network structure, the training set is used to train it, and the optimal neural network structure is selected according to the output results.
Step 3: Initialize the relevant parameters for the neural network and PSO algorithm.
Step 4: According to the fitness function calculation equation, the fitness function value of each particle is calculated: where N is the number of samples, y i is the actual data of the sample, and ŷi is the predicted data of the model.For each particle, the fitness value of its current position is compared to the fitness value corresponding to the historical optimal position P k i and the global optimal position P k g , respectively.If the current position is better than P k i , it means that the current position is closer to the optimal solution, so the current position is assigned to P k i ; similarly, if the current position is better than P k g , the current position is assigned to P k g .
Step 5: Update the velocity and position of the particle according to update Equations ( 3) and ( 4).
Step 6: The neural network model is trained with the training set, and the parameters of the neural network are updated by constantly updating the historical optimal position P i and the global optimal position P g .
Step 7: Judge whether the training has terminated; when the training reaches the maximum number of iterations K, or makes a small number of changes in a certain number of iterations, the algorithm terminates; otherwise, the algorithm continues and returns to Step 4.
Step 8: The trained neural network prediction model is tested on the test samples.

Neural Network Prediction Model Based on PSO Algorithm with Adaptive Inertia Weights
With the increase in the number of iterations, the exploration space of the PSO algorithm gradually decreases, which will lead to a decline in the search ability of the algorithm at the later stage, resulting in premature convergence and an inability to find the global optimal value.This section addresses the problem of the PSO algorithm easily falling into the local optimal value by improving it using adaptive inertia weight.Basing the PSO algorithm on adaptive inertia weight enables it to jump out of the local optimal value in time.The specific calculation method is shown in Equations ( 5) and ( 6): where λ k is the smoothness of the inertia weight change; should the value of λ k change significantly, it indicates that the inertia weight ω is less smooth.In order to prevent a significant change in the value of −λ k /λ k−1 , it is improved in exponential form.
In order to find the global optimal value quickly, it is also necessary to maintain the diversity of the particle population.In the early stage of the algorithmic search, the value of ω is larger, which improves the search speed.When the particles are close to the global optimal value, the change in the ω value is small, finding the global optimal value more accurately and quickly; the algorithm can, therefore, be prevented from falling into the local optimal value, thereby improving its optimization efficiency.
Based on the above technology, the flow of the neural network prediction model based on the PSO algorithm with adaptive inertia weight (AIWPSO-NN) proposed in this section is shown in Figure 3. of  is larger, which improves the search speed.When the particles are close to the global optimal value, the change in the  value is small, finding the global optimal value more accurately and quickly; the algorithm can, therefore, be prevented from falling into the local optimal value, thereby improving its optimization efficiency.
Based on the above technology, the flow of the neural network prediction model based on the PSO algorithm with adaptive inertia weight (AIWPSO-NN) proposed in this section is shown in Figure 3. Step 1: Data segmentation.The dataset is divided into the training set (80%) and the test set (20%).
Step 2: Determine the optimal neural network structure.For each candidate neural network structure, the training set is used to train it, and the optimal neural network structure is selected according to the output results.
Step 3: Initialize the relevant parameters of the neural network and PSO algorithm.
Step 4: According to the fitness function calculation formula, the fitness function value of each particle is calculated.
Step 5: Update the historical optimal position i P and the global optimal position g P .
Step 6: Update the velocity and position of particles based on adaptive inertia weight Equations ( 5) and (6).
Step 7: The neural network model is trained with the training set, and the parameters of the neural network are updated by constantly updating the historical optimal position i P and the global optimal position g P .Step 1: Data segmentation.The dataset is divided into the training set (80%) and the test set (20%).
Step 2: Determine the optimal neural network structure.For each candidate neural network structure, the training set is used to train it, and the optimal neural network structure is selected according to the output results.
Step 3: Initialize the relevant parameters of the neural network and PSO algorithm.
Step 4: According to the fitness function calculation formula, the fitness function value of each particle is calculated.
Step 5: Update the historical optimal position P i and the global optimal position P g .
Step 6: Update the velocity and position of particles based on adaptive inertia weight Equations ( 5) and ( 6).
Step 7: The neural network model is trained with the training set, and the parameters of the neural network are updated by constantly updating the historical optimal position P i and the global optimal position P g .
Step 8: Judge whether the training has terminated.When the training reaches the maximum number of iterations K, or makes a small number of changes in a certain number of iterations, the algorithm terminates; otherwise, the algorithm continues and returns to Step 4.
Step 9: The trained neural network prediction model is tested on the test samples.

Neural Network Prediction Model Based on Improved PSO Algorithm
When dynamic adaptive inertia weights are used, the particles gradually approach the global optimal value with the increasing number of algorithm iterations; however, with the progress of the algorithm, it is possible that the optimal value does not change.Assuming that the optimal value does not change in the continuous G generation, it shows that the algorithm may fall into the local optimal value, resulting in premature convergence.To solve this problem, an improved method combining the dynamic adaptive inertia weight and an escape strategy is proposed.The escape strategy is to generate a new generation of particle population using a mutating operation that increases the diversity of particle population and improves the possibility of particles jumping out of the local optimal value.The calculation method for the escape strategy is shown in Equation ( 7): With the continuous iterative search of the PSO algorithm, the particle population gradually approaches the global optimal value.When the global optimal value of the G generation does not change, the particle aggregation is high and the survival density is too small, so the escape strategy is proposed to obtain a new search space.
Based on the adaptive inertia weight and escape strategy, the flow of the neural network prediction model based on improved particle swarm optimization algorithm (IPSO-NN) proposed in this section is shown in Figure 4.
of particle population and improves the possibility of particles jumping out of the local optimal value.The calculation method for the escape strategy is shown in Equation (7): With the continuous iterative search of the PSO algorithm, the particle population gradually approaches the global optimal value.When the global optimal value of the G generation does not change, the particle aggregation is high and the survival density is too small, so the escape strategy is proposed to obtain a new search space.
Based on the adaptive inertia weight and escape strategy, the flow of the neural network prediction model based on improved particle swarm optimization algorithm (IPSO-NN) proposed in this section is shown in Figure 4. Step 1: Data segmentation.The dataset is divided into the training set (80%) and the test set (20%).
Step 2: Determine the optimal neural network structure.For each candidate neural network structure, the training set is used to train it, and the optimal neural network structure is selected according to the output results.
Step 3: Initialize the relevant parameters of neural network and PSO algorithm.Step 1: Data segmentation.The dataset is divided into the training set (80%) and the test set (20%).
Step 2: Determine the optimal neural network structure.For each candidate neural network structure, the training set is used to train it, and the optimal neural network structure is selected according to the output results.
Step 3: Initialize the relevant parameters of neural network and PSO algorithm.
Step 4: According to the fitness function calculation formula, the fitness function value of each particle is calculated.
Step 5: Update the historical optimal position P i and the global optimal position P g .
Step 6: If the optimal value does not change in continuous G generations, go to Step 7; otherwise, go to Step 8.
Step 7: The escape strategy is used to generate a new generation of particle population, then go to Step 9.
Step 8: Update the velocity and position of particles based on adaptive inertia weight Equations ( 5) and ( 6).
Step 9: The neural network model is trained with the training set, and the parameters of the neural network are updated by constantly updating the historical optimal position P i and the global optimal position P g .
Step 10: Judge whether the training has terminated.When the training reaches the maximum number of iterations K, or makes a small number of changes in a certain number of iterations, the algorithm terminates; otherwise, the algorithm continues and returns to Step 4.
Step 11: The trained neural network prediction model is tested on the test samples.

Objective Function and Evaluation Index
In this paper, the yield of greenhouse tomatoes is taken as the output value of the prediction model.The difference between the predicted value of the model and the actual value of the sample is taken as the objective function; the parameters of the prediction model are optimized based on this objective function.The mean square error (MSE), mean absolute error (MAE), and coefficient of determination (R 2 ) were selected as the evaluation indexes of the output results for the above four different greenhouse tomato yield predictive models; the MSE value, MAE value, and R 2 value were used to verify the effectiveness of the greenhouse tomato yield predictive model [47][48][49].
(1) The objective function refers to the difference between the predicted value of the model and the actual value of the sample, expressed as follows: where N is the number of samples, y i is the actual data of the sample, ŷi is the predicted data of the model. ( The MSE is the average value of the sum of the square of the difference between the predicted value of the model and the actual value of the sample; MSE is calculated as shown in Equation ( 9): Based on Equation ( 9), it can be seen that the smaller the MSE value, the better the accuracy of the predictive model.
(3) MAE is defined as the average of the absolute error between the predicted value of the model and the actual value of the sample.The MAE better reflects the actual situation of predictive errors; it is calculated as shown in Equation ( 10): (4) R 2 is used to measure the degree of fitting between the prediction model and the actual data; it is expressed as shown in Equation ( 11): (11) where the range of the R 2 value is [0, 1], and the larger the R 2 , the closer R 2 is to 1.This indicates a better fitting effect between the prediction model and the actual data.

Model Parameters
The four prediction models are modeled by the BP neural network, in which the optimal number of hidden layer nodes can ensure the accuracy of prediction and the compactness of the structure.The equation for calculating the number of hidden layer nodes is shown in Equation ( 12): where L is the number of hidden layer nodes, P is the number of the input layer nodes, Q is the number of output layer nodes, and A is any constant in the range of 0-10.
According to the data source, the number of nodes in the input layer of the neural network is eight and the number of nodes in the output layer is one.Therefore, the threelayer neural network structure is selected as 8-L-1.The number of nodes in the hidden layer can be obtained by Equation ( 12), L = 3, • • • , 13.By repeatedly training the neural network, the optimal number of hidden layer nodes is 3, i.e., the three-layer structure of the neural network is 8-3-1.
The parameters in the PSO algorithm are set as follows: learning factors c 1 = c 2 = 2 and inertia weight; parameters ζ and η are random numbers in the range of [0, 1]; the population size and the number of iterations are set according to the data used for different soil fertilities.

Results and Analysis of Different Prediction Models under Low Soil Fertility
Greenhouse tomato yield was predicted by four different prediction models based on low soil fertility data (Table 1).A total of 116 sets of data were selected as the training dataset for the neural network, and 30 sets of data were selected as test datasets.The comparison between the output values of the NN prediction model, PSO-NN prediction model, AIWPSO-NN prediction model, and IPSO-NN prediction model, and the actual values of the samples is shown in Figure 5.In order to better observe the comparison between the predicted yield and the actual yield, we intercepted the comparison results for the first 20 sets of data.As can be seen from Figure 5, compared with the former prediction model, the latter prediction model has better predictive ability; i.e., compared with the other three prediction models, the IPSO-NN prediction model proposed in this paper produced the best predictive effect.The predicted output value of greenhouse tomato yield based on the IPSO-NN model is very close to the actual value, which shows the effectiveness and superiority of the proposed IPSO-NN model in greenhouse tomato yield prediction.
In order to further verify the accuracy of the four prediction models, three different evaluation indexes were used to evaluate their prediction performance.The results of the evaluation index calculated according to Equations ( 9)-( 11) are shown in Table 4.According to the calculation equations, MSE = 0.0355, MAE = 0.1164, and R 2 = 0.0693 for the NN prediction model; MSE = 0.0084, MAE = 0.0695, and R 2 = 0.7789 for the PSO-NN prediction model; MSE = 0.0056, MAE = 0.0627, and R 2 = 0.8520 for the AIWPSO-NN prediction model; and MSE = 0.0054, MAE = 0.0580, and R 2 = 0.8575 for the IPSO-NN prediction model.
From the definitions in Equations ( 9)-( 11), it can be seen that the smaller the MSE and MAE values, the larger the R 2 value; this represents the better predictive effect of the prediction model.As can be seen from the data in Table 4, the MSE and MAE values of the IPSO-NN prediction model are the minimum values, and the R 2 value is the maximum value; this indicates that, compared with the other three predictive models, the IPSO-NN prediction model has higher predictive accuracy and can better predict greenhouse tomato yield in low soil fertility conditions.

Results and Analysis of Different Prediction Models under Medium Soil Fertility
Four different prediction models were used to predict the greenhouse tomato yield under medium soil fertility.Based on the data in Table 2, 115 sets of data were selected as the training dataset for the neural network, and 29 sets of data were selected as the test dataset.The comparison between the output values of the NN prediction model, PSO-NN prediction model, AIWPSO-NN prediction model, and IPSO-NN prediction model, and the actual values of the samples, is shown in Figure 6.In order to better observe the comparison between the predicted yield and the actual yield, we intercepted the comparison results for the first 20 sets of data.
From Figure 6, it can be seen that compared with the output values of the other three prediction models, the output value of the IPSO-NN prediction model proposed in this paper is closest to the actual value; this indicates that the proposed IPSO-NN prediction model has higher accuracy in terms of greenhouse tomato yield prediction.
In order to further verify the accuracy of the four prediction models, the prediction performance was evaluated by three different evaluation indexes; the evaluation index results are shown in Table 5.
According to the calculation equations, the MSE values of the four prediction models were 0.0143, 0.0126, 0.0091, and 0.0032.The MAE values of the four prediction models were 0.1001, 0.0983, 0.0745, and 0.0443.The R 2 values of the four prediction models were 0.3036, 0.3869, 0.5583, and 0.8426.
The prediction performance of the four prediction models was analyzed based on the characteristics of the evaluation indexes (MSE value, MAE value, and R 2 value).It is obvious that the evaluation index for the IPSO-NN prediction model is the optimal value; compared with the other three prediction models, the IPSO-NN prediction model has higher prediction ability in greenhouse tomato yield prediction under medium soil fertility.It is further demonstrated that the IPSO-NN prediction model proposed in this paper has high accuracy in terms of yield prediction, and the predicted yield value of the model is closest to the actual yield value.

Results and Analysis of Different Prediction Models under High Soil Fertility
The yield of greenhouse tomatoes under conditions of high soil fertility was predicted.Based on the data in Table 3, we selected 80 sets of data as the training dataset for the neural network and 20 groups of data as the test dataset.The comparison between the output values of the NN prediction model, PSO-NN prediction model, AIWPSO-NN prediction model, and IPSO-NN prediction model, and the actual values of the samples, is shown in Figure 7.
By comparing the predicted output value with the actual value in Figure 7, it can be seen that compared with the other three prediction models, the IPSO-NN prediction model proposed in this paper is closer to the actual output value.The simulation results show that the IPSO-NN prediction model has good prediction accuracy in greenhouse tomato yield prediction.In order to further verify the accuracy of the four prediction models, the prediction performance was evaluated by three different evaluation indexes; the evaluation index results are shown in Table 6.According to the calculation equations, the MSE values of the four prediction models were 0.0569, 0.0082, 0.0041, and 0.0036.The MAE values of the four prediction models were 0.1718, 0.0759, 0.0511, and 0.0489.The R 2 values of the four prediction models were 0.0529, 0.8641, 0.9323, and 0.9408.
As can be seen from the data in Table 6, the MSE and MSE values show a downward trend and approach 0; R 2 shows an upward trend and approaches 1; this means that compared with the other three prediction models, the IPSO-NN prediction model proposed in this section has the highest prediction accuracy.It fully reflects that the IPSO-NN prediction model has good prediction performance in greenhouse tomato yield prediction in terms of high soil fertility conditions.0.0529, 0.8641, 0.9323, and 0.9408.
As can be seen from the data in Table 6, the MSE and MSE values show a downward trend and approach 0; R 2 shows an upward trend and approaches 1; this means that compared with the other three prediction models, the IPSO-NN prediction model proposed in this section has the highest prediction accuracy.It fully reflects that the IPSO-NN prediction model has good prediction performance in greenhouse tomato yield prediction in terms of high soil fertility conditions.

Discussion
In this section, four prediction models of greenhouse tomato yield      By comparing the predicted values of the models to the actual value, we can see that By comparing the predicted values of the models to the actual value, we can see that the predicted yield value obtained by the IPSO-NN prediction model is the closest to the actual yield value.It was successfully demonstrated that the IPSO-NN prediction model proposed in this paper has good predictive ability for greenhouse tomato yield under any soil fertility condition and achieves a high level of predictive accuracy.In addition, by comparing the prediction results for the NN model, it was found that the prediction accuracy of the IPSO-NN model was significantly improved.This is because the IPSO-NN model targets the problem of the PSO algorithm easily falling into the local optimal value.This situation was improved by using an adaptive inertia weight and escape strategy, enabling it to jump out of the local optimal value in time and search the global optimal parameters.The IPSO-NN model, therefore, has the better predictive ability of a neural network.By comparing the predicted values of the models to the actual value, we can see that the predicted yield value obtained by the IPSO-NN prediction model is the closest to the actual yield value.It was successfully demonstrated that the IPSO-NN prediction model proposed in this paper has good predictive ability for greenhouse tomato yield under any soil fertility condition and achieves a high level of predictive accuracy.In addition, by comparing the prediction results for the NN model, it was found that the prediction accuracy of the IPSO-NN model was significantly improved.This is because the IPSO-NN model targets the problem of the PSO algorithm easily falling into the local optimal value.This situation was improved by using an adaptive inertia weight and escape strategy, enabling it to jump out of the local optimal value in time and search the global optimal parameters.The IPSO-NN model, therefore, has the better predictive ability of a neural network.
In order to evaluate the prediction performance of the four prediction models more intuitively, this paper compares and analyzes the prediction results of the four models based on three evaluation indexes (MSE value, MAE value, and R 2 value); the results for the three evaluation indexes are shown in Tables 4-6.
From the definitions of MSE, MAE, and R 2 , it can be seen that the smaller the MSE and MAE values, the larger the R 2 value; this means the better the evaluation index, i.e., the better the predictive performance of the prediction model.By evaluating the results of the three evaluation indexes in Tables 4-6, it was found that the MSE and MAE values corresponding to the NN prediction model, PSO-NN prediction model, AIWPSO-NN In order to evaluate the prediction performance of the four prediction models more intuitively, this paper compares and analyzes the prediction results of the four models based on three evaluation indexes (MSE value, MAE value, and R 2 value); the results for the three evaluation indexes are shown in Tables 4-6.
From the definitions of MSE, MAE, and R 2 , it can be seen that the smaller the MSE and MAE values, the larger the R 2 value; this means the better the evaluation index, i.e., the better the predictive performance of the prediction model.By evaluating the results of the three evaluation indexes in Tables 4-6 From the above analysis, it can be seen that the parameters of the IPSO-NN prediction model are more accurate, and the greenhouse tomato yield can be predicted quickly and accurately; i.e., the predicted yield value is closer to the actual yield.The superiority of the IPSO-NN prediction model in terms of yield prediction is fully demonstrated, indicating that it is reasonable and feasible to use this model to predict the yield of greenhouse tomatoes.Accordingly, the IPSO-NN prediction model can guide the nutrient and environmental management of facility tomato production, and provide data support for agricultural insurance, agricultural products, futures loans, marketing management, and other decisions.

Conclusions
The environmental factors of the greenhouse, characteristics of soil, amount of fertilizer applied, and the physiological characteristics of the tomato plant play an important role in the yield of greenhouse tomatoes.In order to resolve the problem of the common PSO algorithm easily falling into the local optimal value, the AIWPSO-NN and IPSO-NN prediction models are proposed, as these realize the accurate prediction of greenhouse tomato yields.The main conclusions of this paper are as follows: 1.
A total of 390 sets of experimental data from 12 provinces and cities, for the period 1999-2020, were extracted.The extracted experimental data were classified according to three different soil fertility grades (low, medium, and high) based on the classification standard for soil nutrient indexes for tomato production in solar greenhouse facilities.

2.
In order to improve the prediction accuracy of greenhouse tomato yield, a dynamic adaptive inertia weight and escape strategy was used to improve the PSO algorithm, and the IPSO-NN prediction model was proposed to ensure that the PSO algorithm was able to jump out of the local optimal value in time and improve the global search ability of the PSO algorithm.

3.
Under three different soil fertility conditions (low, medium, and high), the NN, PSO-NN, AIWPSO-NN, and IPSO-NN prediction models were used to predict greenhouse tomato yield, and the predicted results were evaluated using MSE, MAE, and R 2 .The experimental results show that, compared with the other three prediction models, the IPSO-NN prediction model possesses higher predictive accuracy and better fitting ability.
To sum up, this paper used a dynamic adaptive inertia weight and escape strategy to improve the optimization accuracy of the PSO algorithm, providing reliable prediction results for greenhouse tomato yield.The experimental results showed that the IPSO-NN prediction model proposed in this paper possessed high reliability in terms of greenhouse tomato yield prediction.The research results not only help agricultural managers and sellers to predict the tomato yield in solar greenhouse in China, but also help agricultural producers to make nutrient management and environmental management decisions during tomato production in solar greenhouses, and can also provide reference for other crop yield prediction research.However, many problems remain to be studied, for example, whether other, more advanced neural networks can be used for modeling; how to choose an optimization algorithm with higher accuracy to optimize the parameters of a neural network; and how to define a new and more practical objective function to reduce the error between the predicted value and the actual value, thereby improving crop yield prediction accuracy.These will be our future research directions.

Figure 1 .
Figure 1.Structure of a three-layer BP neural network.


; and they are all real numbers.

Figure 1 .
Figure 1.Structure of a three-layer BP neural network.

( 2 )
j ; the weight from the hidden layer to the output layer is w (2,3) jk , and the threshold is θ(3)

Figure 2 .
Figure 2. Flow chart of PSO-NN prediction model.Step 1: Data segmentation.The dataset is divided into the training set (80%) and the test set (20%).
In this section, four prediction models of greenhouse tomato yield (the NN prediction model, PSO-NN prediction model, AIWPSO-NN prediction model, and IPSO-NN prediction model) are discussed, and the predicted yield values of the four prediction models under three different soil fertility conditions (low, medium, and high) are compared with the actual yield values.The comparison results are shown in Figures 8-10 .
(the NN prediction model, PSO-NN prediction model, AIWPSO-NN prediction model, and IPSO-NN prediction model) are discussed, and the predicted yield values of the four prediction models under three different soil fertility conditions (low, medium, and high) are compared with the actual yield values.The comparison results are shown in Figures 8-10 .

Figure 8 .
Figure 8.Comparison between predicted yield values and actual values for four different prediction models under low soil fertility.

Figure 8 .
Figure 8.Comparison between predicted yield values and actual values for four different prediction models under low soil fertility.Agronomy 2023, 13, x FOR PEER REVIEW 16 of 20

Figure 9 .
Figure 9.Comparison between predicted yield values and actual values for four different prediction models under medium soil fertility.

Figure 10 .
Figure 10.Comparison between predicted yield values and actual values for four different prediction models under high soil fertility.

Figure 9 .
Figure 9.Comparison between predicted yield values and actual values for four different prediction models under medium soil fertility.

Figure 9 .
Figure 9.Comparison between predicted yield values and actual values for four different prediction models under medium soil fertility.

Figure 10 .
Figure 10.Comparison between predicted yield values and actual values for four different prediction models under high soil fertility.

Figure 10 .
Figure 10.Comparison between predicted yield values and actual values for four different prediction models under high soil fertility.
, it was found that the MSE and MAE values corresponding to the NN prediction model, PSO-NN prediction model, AIWPSO-NN prediction model, and IPSO-NN prediction model show a gradual downward trend under the conditions of low, medium, and high soil fertility; i.e., the MSE and MAE values of the IPSO-NN prediction model are the minimum, indicating that the IPSO-NN prediction model possesses the optimal MSE and MAE values.In addition, it was found that the R 2 values of the four prediction models show a gradual upward trend; i.e., the R 2 value of the NN model is the minimum and the R 2 value of the IPSO-NN prediction model is the maximum, representing the IPSO-NN prediction model having the optimal R 2 value.To sum up, the three evaluation indexes of the IPSO-NN prediction model are better than the other three prediction models.

Author Contributions:
Conceptualization, X.P., X.Y., C.L. and X.C.; methodology, X.P. and X.Y.; data curation, Y.C.; writing-original draft preparation, X.P. and X.Y.; writing-review and editing, C.L. and X.C.; visualization, X.P. and Y.L.; supervision, X.P.; funding acquisition, X.C.All authors have read and agreed to the published version of the manuscript.Funding: This research was supported by the Joint Funds of the National Natural Science Foundation of China (U2106214), the National Natural Science Foundation of China (grant number 42177005 and 32201373), the Science and Technology Program of Shenyang (22-317-2-01), Innovation team for research, development and application of conservation tillage in Liaoning Province (XLYC2008015), and the Special Research Assistant Project of Chinese Academy of Sciences (2022000137).

Table 1 .
Experimental data under low soil fertility.

Table 2 .
Experimental data under medium soil fertility.

Table 3 .
Experimental data under high soil fertility.

Table 4 .
Evaluation index data under low soil fertility.

Table 5 .
Evaluation index data under medium soil fertility.

Table 6 .
Evaluation index data under high soil fertility.