Adaptive particle swarm optimization BP neural network air quality prediction method

Through the adaptive particle swarm optimization BP neural network method, the problems of slow convergence speed and local optimality of the air quality prediction model are solved, the prediction accuracy and speed are improved, and more accurate air quality prediction is achieved.

CN119294432APending Publication Date: 2025-01-10YANGZHOU RICE INFORMATION TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411209975.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-30
Publication Date
2025-01-10

AI Technical Summary

Technical Problem

The existing air quality prediction model has the problem of slow convergence speed and easy to fall into local optimality. The selection of BP neural network structure weights and thresholds has an impact on the prediction results, resulting in high difficulty, short time and low accuracy.

Method used

Adaptive particle swarm optimization BP neural network method is adopted to optimize the weight and threshold of the BP neural network by preprocessing and feature screening of historical weather and meteorological data, real-time data and pollutant emission data, and random forest algorithm and particle swarm algorithm are used to optimize the weight and threshold of the BP neural network. Improve the global search capability and prediction accuracy of the model.

Benefits of technology

The accuracy and speed of air quality prediction are improved, and the model is trapped in local optimality is reduced. A air quality prediction model with high prediction accuracy and fast convergence speed is constructed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119294432A_ABST
    Figure CN119294432A_ABST
Patent Text Reader

Abstract

The invention discloses an adaptive particle swarm optimization BP neural network air quality prediction method, and relates to the technical field of air quality prediction. According to the adaptive particle swarm optimization BP neural network air quality prediction method, data set division is carried out on screened feature data to form a training set and a test set, normalization processing is carried out, and then a neural network model is established; a screened training set is introduced into a neural network model to optimize threshold parameters in the neural network, an air quality prediction model is established to predict air quality data, the weight and the threshold of the BP neural network are optimized by using the advantages of high optimization capacity and high execution efficiency of the particle swarm optimization, and the prediction efficiency of the air quality data is improved. And meanwhile, the position of the particle swarm is adaptively changed, so that the global search capability of the algorithm is improved, the problem that the BP neural network is easy to fall into local optimum is effectively solved, and the prediction precision and speed of the BP neural network are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of air quality prediction, in particular to an air quality prediction method using a self-adaptive particle swarm optimization BP neural network. Background Art

[0002] In recent years, with the improvement of people's living standards and health awareness, they have paid more and more attention to the problem of air pollution. Therefore, it is of great significance to study more accurate air prediction methods.

[0003] The reference patent name is: A method for predicting urban air quality based on a neural network (patent publication number: CN116205317A, patent publication date: 2023-06-02). The historical meteorological data and air quality simulation data in the past five years are filled and feature extracted through a two-dimensional convolution unit. The extracted feature historical meteorological data and feature simulation data are input into the LSTM. After the forget gate and the input gate are affine transformed, the calculation results are input into the air quality gridded neural network. The daily concentration values ​​of various pollutants and the air quality index in the next year are output, and the annual target conditions are input into the air quality gridded neural network. If the concentration of a certain pollutant does not meet the annual target conditions, it is used as input to reversely calculate the emission reduction plan, and a neural network model integrating air quality simulation data and monitoring data is established to predict the correlation between future air quality daily concentration and emission reduction work. The method of superimposing 2 layers of LSTM and corresponding forgetting layers makes the model less prone to overfitting and improves generalization and universality.

[0004] Based on the description in the above documents, the existing prediction models have the problems of great difficulty, short prediction time and low accuracy. The emergence of machine learning algorithms has improved this situation to some extent, but there are still some defects. The current air quality prediction operation has the problems of slow convergence speed and easy to fall into local optimum, so that the selection of BP neural network structure weights and thresholds affects the prediction results. For this reason, the present invention provides an adaptive particle swarm optimization BP neural network air quality prediction method. Summary of the invention

[0005] In view of the shortcomings of the prior art, the present invention provides an adaptive particle swarm optimization BP neural network air quality prediction method, which solves the problems that the current air quality prediction operation has slow convergence speed and is easy to fall into local optimality, so that the selection of BP neural network structure weights and thresholds affects the prediction results.

[0006] To achieve the above objectives, the present invention is implemented by the following technical scheme: an adaptive particle swarm optimization BP neural network air quality prediction method, specifically comprising the following steps:

