Study on the application of BP neural network in air quality prediction based on adaptive chaos fruit fly optimization algorithm

. BP neural network is optimized by improved drosophila algorithm, and a prediction model for air quality in Nanchang is established based on the air quality data and meteorological data of Nanchang city in recent three years. The experimental results show that the improved algorithm has improved performance compared with the BP algorithm, and has improved accuracy 4%, with a small difference in time consumption. The performance of the indirect prediction method is slightly better than that of the direct prediction method


Introduction
In the 20th century, when air pollution events were concentrated in western countries, they began to predict the concentration of pollutants in the air.So far, there have been many models, such as CMAQ (Community Multiscale Air Quality) model System [1,2], and ADMS (Atmospheric Dispersion Modelling System) series System [3,4].In addition to these models, AERMOD model [5,6], CALPUFF model [7], and WRF-CHEM model [8,9] are now commonly used air quality models.
In recent years, with the rapid development of artificial neural network, many scholars at home and abroad have used it to predict and monitor the concentration of air pollutants.At present, BP neural network has been widely used in the field of air pollution index prediction [10].Although the existing traditional BP neural network prediction model has achieved relatively high prediction accuracy, it still has some disadvantages such as easy to stop the training at the locally optimal point.This paper aims to optimize and improve the prediction model of the BP neural network by using the fruit fly optimization algorithm and the chaos algorithm, and establish a prediction model with more accurate prediction results and higher prediction accuracy for air quality, and to provide people with more accurate travel Suggest.

BP neural network
BP neural network is a forward-type neural network with a structure of multi-layer neural nodes that is trained using the method of back propagation [11].BP neural network is, in fact, in the use of programming tools to implement an input to the output mapping, Robert Hecht, 1989 Nielsen proves that can be used to contain a hidden layer (that is, only three layer structure) of the BP neural network fitting any nonlinear continuous function (i.e., the universal approximation theorem), has good nonlinear mapping ability, thus suitable for solving system internal mechanism and the relationship between complex linear inseparable problem.Because of its better performance, it has become one of the most widely used forms of neural network in practical applications.It is composed of three parts: input layer --hidden layer --output layer, in which the input layer and the output layer have only one layer, and the hidden layer can have one layer and multiple structures.The nonlinear mapping ability of BP neural network is better.Its ability of self-learning and self-adaptation is also relatively strong.However, it also has some disadvantages, such as easy to fall into the local minimum, slow convergence speed, easy "overfitting" and so on.

Adaptive chaos fruit fly algorithm
In view of the fact that the traditional drosophila Algorithm is not accurate enough and easy to fall into the local optimal solution, Han Junying et al. improved the traditional drosophila Algorithm by integrating Chaos Algorithm and proposed Adaptive Chaos Fruit Fly Optimization Algorithm (ACFOA) [12].
This algorithm takes the traditional drosophila algorithm as the main body in the whole operation process, and introduces the variance of the taste concentration (fitness) of the drosophila population to judge whether the algorithm has entered a state of local convergence.If the algorithm is in a state of local convergence, the individual location of drosophila in the search space is mapped to the chaotic interval of [0,1], and then the chaotic variable is generated through the chaotic mapping, and then the chaotic variable is remitted to the location of the individual transformed into a new optimized drosophila in the search space.Due to the diversity, ergodicity and randomness of the chaotic system, the new individual position can effectively jump out of the local convergence space and conduct a global search in the whole search space.If the concentration of taste (fitness) of the new drosophila individual after the chaotic mapping process described above is better than that of the current globally optimal drosophila individual (fitness), the drosophila individual at this concentration is updated to the globally optimal drosophila individual.
The algorithm process above improved the diversity, ergodic and randomness of drosophila population, and the drosophila population only flew close to the globally optimal individual in the process of improving the traditional drosophila optimization algorithm, resulting in the loss of diversity of drosophila population.Thus, This improves the accuracy and efficiency of the traditional Drosophila optimization algorithm.

