Air quality prediction method and system based on GA-BP neural network coupled decision tree
Through the GA-BP neural network coupled decision tree method, the air quality index level is directly predicted from historical data, which solves the problem of slow and inaccurate prediction speed in the existing technology, and achieves fast and accurate air quality prediction, which is suitable for cities. Air quality management.
Patent Information
- Application Number
- CN202210493233.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-07
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2042-05-07
AI Technical Summary
Existing air quality prediction methods have problems such as slow prediction speed, complex process, and inaccurate prediction results. They are also highly professional and difficult to be understood by residents.
The GA-BP neural network coupled decision tree method is used to obtain historical gas phase data and pollutant emission data, and principal component analysis is used to determine the input variables. An 8-6-5 BP neural network is constructed, and a genetic algorithm is used to optimize the neural network, combined with the CART algorithm. Divide data attributes, build a decision tree model, and directly predict air quality index levels.
It achieves fast, systematic and accurate air quality prediction, avoids the complexity of air pollutant migration process simulation in traditional methods, provides fast and accurate air quality prediction and index level classification, and guides cities to adopt Air pollution prevention measures.
Smart Images

Figure CN114781538B
Abstract
Description
Technical Field
[0001] The invention belongs to the field of air quality prediction, and in particular relates to an air quality prediction method based on a GA-BP neural network coupled decision tree. Background Art
[0002] At present, most air quality prediction methods rely on air quality simulation software to simulate past weather conditions and pollutant migration processes. The prediction results are refined atmospheric pollutant concentration data, which are highly professional and difficult for residents to understand. In addition, traditional air quality prediction methods also have problems such as complex prediction process, short prediction time, and inaccurate prediction results.
[0003] The main pollutants in the air are PM 2.5 、PM 10 、SO 2 、NO X , O 3 , CO and other substances. Many studies have shown that the excessive presence of pollutants in the air has caused a series of environmental problems such as acid rain and photochemical smog. Therefore, in order to better prevent and control air pollution, guide relevant departments and urban residents to take corresponding protective measures, and carry out air quality prediction research has become inevitable.
[0004] Based on the above analysis, designing an air quality prediction technology with fast prediction speed, strong systematicity and high prediction accuracy is a technical problem that needs to be solved urgently by technical personnel in this field. Summary of the invention
[0005] In view of the above-mentioned defects of the prior art, on the one hand, the present invention provides an air quality prediction method of a GA-BP neural network coupled with a decision tree, characterized in that it comprises the following steps:
[0006] S1. Obtain historical gas phase data and pollutant emission data of the research area;
[0007] S2, principal component analysis identified 8 input variables;
[0008] S3, determine the network topology of 8-6-5 and construct BP neural network;
[0009] S4, obtain the GA-BP neural network through genetic algorithm optimization and make predictions;
[0010] S5. Divide data attributes based on CART algorithm;
[0011] S6. Construct a decision tree model to predict the air quality index level;
[0012] Preferably, in step S1, the gas phase data includes air temperature, wind speed, wind direction, relative humidity, air pressure and rainfall, and the pollutant emission data includes PM 2.5 、PM 10 、NO 2 , NO, CO and O 3 , the gas phase data and pollutant emission data are obtained through satellite remote sensing technology and ground monitoring stations.
[0013] Preferably, in step S2, the input variables include wind speed, rainfall, relative humidity, PM 2.5 、PM 10 、SO 2 , O 3 and NO 2 .
[0014] Preferably, in step S3, the output layer of the network topology structure includes PM 2.5 、PM 10 、SO 2 , O 3 and NO 2 A total of 5 predicted concentration data, among which the number of hidden layer neurons is set to 6, and the number of hidden layer neurons is determined by the following formula:
[0015]
[0016] Among them, H is the number of neurons in the hidden layer, I is the number of neurons in the input layer, O is the number of neurons in the output layer, and α is an integer ranging from 1 to 10.
[0017] Preferably, in step S4, encoding and initializing the initial population to generate an array as a chromosome is determined by the following formula:
[0018] L=I×H+H×O+H+O
[0019] L represents the length of the chromosome, I is the number of neurons in the input layer, H is the number of neurons in the hidden layer, and O is the number of neurons in the output layer. The chromosome is used for selection, crossover, and mutation operations of the genetic algorithm;
[0020]
[0021] Among them, F represents the fitness value of individual i, n is the number of neurons in the output layer, k is the coefficient, abs is the absolute value function, and y i is the expected output value of the ith neuron, o i is the output prediction value of the i-th neuron.
[0022] Preferably, in step S5, the data attributes of the five output indicators in the output layer of the GA-BP neural network are divided by the Gini index method in the CART algorithm, using the following formula:
[0023]
[0024]
[0025] Where Gini represents the Gini index, P(i) represents the probability of label=i, and n represents the sum of label categories; in formula (5), Represents the weighted average of the Gini index, Gini 1 Gini index for label = 1, Gini 2 represents the Gini index of label=2, T represents the total number of individuals in all label categories, a represents the number of individuals with label=1, and b represents the number of individuals with label=2.
[0026] More preferably, in step S6, the weighted average of the Gini index of the five data items in the output layer is compared by the Gini index method to determine the root node, internal node and leaf node of the decision tree model, and the decision tree model is constructed layer by layer. The air quality index levels include I excellent, II good, III light pollution, IV moderate pollution, V heavy pollution and VI severe pollution.
[0027] In a second aspect, the present invention further provides an air quality prediction system of a GA-BP neural network coupled with a decision tree for implementing the above method, comprising:
[0028] Data acquisition module: used to obtain historical gas phase data and pollutant emission data of the research area;
[0029] Principal component analysis module: used to determine input variables;
[0030] Neural network module: used to build GA-BP neural network model;
[0031] Algorithm optimization module: optimize the GA-BP neural network model based on genetic algorithm;
[0032] Data partitioning module: used to determine the index with the smallest weighted average value of the Gini index as the root node, internal node and leaf node of the decision tree;
[0033] Classification prediction module: used to classify the calculated results into corresponding air quality indexes.
[0034] In a third aspect, the present invention further provides an air quality prediction device of a GA-BP neural network coupled with a decision tree, comprising:
[0035] Memory for storing computer programs;
[0036] A processor is used to execute the computer program to implement the steps of implementing the above method as disclosed above.
[0037] In a fourth aspect, the present invention further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the air quality prediction method of the GA-BP neural network coupled decision tree as disclosed above are implemented.
[0038] The present invention provides an air quality prediction method with fast prediction speed, strong systematicity and high accuracy. Compared with traditional software, the traditional software method takes a long time and is more complicated to simulate the migration process of pollutants. The prediction method of the present invention does not need to simulate the migration process of air pollutants, which is time-consuming and can achieve the purpose of prediction directly through data training. It can open up new ways for air quality prediction and air quality index grade classification prediction in cities (or regions) in my country, and can also provide guidance and reference for cities (or regions) in my country to take air pollution prevention measures. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 It is a flow chart of the GA-BP neural network coupled decision tree air quality prediction method of the present invention;
[0040] Figure 2 It is the 8-6-5 three-layer BP neural network structure diagram of the present invention;
[0041] Figure 3 It is a decision tree model diagram for predicting the air quality index level of the present invention. DETAILED DESCRIPTION
[0042] The embodiments of the present invention are described in detail below. The following embodiments are implemented on the premise of the technical solution of the present invention, and detailed implementation methods and specific operation processes are given, but the protection scope of the present invention is not limited to the following embodiments.
[0043] On the one hand, the present invention provides an air quality prediction method based on a GA-BP neural network coupled decision tree, characterized in that: Figure 1 , including the following steps:
[0044] S1. Obtain historical gas phase data and pollutant emission data of the research area;
[0045] First, the target city (or region) is continuously monitored by using satellite remote sensing technology and ground monitoring stations to obtain historical gas phase data and pollutant emission data, and the validity of the data is determined to eliminate samples with missing data. The gas phase data (daily average) required for the present invention include: temperature, wind speed, wind direction, relative humidity, air pressure and rainfall; the pollutant data categories (daily average emission concentration) required to be obtained include: PM 2.5 、PM 10 、NO 2 , NO, CO and O 3 .
[0046] S2, principal component analysis identified 8 input variables;
[0047] Principal component analysis can realize the quantitative identification of key influencing factors. The principal component analysis of the factors affecting air quality is performed through Matlab 2019b Matrix Factory software, and the analysis results can be used as input variables of the input layer. This step includes using the PCA function (Principal Component Analysis) to perform correlation analysis on the various influencing factors affecting air quality to obtain the principal component contribution rate. The principal component contribution rate is sorted and screened as an indicator of the BP neural network input variable. After analysis, the input variables selected by the present invention include the following 8 items, namely wind speed, rainfall, relative humidity, PM 2.5 、PM 10 、SO 2 , O 3 and NO 2 .
[0048] S3, determine the network topology of 8-6-5 and construct BP neural network;
[0049] Based on the principal component analysis results in step S2, the input layer structure of the BP neural network can be determined. The output variables of the output layer are set to 5 predicted pollutant concentrations, including PM 2.5 、PM 10 、SO 2 , O 3 and NO 2 A total of 5 items of predicted concentration data.
[0050] The number of neurons in the hidden layer needs to be determined according to the formula, and the formula used is as follows:
[0051]
[0052] Among them, H is the number of neurons in the hidden layer, I is the number of neurons in the input layer, O is the number of neurons in the output layer, and α is an integer ranging from 1 to 10.
[0053] Based on the above analysis, we have determined that the input layer has 8 input variables and the output layer has 5 output variables. Through calculation, the potential number of neurons in the hidden layer is 5 to 14. Through trial and error experiments, we analyze the error of different numbers of neurons, calculate the relative error and correlation coefficient, and finally set the number of neurons in the hidden layer to 6. Based on the above analysis, we can construct a BP neural network with an 8-6-5 structure, as shown in the attached figure. Figure 2 In addition, in the selection of transfer function, the hidden layer uses the traditional tansig function in the Matlab 2019b matrix factory software, and the output layer uses the purelin function; the learning function of the training data set is the LM (Levenberg-Marquardt) algorithm, which can realize data set training, learning and prediction.
[0054] See also Figure 2 ,according to Figure 2 The neural network structure shown in the figure takes the eight input variables (wind speed, rainfall, relative humidity, PM) determined in step 2 as input variables. 2.5 、PM 10 、SO 2 , O 3 and NO 2 . ) is input into the input layer, and after learning, training and predicting the hidden layer function and the output layer function, 5 output variables are finally output in the output layer to realize PM 2.5 、PM 10 、SO 2 , O 3 and NO 2 Prediction of five pollutant concentrations.
[0055] S4, obtain the GA-BP neural network through genetic algorithm optimization and make predictions;
[0056] The initial weights and thresholds between neurons in different layers of the BP neural network in step S3 are randomly generated, and this random generation method cannot ensure the accuracy of the output results. Therefore, a genetic algorithm is coupled in the process of determining the initial weights and thresholds of the BP neural network, so that it can have a global search function, and the optimal initial weights and thresholds are iteratively selected through genetic operations to improve the accuracy of the output results of the neural network.
[0057] The genetic algorithm first generates an array as a chromosome by encoding the initial population and initialization, which is determined by the following formula:
[0058] L=I×H+H×O+H+O
[0059] Among them, L represents the chromosome length, I is the number of neurons in the input layer, H is the number of neurons in the hidden layer, and O is the number of neurons in the output layer. The chromosome is used for selection, crossover, and mutation operations of the genetic algorithm.
[0060] The second step is to determine the fitness function to calculate the individual fitness value. The formula used is as follows:
[0061]
[0062] Among them, F represents the fitness value of individual i, n is the number of neurons in the output layer, k is the coefficient, abs is the absolute value function, and y i is the expected output value of the ith neuron, o i is the output prediction value of the i-th neuron.
[0063] Then, the number of iterations, crossover rate and mutation rate of the genetic algorithm are set, and the fitness test is performed on each of the generated initial weights and thresholds to select the individual with the best fitness, which in the present invention is the individual with the smallest fitness value F. This individual can be used as the optimal initial weight and threshold to return to the BP neural network simulation program;
[0064] Based on the above analysis and operation, the GA-BP neural network is obtained by optimizing the BP neural network with the genetic algorithm, and the training data samples are selected for training and learning to predict the pollutant concentration data, and then tested by the test samples. The network error between the predicted data and the test sample data is further calculated, and the network error is back-propagated to each layer of neural nodes through neurons to update the weights of each pair of connected neurons, and then the neural network is re-derived until the network error meets the prediction accuracy requirements before the output layer outputs the predicted pollutant concentration.
[0065] S5. Divide data attributes based on CART algorithm;
[0066] Taking the training data set of BP neural network as the object, the data attributes of the five output indicators in the output layer of the P neural network in step S3 are divided by the Gini index method in the CART algorithm. The weighted average of the Gini index of each indicator is calculated, and the indicator with the smallest weighted average of the Gini index is determined as the root node, internal node and leaf node of the decision tree according to the size.
[0067] The formula used is as follows:
[0068]
[0069]
[0070] Where Gini represents the Gini index, P(i) represents the probability of label=i, and n represents the sum of label categories; in formula (5), Represents the weighted average of the Gini index, Gini 1 Gini index for label = 1, Gini 2represents the Gini index of label=2, T represents the total number of individuals in all label categories, a represents the number of individuals with label=1, and b represents the number of individuals with label=2.
[0071] In one embodiment, PM is determined after calculation and analysis. 2.5 ≤150 is the root node of the decision tree; internal nodes include: PM 10 ≤150, PM 2.5 ≤250, SO 2 ≤3, PM 2.5 ≤75, NO 2 ≤40, O 3 ≤160、NO 2 ≤180, O 3 ≤100, O 3 ≤215; leaf nodes include: label=I, label=II, label=III, label=IV, label=V, label=VI.
[0072] S6. Construct a decision tree model to predict the air quality index level;
[0073] According to step 5, the weighted average values of the Gini index of each output index of the BP neural network are sorted to determine the root node, internal node, and leaf node of the decision tree. The decision tree model for air quality index level prediction and classification can be constructed layer by layer, as shown in the attached figure. Figure 3 As shown in the attached Figure 3 The decision tree model structure substitutes the five pollutant concentration prediction values in the output results of the GA-BP neural network output layer into the root node and each internal node in the decision tree from top to bottom according to the logical conditions for deduction. Following the guidance of the decision tree model, each pollutant concentration prediction sample can be finally classified into six air pollution index levels, namely (I) excellent, (II) good, (III) light pollution, (IV) moderate pollution, (V) heavy pollution and (VI) severe pollution.
[0074] Attach Figure 3 For example, in one embodiment, the atmospheric pollutant concentration value (unit: μg / m 3 ) are as follows: PM 2.5 33, PM 10 38, SO 2 3. NO 2 33, O 3 is 78. First, determine PM 2.5 If the concentration value is less than 150, further determination of PM 10 The concentration value is less than 150, then determine SO 2If the concentration value is less than or equal to 3, the decision tree model outputs the result "the air quality index level for that day is level I". It has been verified that the air quality index level for that day is level I, and the model prediction result is accurate. The prediction process for other prediction samples is similar.
[0075] In one embodiment, the experimenter can comprehensively evaluate and test the effectiveness of the prediction results of the model through three evaluation indicators: accuracy, false alarm rate, and missed alarm rate, and compare them with traditional forecasting methods.
[0076] In this embodiment, if the prediction accuracy reaches 90%, the model is assumed to be a reliable model; if the accuracy is lower than 90%, the program is restarted by adjusting the weights and thresholds to perform a re-prediction, so the air prediction result of the present invention is more accurate. The specific formula used is as follows:
[0077]
[0078]
[0079]
[0080] In summary, the air quality prediction and level classification method constructed by the GA-BP neural network coupling decision tree of the present invention is compared with traditional software. The traditional software method simulates the pollutant migration process in a long time and the process is more complicated. The prediction method of the present invention does not need to simulate the air pollutant migration process, which is time-consuming and can achieve the purpose of prediction directly through data training. It can open up new ways for air quality prediction and air quality index level classification prediction in cities (or regions) in my country, and provide guidance and reference for cities (or regions) in my country to take air pollution prevention measures. It can be trained and learned through historical meteorological data and pollutant emission data to predict future pollutant emission levels, thereby achieving the purpose of predicting air quality conditions and predicting air quality index levels.
[0081] In a second aspect, the present invention further provides an air quality prediction system of a GA-BP neural network coupled with a decision tree for implementing the above method, comprising:
[0082] Data acquisition module: used to obtain historical gas phase data and pollutant emission data of the research area;
[0083] Principal component analysis module: used to determine input variables;
[0084] Neural network module: used to build GA-BP neural network model;
[0085] Algorithm optimization module: optimize the GA-BP neural network model based on genetic algorithm;
[0086] Data partitioning module: used to determine the index with the smallest weighted average value of the Gini index as the root node, internal node and leaf node of the decision tree;
[0087] Classification prediction module: used to classify the calculated results into corresponding air quality indexes.
[0088] In a third aspect, the present invention further provides an air quality prediction device of a GA-BP neural network coupled with a decision tree, comprising:
[0089] Memory for storing computer programs;
[0090] A processor is used to execute the computer program to implement the steps of implementing the above method as disclosed above.
[0091] In a fourth aspect, the present invention further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the air quality prediction method of the GA-BP neural network coupled decision tree as disclosed above are implemented.
[0092] The preferred specific embodiments of the present invention are described in detail above. It should be understood that ordinary technicians in the field can make many modifications and changes based on the concept of the present invention without creative work. Therefore, all technical solutions that can be obtained by technicians in the technical field based on the concept of the present invention through logical analysis, reasoning or limited experiments on the basis of the prior art should be within the scope of protection determined by the claims.
Claims
1. A GA-BP neural network coupled decision tree air quality prediction method, characterized in that: The following steps are involved: S1. Obtain historical gas phase data and pollutant emission data of the research area; In step S1, the gas phase data includes air temperature, wind speed, wind direction, relative humidity, air pressure and rainfall, and the pollutant emission data includes PM 2.5 、PM 10 , NO2, NO, CO and O3, the gas phase data and pollutant emission data are obtained through satellite remote sensing technology and ground monitoring stations; S2, principal component analysis identified 8 input variables; In step S2, the input variables include wind speed, rainfall, relative humidity, PM 2.5 、PM 10 , SO2, O3 and NO2; S3, determine the network topology of 8-6-5 and construct BP neural network; In step S3, the output layer of the network topology structure includes PM 2.5 、PM 10 , SO2, O3 and NO2, a total of 5 predicted concentration data, among which the number of hidden layer neurons is set to 6, and the number of hidden layer neurons is determined by the following formula: Among them, H is the number of neurons in the hidden layer, I is the number of neurons in the input layer, O is the number of neurons in the output layer, and α is an integer ranging from 1 to 10; S4, obtain the GA-BP neural network through genetic algorithm optimization and make predictions; In step S4, encoding and initializing the initial population to generate an array as a chromosome is determined by the following formula: L=I×H+H×O+H+O Among them, L represents the chromosome length, I is the number of neurons in the input layer, H is the number of neurons in the hidden layer, and O is the number of neurons in the output layer. The chromosome is used for selection, crossover, and mutation operations of the genetic algorithm; Among them, F represents the fitness value of individual i, n is the number of neurons in the output layer, k is the coefficient, abs is the absolute value function, and y i is the expected output value of the ith neuron, o i is the output prediction value of the i-th neuron; S5. Divide data attributes based on CART algorithm; In step S5, the data attributes of the five output indicators in the output layer of the GA-BP neural network are divided by the Gini index method in the CART algorithm, using the following formula: Where Gini represents the Gini index, P(i) represents the probability of label=i, and n represents the sum of label categories; in formula (5), represents the weighted average of the Gini index, Gini1 represents the Gini index of label=1, Gini2 represents the Gini index of label=2, T represents the total number of individuals in all label categories, a represents the number of individuals with label=1, and b represents the number of individuals with label=2; S6. Construct a decision tree model to predict the air quality index level; In step S6, the weighted average values of the Gini indexes of the five items of data in the output layer are compared by the Gini index method to determine the root node, internal node and leaf node of the decision tree model, and the decision tree model is constructed layer by layer. The air quality index levels include I excellent, II good, III light pollution, IV moderate pollution, V heavy pollution and VI severe pollution.
2. A GA-BP neural network coupled decision tree air quality prediction system, the GA-BP neural network coupled decision tree air quality prediction system is used to implement the GA-BP neural network coupled decision tree air quality prediction method as claimed in claim 1, characterized in that: include: Data acquisition module: used to obtain historical gas phase data and pollutant emission data of the research area; Principal component analysis module: used to determine input variables; Neural network module: used to build GA-BP neural network model; Algorithm optimization module: optimize the GA-BP neural network model based on genetic algorithm; Data partitioning module: used to determine the index with the smallest weighted average value of the Gini index as the root node, internal node and leaf node of the decision tree; Classification prediction module: used to classify the calculated results into corresponding air quality indexes.
3. An air quality prediction device based on a GA-BP neural network coupled with a decision tree, characterized in that: include: Memory for storing computer programs; A processor is used to implement the steps of the air quality prediction method of the GA-BP neural network coupled decision tree as claimed in claim 1 when executing the computer program.
4. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the air quality prediction method of the GA-BP neural network coupled decision tree as claimed in claim 1 is implemented.
Citation Information
Cited By
Bearing heat treatment parameter influence degree analysis method based on machine learning
CN120162676A