[0007] A1. Collect historical weather and meteorological data, real-time weather and meteorological data, pollutant emission data, and spatiotemporal data in the air quality monitoring area and store them in the database;

[0008] A2. Receive the collected data and perform preprocessing operations on the data, and filter out the required indicator features from the processed data through the random forest algorithm;

[0009] A3. Divide the filtered feature data into a training set and a test set, perform normalization, and then establish a neural network model. By introducing the filtered training set into the neural network model, the threshold parameters in the neural network are optimized to establish an air quality prediction model.

[0010] A4. The test set is introduced into the updated air quality prediction model to realize the operation of predicting the air quality index.

[0011] Preferably, the step of preprocessing the data in A2 is:

[0012] a211. After receiving the collected data, set the matching template of the required data, and transfer the received data to the matching template, identify the data part that is the same as the row title and column title content in the matching template, and fill the corresponding data result content into the matching template of the corresponding row title and column title;

[0013] a212. After completing the data matching, the result data in the matching template is traversed, and the result columns with blanks or abnormalities at the intersection of the corresponding row headers and column headers are marked, and the missing data values ​​are compensated and the abnormal values ​​are replaced and modified by searching in the database;

[0014] a213. Form a complete matching template with matching data.

[0015] Preferably, the operation of selecting the required indicator features from the processed data by the random forest algorithm in A2 is:

[0016] a221, randomly extract multiple data subsets from the matching template with matching data;

[0017] a222, and each data subset constructs a decision tree, and randomly selects some features at the splitting node of the decision tree for splitting operation, and generates results after training;

[0018] a223, and the final result of each decision tree is subjected to data fusion to form the required indicator feature set, which is marked as M.

[0019] Preferably, the operation of performing normalization processing based on the feature data in A3 is:

[0020] a31. After the indicator feature set M is introduced, it is divided into a training set and a test set in a ratio of 8:2;

[0021] a32, and then scale the data linearly so that the data value is between 0 and 1. The specific expression is:

[0022]

[0023] Where x is the data to be processed, min is the minimum value in the processed data, max is the maximum value in the processed data, and x * This is the final result obtained after data normalization.

[0024] Preferably, the operation of introducing the training set in A3 into the neural network model for training update is:

[0025] B1. First, construct the BP neural network structure and determine the connection weights and total number of thresholds of each layer of the BP neural network structure;

[0026] B2. Optimize the BP neural network using the adaptive particle swarm algorithm, update the particle position and velocity, calculate the updated fitness value, and compare the calculated fitness value after the update with the current optimal fitness value;

[0027] B3. Determine whether the updated operation has reached the end condition and output the optimal weight threshold parameter of the BP neural network.

[0028] Preferably, the construction operation of the BP neural network structure in B1 is:

[0029] b11. Form a neural network structure through the input layer, hidden layer and output layer, and determine the number of neurons in each layer;

[0030] b12. Determine the number of input layer neurons by the number of indicator features selected in A2, and calculate the number of hidden layer neurons. The number of output layer neurons is determined according to the target number;

[0031] And the formula for calculating the number of neurons in the hidden layer is:

[0032] Where, I is the number of neurons in the input layer, O is the number of neurons in the output layer, H is the number of neurons in the hidden layer, and γ is the adjustment parameter of the number of neurons in the hidden layer, which ranges from 1 to 10.

[0033] b13. Determine the activation function between the input and output of the hidden layer and output layer nodes. The function expression is:

[0034]

[0035] z represents the input value of the neuron;

[0036] b14. Determine the particle dimension, and the calculation formula is:

[0037] D=I*H+H*O+H+O;

[0038] Among them, D is the particle dimension, which is the total number of connection weights and thresholds of each layer of the BP neural network structure.

[0039] Preferably, the operation of optimizing the BP neural network by the adaptive particle swarm algorithm in B2 is:

[0040] b21. Initialize the particle swarm and parameters, and initialize the individual optimal value and the global optimal value;

[0041] b22. Iterate the particle swarm and parameters, and update the individual speed and position data of the particle swarm through calculation;

[0042] b23, thereby updating the individual optimal value and global optimal value of the particle swarm, and updating the weights and thresholds of the neural network structure.