Improved adaptive chaos fruit fly algorithm optimization BP neural network
Chaos is the seemingly random and irregular motion occurring in a deterministic system.It exists widely in nature, in a system which can be described by deterministic theory, but its behaviour shows the phenomenon of uncertainty.
The chaotic mapping model used in ACFOA algorithm is the Logistic mapping model, also known as the worm's mouth model.It is a dynamic system derived from the demographic direction, and it is a chaotic mapping widely used in various optimization algorithms.
However, it has the disadvantage of uneven probability distribution.In this paper, a Tent map with uniform distribution is used in chaotic optimization algorithm to replace the Logistic map.Its mathematical expression is as follows: ) In the solution of some problems of FOA, as the judgment value of drosophila flavor concentration is the reciprocal of the distance between its position and the origin, it must be a non-negative value, which makes it impossible to obtain the global optimal solution.In this regard, a tripping parameter ∆ is added to the determination value of flavor concentration in this paper.The drosophila algorithm can jump out of the state of local convergence to some extent in solving some problems, so as to find the global optimal solution.The evaluation value Si of drosophila flavor concentration was improved as follows: The improved ACFOA algorithm is combined with BP neural network to establish an improved ACFOA-BP neural network model.The main idea is to optimize the weight and threshold of BP neural network, assign the optimal weight and threshold value to BP neural network, and then use BP neural network to make prediction.The judgment value of individual taste concentration of fruit flies represents the weight and threshold of BP neural network.By updating the optimal judgment value, the optimal weight threshold can be obtained.The specific steps are as follows.
i) Setting parameters: the number of nodes in the neural network, m nodes in the input layer, n nodes in the hidden layer and l nodes in the output layer.Neural network training algebra.Fruit-fly population size Sizepop, the maximum number of iterations of the evolution of the fruit-fly algorithm Maxgen, the variance threshold of the fruit-fly population flavor concentration δ, the number of times of chaotic traversal M. The initial positions X axis and Y axis of the drosophila population were randomly assigned, and the dimension of the two vectors was m×n+n×l+n+l based on the node structure of the neural network.
ii) The parameters in the previous step were substituted into the improved chaotic drosophila optimization algorithm (improved ACFOA), and the function of the taste concentration of the algorithm was set as the error function of the output result of the neural network training and the expected result.The taste judgment value data of each individual drosophila was substituted into the weights of the connections in the neural network and the threshold values of the nodes in the neural network, and then the training samples were input into a small amount of training algebra, and the taste concentration of the algorithm was calculated by error function.Then the iterative optimization process of improved ACFOA is carried out.
iii) The taste judgment value of the optimal drosophila individual found in the optimization phase of the improved chaotic drosophila optimization algorithm was assigned to the weights of the connections in the neural network and the thresholds of the nodes in the neural network.The BP neural network was trained according to the set algebra.

Predictive simulation 4.1 Data pre-processing
The data used in this paper includes air quality data for the three years 2017-2019 for Nanchang City and meteorological data for the same period of 1,095 days.Because there are non-numerical data in the collected data, such as Weather Condition, Wind Direction and Wind Level.The mapping relation in Table 1 is used for numerical processing.After the numerical processing of non-numerical data, the maximum and minimum normalization method is used to normalize the data, and the normalization interval is [-1, 1].The normalized data are shown in Table 2, Table 3 and Table 4