[0043] Preferably, the formula for updating the individual velocity and position data of the particle swarm by calculation in b22 is:

[0044] C1. Update the inertia weight in the parameters, and the formula is:

[0045]

[0046] Where w is the inertia weight, and w max and w min are the maximum and minimum values ​​of the inertia weight, respectively; k is the number of iterations in the operation; α and β are adaptive factors and control parameters used to adjust the change of the inertia weight; k max is the maximum number of iterations;

[0047] C2. Update the individual learning factor and social learning factor, and the formula is:

[0048]

[0049] Among them, c1 is the individual learning factor, c2 is the social learning factor, and c1 max and c1 min is the maximum and minimum value of the individual learning factor, and c2 max and c2 min is the maximum and minimum value of the social learning factor;

[0050] C3. Update the particle velocity, and the formula is:

[0051]

[0052] in is the velocity vector of particle i in the dth dimension at the kth iteration, is the position vector of particle i in the dth dimension at the kth iteration, is the historical optimal position of particle i in the dth dimension in the kth iteration, The historical optimal position of the particle swarm in the dth dimension in the kth iteration, and r1 and r2 are set to random numbers between 0 and 1, and pbest is the individual optimal value and gbest is the global optimal value;

[0053] C4. Update the particle position, and the formula is:

[0054]

[0055] is the position vector of particle i in the dth dimension at the kth iteration, is the velocity vector of particle i in the dth dimension at the kth iteration.

[0056] Preferably, the formula for calculating the updated fitness value in B2 is:

[0057]

[0058] MSE is the mean square error as the fitness function, where n is the total number of samples, y j is the true value of the data, y l is the predicted value of the data obtained through neural network model training.

[0059] Preferably, the step of comparing the fitness value calculated after updating with the current optimal fitness value in B2 is:

[0060] D1. Before each iterative update, the currently generated fitness value is compared with the optimal fitness value in the previous operation, and the smaller value is selected as the new optimal fitness value;

[0061] D2, compare the calculated fitness value after update with the current individual optimal fitness value, if the former is less than the latter, update the current individual optimal fitness value;

[0062] Compare the updated fitness value with the current global optimal fitness value. If the former is smaller than the latter, update the current global optimal fitness value.

[0063] D3, and when the operating conditions of D2 are met, the update is completed and the optimal weight threshold parameters of the BP neural network are output. Otherwise, the operation in B2 is repeated until the operating conditions of D2 are met or the maximum number of iterations is met.

[0064] The present invention provides an air quality prediction method using an adaptive particle swarm optimization BP neural network. Compared with the prior art, it has the following beneficial effects:

[0065] (1) The adaptive particle swarm optimization BP neural network air quality prediction method divides the filtered feature data into a training set and a test set, and performs normalization processing, and then establishes a neural network model. By introducing the filtered training set into the neural network model, the threshold parameters in the neural network are optimized, and an air quality prediction model is established to realize the prediction operation of air quality data. The advantages of the particle swarm algorithm, such as strong optimization ability and high execution efficiency, are used to optimize the weights and thresholds of the BP neural network. At the same time, the position of the particle swarm is adaptively changed to improve the global search ability of the algorithm, which effectively solves the problem that the BP neural network is prone to fall into the local optimum, and improves the prediction accuracy and speed of the BP neural network.

[0066] (2) The adaptive particle swarm optimization BP neural network air quality prediction method uses the random forest algorithm to screen out the required indicator features from the processed data and selects the features with higher importance as input variables to improve the prediction accuracy of the model. The particle swarm optimization algorithm has the advantages of strong optimization ability and high execution efficiency to optimize the weights and thresholds of the BP neural network, thereby improving the air quality prediction accuracy and speed.

[0067] (3) The adaptive particle swarm optimization BP neural network air quality prediction method compares the fitness value calculated after the update with the current optimal fitness value. If the former is smaller than the latter, the individual optimal fitness value and the global optimal fitness value are extracted. By adaptively changing the particle position and speed, the global search capability of the algorithm is improved, and the situation where the algorithm falls into the local optimum is reduced. Thus, an air quality prediction model with high prediction accuracy, fast convergence speed and strong search capability is constructed, which can be well applied to the urban air quality prediction operation. BRIEF DESCRIPTION OF THE DRAWINGS

[0068] Figure 1 is a flow chart of the air quality prediction method of the present invention;

[0069] Figure 2 A flowchart for training and updating the neural network model of the present invention;

[0070] Figure 3 It is a schematic diagram of the BP neural network structure of the present invention;

[0071] Figure 4 This is the logic judgment diagram of the adaptive particle swarm optimization BP neural network of the present invention. DETAILED DESCRIPTION

[0072] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0073] See also Figure 1-Figure 4 The present invention provides a technical solution: an adaptive particle swarm optimization BP neural network air quality prediction method, which specifically includes the following steps:

[0074] A1. Collect historical weather and meteorological data, real-time weather and meteorological data, pollutant emission data, and spatiotemporal data in the air quality detection area and store them in the database;

[0075] A2. Receive the collected data and perform preprocessing operations on the data, and filter out the required indicator features from the processed data through the random forest algorithm;

[0076] A3. Divide the filtered feature data into a training set and a test set, perform normalization, and then establish a neural network model. By introducing the filtered training set into the neural network model, the threshold parameters in the neural network are optimized to establish an air quality prediction model.

[0077] A4. The test set is introduced into the updated air quality prediction model to realize the operation of predicting the air quality index.

[0078] The meteorological data include temperature, wind speed, humidity, air pressure, rainfall and other data; the pollutant emission data include the emission concentration data of various gases; the spatiotemporal data include time data and the geographical location data of each monitoring station.

[0079] Among them, the filtered feature data are divided into data sets to form training sets and test sets, and normalized, and then a neural network model is established. The filtered training set is introduced into the neural network model to optimize the threshold parameters in the neural network. An air quality prediction model is established to realize the prediction operation of air quality data. The particle swarm algorithm has the advantages of strong optimization ability and high execution efficiency, and the weights and thresholds of the BP neural network are optimized. At the same time, the position of the particle swarm is adaptively changed to improve the global search ability of the algorithm, which effectively solves the problem that the BP neural network is prone to fall into local optimality and improves the prediction accuracy and speed of the BP neural network.

[0080] In the embodiment of the present invention, the steps of preprocessing the data in A2 are:

[0081] a211. After receiving the collected data, set the matching template of the required data, and transfer the received data to the matching template, identify the data part that is the same as the row title and column title content in the matching template, and fill the corresponding data result content into the matching template of the corresponding row title and column title;

[0082] a212. After completing the data matching, the result data in the matching template is traversed, and the result columns with blanks or abnormalities at the intersection of the corresponding row headers and column headers are marked, and the missing data values ​​are compensated and the abnormal values ​​are replaced and modified by searching in the database;

[0083] a213. Form a complete matching template with matching data.

[0084] In the embodiment of the present invention, the operation of selecting the required indicator features from the processed data by the random forest algorithm in A2 is:

[0085] a221, randomly extract multiple data subsets from the matching template with matching data;

[0086] a222, and each data subset constructs a decision tree, and randomly selects some features at the splitting node of the decision tree for splitting operation, and generates results after training;

[0087] a223, and the final result of each decision tree is subjected to data fusion to form the required indicator feature set, which is marked as M.

[0088] In the embodiment of the present invention, the operation of normalization based on feature data in A3 is:

[0089] a31. After the indicator feature set M is introduced, it is divided into a training set and a test set in a ratio of 8:2;

[0090] a32, and then scale the data linearly so that the data value is between 0 and 1. The specific expression is:

[0091]

[0092] Where x is the data to be processed, min is the minimum value in the processed data, max is the maximum value in the processed data, and x * This is the final result obtained after data normalization.

[0093] Among them, the random forest algorithm is used to screen out the required indicator features from the processed data, and the features with higher importance are selected as input variables to improve the prediction accuracy of the model. The particle swarm optimization algorithm has the advantages of strong optimization ability and high execution efficiency to optimize the weights and thresholds of the BP neural network, thereby improving the accuracy and speed of air quality prediction.

[0094] In the embodiment of the present invention, the operation of introducing the training set in A3 into the neural network model for training update is:

[0095] B1. First, construct the BP neural network structure and determine the connection weights and total number of thresholds of each layer of the BP neural network structure;

[0096] B2. Optimize the BP neural network using the adaptive particle swarm algorithm, update the particle position and velocity, calculate the updated fitness value, and compare the calculated fitness value after the update with the current optimal fitness value;

[0097] B3. Determine whether the updated operation has reached the end condition and output the optimal weight threshold parameter of the BP neural network.

[0098] In the embodiment of the present invention, the construction operation of the BP neural network structure in B1 is:

[0099] b11. Form a neural network structure through the input layer, hidden layer and output layer, and determine the number of neurons in each layer;

[0100] b12. Determine the number of input layer neurons by the number of indicator features selected in A2, and calculate the number of hidden layer neurons. The number of output layer neurons is determined according to the target number;

[0101] And the formula for calculating the number of neurons in the hidden layer is:

[0102] Where, I is the number of neurons in the input layer, O is the number of neurons in the output layer, H is the number of neurons in the hidden layer, and γ is the adjustment parameter of the number of neurons in the hidden layer, which ranges from 1 to 10.

[0103] b13. Determine the activation function between the input and output of the hidden layer and output layer nodes. The function expression is:

[0104]

[0105] z represents the input value of the neuron;

[0106] b14. Determine the particle dimension, and the calculation formula is:

[0107] D=I*H+H*O+H+O;

[0108] Among them, D is the particle dimension, which is the total number of connection weights and thresholds of each layer of the BP neural network structure.

[0109] In the embodiment of the present invention, the operation of optimizing the BP neural network by the adaptive particle swarm algorithm in B2 is:

[0110] b21. Initialize the particle swarm and parameters, and initialize the individual optimal value and the global optimal value;

[0111] b22. Iterate the particle swarm and parameters, and update the individual speed and position data of the particle swarm through calculation;

[0112] b23, thereby updating the individual optimal value and global optimal value of the particle swarm, and updating the weights and thresholds of the neural network structure.

[0113] In the embodiment of the present invention, the formula for updating the individual velocity and position data of the particle swarm by calculation in b22 is:

[0114] C1. Update the inertia weight in the parameters, and the formula is:

[0115]

[0116] Where w is the inertia weight, and w max and w min are the maximum and minimum values ​​of the inertia weight, respectively; k is the number of iterations in the operation; α and β are adaptive factors and control parameters used to adjust the change of the inertia weight; k max is the maximum number of iterations;

[0117] C2. Update the individual learning factor and social learning factor, and the formula is:

[0118]

[0119] Among them, c1 is the individual learning factor, c2 is the social learning factor, and c1 max and c1 min is the maximum and minimum value of the individual learning factor, and c2 max and c2 min is the maximum and minimum value of the social learning factor;

[0120] C3. Update the particle velocity, and the formula is:

[0121]

[0122] in is the velocity vector of particle i in the dth dimension at the kth iteration, is the position vector of particle i in the dth dimension at the kth iteration, is the historical optimal position of particle i in the dth dimension in the kth iteration, The historical optimal position of the particle swarm in the dth dimension in the kth iteration, and r1 and r2 are set to random numbers between 0 and 1, and pbest is the individual optimal value and gbest is the global optimal value;

[0123] C4. Update the particle position, and the formula is:

[0124]

[0125] is the position vector of particle i in the dth dimension at the kth iteration, is the velocity vector of particle i in the dth dimension at the kth iteration.

[0126] Among them, by adaptively updating the inertia weight w and the learning factors c1 and c2, the speed and position of the particle are adaptively changed after each iteration, which effectively improves the global search capability of the algorithm.

[0127] In the embodiment of the present invention, the formula for calculating the updated fitness value in B2 is:

[0128]

[0129] MSE is the mean square error as the fitness function, where n is the total number of samples, y j is the true value of the data, y l is the predicted value of the data obtained through neural network model training.

[0130] In the embodiment of the present invention, the step of comparing the fitness value calculated after updating with the current optimal fitness value in B2 is:

[0131] D1. Before each iterative update, the currently generated fitness value is compared with the optimal fitness value in the previous operation, and the smaller value is selected as the new optimal fitness value;