Model building
Because the original air quality data include the content of five major air pollutants, such as PM2.5, PM10, SO2, CO, NO2 and the AQI of the air quality index.So experiments on the prediction of AQI values can be carried out in two ways.One way to predict the Next day's AQI values directly using AQI values and day weather data.Another way is to predict the content of each pollutant based on the value of the pollutants in the air and the weather data of the day, and then use the predicted content values of each pollutant to calculate its IAQI value and summarize the AQI value.This paper uses AQI values and day-to-day weather data to be entered into BP, FOA-BP, and the next day's AQI values in the improved ACFOA-BP neural network.In this paper, the input data has 9 data such as AQI value, day weather, night weather, maximum temperature, minimum temperature, day wind direction, day wind, night wind, night wind, etc., so the input layer should take 9 neural network nodes, output data for the next day's AQI value, the output layer should take 1 neural network node.For the BP neural network of the 3-layer structure, there are many empirical formulas to determine the number of nodes in the hidden layer to refer to, and the following formulas are used in this paper:  = √ +  +  (3) Where n is the number of neural network nodes in the input layer, m is the number of neural network nodes in the output layer, and i is the integer of the value range of [1,10].
The above formula can determine that the number of nodes in the hidden layer should be an integer between 4 and 14.Finally, with the same other parameter settings, set the number of different hidden layer nodes, using BP neural networks to perform 10 repeated independent experiments on the data, resulting in an average relative error as shown in Table5: When the number of nodes in the hidden layer is 4, the average relative error is the smallest, so the 9-4-1 network structure is adopted in this paper.The specific experimental parameters in this paper were set as follows: the size of the drosophila population   was 40, the maximum number of times of iterative evolution  was 2000, the variance threshold of the drosophila population flavor concentration was 0.00001, and the number of times of chaos iteration  was 10.

Direct forecast results
It can be seen from the above figure that the predicted value of the BP neural network is consistent with the large trend of the expected value, but the degree of fitting is not good enough and the effect is not very good.The improved ACFOA-BP neural network has better fitting degree and better local fitting.

Indirect forecast results
From the comparison chart of AQI output value and expected value in indirect mode, it can be seen that this method has better fitting and predictive capabilities.The improved ACFOA-BP neural network algorithm proposed in this paper can improve the fitting ability of BP neural network, and to a certain extent, has the ability of local fitting.

Analysis of overall experimental results
In this paper, the average relative error, accuracy and time consumption are used to measure the performance of the algorithm.The performance of the AQI prediction results after 20 independent repeated runs using the two methods and the directly predicted FOA-BP and BP neural network is shown in the following table.It can be seen from the above table that compared with BP algorithms, the improved ACFOA-BP algorithm has improved performance and the time is not much difference.This means that the improved ACFOA-BP algorithm proposed in this paper actually has improved performance and is feasible.The performance of the indirect prediction method is slightly better than that of the direct prediction method, but the indirect prediction method takes about 6-7 times more time than the direct prediction method.

Conclusion
Based on the air quality index (AQI) data and weather monitoring data of Nanchang city from January 1, 2017 to December 31, 2019, this paper proposes a prediction model based on the BP neural network improved by drosophila optimization algorithm to predict AQI.This paper fuses the principle of drosophila optimization algorithm with chaos optimization algorithm to obtain an adaptive chaos optimization algorithm for drosophila.At the same time, the judgment value of flavor concentration was improved by introducing skip parameter to improve the defect that the judgment value could not be negative.Tent mapping was used to replace the Logistic chaotic mapping system, so that the probability distribution of chaotic mapping was evenly distributed within the value interval, and the global optimization ability of the algorithm was further enhanced.Finally, an improved ACFOA algorithm is proposed.Using the algorithm as a method to optimize the weight and threshold of BP neural network, a model to predict the air quality index (AQI) is proposed.The indirect and direct methods to predict the total air quality index (AQI) were proposed, and the obtained model was compared with the traditional BP neural network prediction model through experiments.The experimental results show that the performance of the improved ACFOA-BP algorithm is better than that of the BP algorithm, and the time spent is not much different.

Fig. 1 .
Fig. 1.Comparison of BP neural network AQI output values and expectations.

Table 1 .
Numerically match table for weather conditions, wind direction and wind level.

Table 5 .
Average relative error for the number of hidden layer nodes.

Table 6 .
Comparison of performance for each network.