[0132] D2, compare the calculated fitness value after update with the current individual optimal fitness value, if the former is less than the latter, update the current individual optimal fitness value;

[0133] Compare the updated fitness value with the current global optimal fitness value. If the former is smaller than the latter, update the current global optimal fitness value.

[0134] D3, and when the operating conditions of D2 are met, the update is completed and the optimal weight threshold parameters of the BP neural network are output. Otherwise, the operation in B2 is repeated until the operating conditions of D2 are met or the maximum number of iterations is met.

[0135] Among them, by comparing the fitness value calculated after the update with the current optimal fitness value, if the former is smaller than the latter, the individual optimal fitness value and the global optimal fitness value are extracted, and the global search ability of the algorithm is improved by adaptively changing the particle position and speed, reducing the situation where the algorithm falls into the local optimum, thereby constructing an air quality prediction model with high prediction accuracy, fast convergence speed and strong search ability, which can be well applied to urban air quality prediction operations.

[0136] Meanwhile, the contents not described in detail in this specification belong to the prior art known to those skilled in the art.

[0137] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.

[0138] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. An adaptive particle swarm optimization BP neural network air quality prediction method, characterized by: The specific steps include: A1. Collect historical weather and meteorological data, real-time weather and meteorological data, pollutant emission data, and spatiotemporal data in the air quality monitoring area and store them in the database; A2. Receive the collected data and perform preprocessing operations on the data, and filter out the required indicator features from the processed data through the random forest algorithm; A3. Divide the filtered feature data into a training set and a test set, perform normalization, and then establish a neural network model. By introducing the filtered training set into the neural network model, the threshold parameters in the neural network are optimized to establish an air quality prediction model. A4. The test set is introduced into the updated air quality prediction model to realize the operation of predicting the air quality index.

2. The method for predicting air quality using an adaptive particle swarm optimization BP neural network according to claim 1, characterized in that: The steps of preprocessing the data in A2 are: a211. After receiving the collected data, set the matching template of the required data, and transfer the received data to the matching template, identify the data part that is the same as the row title and column title content in the matching template, and fill the corresponding data result content into the matching template of the corresponding row title and column title; a212. After completing the data matching, the result data in the matching template is traversed, and the result columns with blanks or abnormalities at the intersection of the corresponding row headers and column headers are marked, and the missing data values ​​are compensated and the abnormal values ​​are replaced and modified by searching in the database; a213. Form a complete matching template with matching data.

3. The air quality prediction method based on adaptive particle swarm optimization BP neural network according to claim 2 is characterized by: In A2, the operation of selecting the required indicator features from the processed data by using the random forest algorithm is as follows: a221, randomly extract multiple data subsets from the matching template with matching data; a222, and each data subset constructs a decision tree, and randomly selects some features at the splitting node of the decision tree for splitting operation, and generates results after training; a223, and the final result of each decision tree is subjected to data fusion to form the required indicator feature set, which is marked as M.

4. The method for predicting air quality using an adaptive particle swarm optimization BP neural network according to claim 3, characterized in that: The operation of normalization based on feature data in A3 is: a31. After the indicator feature set M is introduced, it is divided into a training set and a test set in a ratio of 8:2; a32, and then scale the data linearly so that the data value is between 0 and 1. The specific expression is: Where x is the data to be processed, min is the minimum value in the processed data, max is the maximum value in the processed data, and x * This is the final result obtained after data normalization.

5. The method for predicting air quality using an adaptive particle swarm optimization BP neural network according to claim 1, characterized in that: The operation of introducing the training set in A3 into the neural network model for training and updating is: B1. First, construct the BP neural network structure and determine the connection weights and total number of thresholds of each layer of the BP neural network structure; B2. Optimize the BP neural network using the adaptive particle swarm algorithm, update the particle position and velocity, calculate the updated fitness value, and compare the calculated fitness value after the update with the current optimal fitness value; B3. Determine whether the updated operation has reached the end condition and output the optimal weight threshold parameter of the BP neural network.

6. The method for predicting air quality using an adaptive particle swarm optimization BP neural network according to claim 5, characterized in that: The construction operation of the BP neural network structure in B1 is: b11. Form a neural network structure through the input layer, hidden layer and output layer, and determine the number of neurons in each layer; b12. Determine the number of input layer neurons by the number of indicator features selected in A2, and calculate the number of hidden layer neurons. The number of output layer neurons is determined according to the target number; And the formula for calculating the number of neurons in the hidden layer is: Where, I is the number of neurons in the input layer, O is the number of neurons in the output layer, H is the number of neurons in the hidden layer, and γ is the adjustment parameter of the number of neurons in the hidden layer, which ranges from 1 to 10. b13. Determine the activation function between the input and output of the hidden layer and output layer nodes. The function expression is: z represents the input value of the neuron; b14. Determine the particle dimension, and the calculation formula is: D=I*H+H*O+H+O; Among them, D is the particle dimension, which is the total number of connection weights and thresholds of each layer of the BP neural network structure.

7. The method for predicting air quality using an adaptive particle swarm optimization BP neural network according to claim 5, characterized in that: The operation of the adaptive particle swarm algorithm to optimize the BP neural network in B2 is: b21. Initialize the particle swarm and parameters, and initialize the individual optimal value and the global optimal value; b22. Iterate the particle swarm and parameters, and update the individual speed and position data of the particle swarm through calculation; b23, thereby updating the individual optimal value and global optimal value of the particle swarm, and updating the weights and thresholds of the neural network structure.

8. The method for predicting air quality using an adaptive particle swarm optimization BP neural network according to claim 7, characterized in that: The formula for updating the individual velocity and position data of the particle swarm by calculation in b22 is: C1. Update the inertia weight in the parameters, and the formula is: Where w is the inertia weight, and w max and w min are the maximum and minimum values ​​of the inertia weight, respectively; k is the number of iterations in the operation; α and β are adaptive factors and control parameters used to adjust the change of the inertia weight; k max is the maximum number of iterations; C2. Update the individual learning factor and social learning factor, and the formula is: Among them, c1 is the individual learning factor, c2 is the social learning factor, and c1 max and c1 min is the maximum and minimum value of the individual learning factor, and c2 max and c2 min is the maximum and minimum value of the social learning factor; C3. Update the particle velocity, and the formula is: in is the velocity vector of particle i in the dth dimension at the kth iteration, is the position vector of particle i in the dth dimension at the kth iteration, is the historical optimal position of particle i in the dth dimension in the kth iteration, The historical optimal position of the particle swarm in the dth dimension in the kth iteration, and r1 and r2 are set to random numbers between 0 and 1, and pbest is the individual optimal value and gbest is the global optimal value; C4. Update the particle position, and the formula is: is the position vector of particle i in the dth dimension at the kth iteration, is the velocity vector of particle i in the dth dimension at the kth iteration.

9. The method for predicting air quality using an adaptive particle swarm optimization BP neural network according to claim 5, characterized in that: The formula for calculating the updated fitness value in B2 is: MSE is the mean square error as the fitness function, where n is the total number of samples, y j is the true value of the data, y l is the predicted value of the data obtained through neural network model training.

10. The method for predicting air quality using an adaptive particle swarm optimization BP neural network according to claim 5, characterized in that: The step of comparing the fitness value calculated after updating with the current optimal fitness value in B2 is: D1. Before each iterative update, the currently generated fitness value is compared with the optimal fitness value in the previous operation, and the smaller value is selected as the new optimal fitness value; D2, compare the calculated fitness value after update with the current individual optimal fitness value, if the former is less than the latter, update the current individual optimal fitness value; Compare the updated fitness value with the current global optimal fitness value. If the former is smaller than the latter, update the current global optimal fitness value. D3, and when the operating conditions of D2 are met, the update ends and the optimal weight threshold parameters of the BP neural network are output. Otherwise, the operation in B2 is repeated until the operating conditions of D2 are met or the maximum number of iterations is met.

Citation Information

Patent Citations

  • Urban air quality prediction method based on neural network

    CN116205317A

  • Air quality prediction method based on PSODE-BP neural network

    CN109063938A

  • An automatic balance control method based on APSO-BP for double counterweight plates

    CN109190270A

  • Traffic flow prediction method and device for optimizing LSTM (Long Short Term Memory) based on improved PSO (Particle Swarm Optimization) algorithm

    CN114970815A

  • Carbon emission prediction method and terminal

    CN115796358A