PM2.5 hourly concentration combined prediction method and system based on trend clustering and ensemble tree
Through the combined prediction method of trend clustering and ensemble trees, the problem of large errors and low accuracy in PM2.5 hourly concentration prediction is solved, and high-accuracy multi-step prediction is achieved, which is suitable for PM2.5 hourly concentration prediction in different seasons. .
Patent Information
- Application Number
- CN202010732850.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-27
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2040-07-27
AI Technical Summary
The existing multi-step prediction methods for PM2.5 hourly concentration have problems such as large errors, low accuracy, and long prediction time.
Using a combined forecasting method based on trend clustering and ensemble trees, the PM2.5 mean sequence is divided into different clustering periods through trend clustering, and a variety of multi-step prediction models are established for each clustering period, and the one with the highest prediction accuracy is selected. The model builds a combined prediction model to achieve multi-step prediction of PM2.5 hourly concentration.
It improves the accuracy and accuracy of PM2.5 hourly concentration prediction, reduces the prediction error, adapts to the multi-step prediction requirements of PM2.5 hourly concentration in different seasons, and has strong generalization ability.
Smart Images

Figure CN111898820B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of environmental data prediction, and in particular to a PM2.5 hourly concentration combined prediction method and system based on trend clustering and ensemble tree. Background Art
[0002] In recent years, haze pollution with PM2.5 as an important component has occurred frequently, causing serious harm to human life and the ecological environment. The multi-step prediction of PM2.5 hourly concentration is of great reference significance for the early warning and forecast of PM2.5. Considering the timeliness and dynamics of the atmospheric environment, the accurate hourly prediction of PM2.5 concentration can effectively improve the forecast and early warning capabilities of air pollution, and is also an important research direction for current air quality forecasting and prevention.
[0003] PM2.5 concentration is affected by many factors during its change process, and it is difficult to accurately predict PM2.5 concentration over a long period of time. At present, air pollutant concentration prediction models are roughly divided into two types: mechanism models and non-mechanism models. Among them, the mechanism model predicts the concentration of pollutants by simulating the diffusion process of air pollutants, and the quality of its results depends largely on the accuracy of the list of air pollutant emission sources. The non-mechanism model is based on historical data of pollutant concentrations and meteorological elements, and uses methods such as multivariate linear regression, random forest, and artificial neural networks to predict air pollutant concentrations. Although the non-mechanism model has the advantages of simple construction and easy data acquisition, it still has problems such as large errors in prediction results and low accuracy. Summary of the invention
[0004] The present invention aims to provide a combined prediction method and system for PM2.5 hourly concentration based on trend clustering and integrated tree, which can solve the problems of large error, low accuracy, long prediction time, etc. in existing multi-step prediction methods or prediction models for PM2.5 hourly concentration.
[0005] This application provides the following technical solutions:
[0006] The combined prediction method of PM2.5 hourly concentration based on trend clustering and ensemble tree includes the following contents:
[0007] Trend clustering step: Based on the PM2.5 mean sequence and prediction step, the PM2.5 mean sequence is divided into different clustering periods according to trend similarity;
[0008] The combined prediction model building step is to establish multiple different types of multi-step prediction models for each clustering period according to the clustering results of the trend clustering step, and select the multi-step prediction model with the highest prediction accuracy in each clustering period to build the combined prediction model;
[0009] Prediction step: output multi-step prediction results of PM2.5 hourly concentration based on the combined prediction model.
[0010] In the technical solution of the present invention, a combined prediction model based on trend clustering and integrated tree can realize multi-step prediction of PM2.5 hourly concentration. The combined prediction model adopts a direct multi-step prediction strategy, which consists of two stages: PM2.5 time series trend clustering and combined prediction model construction; the combined prediction model has the advantages of low error and high accuracy, and is superior to the single integrated tree prediction model to a certain extent; the combined prediction model adopts a direct multi-step prediction method, which can avoid cumulative errors, further improve the prediction accuracy, and can adapt to the multi-step prediction needs of PM2.5 hourly concentration in different seasons.
[0011] Furthermore, the trend clustering step specifically includes:
[0012] S100: Get the PM2.5 mean value series based on the historical data of long-term PM2.5 series;
[0013] S200: Divide the mean sequence into multiple subsequences of different time periods according to the prediction step length;
[0014] S300: Based on the K-means method, the subsequences of different time periods are divided into different clustering time periods according to trend similarity.
[0015] Further, the S100 specifically includes: obtaining historical data of PM2.5, calculating the average concentration of PM2.5 within 24 hours in a day, and constructing a 24-hour average concentration sequence of PM2.5 The S200 specifically includes: converting the PM2.5 mean value sequence Divide into 24 subsequences of length T, and get the subsequence set Where T is the prediction step size, which is the number of PM2.5 at an unknown time that the multi-step prediction model can predict.
[0016] Further, the S300 specifically includes:
[0017] S301: Select multiple different k values, execute S302 to S305 for each k value to obtain a clustering result for each k value, and then execute S306;
[0018] S302: randomly selecting k subsequences from the subsequence set as initial clustering centers;
[0019] S303: Calculate the Pearson distance between each subsequence and the cluster center, and divide the subsequence into the cluster with the closest distance;
[0020] The Pearson distance is: d p =1-r, where r represents the Pearson correlation coefficient;
[0021] S304: Calculate the cluster center of each class again;
[0022] S305: When the cluster center cannot be adjusted, the iteration is terminated; otherwise, steps S303 and S304 are repeated;
[0023] S306: using the average intra-class distance, the average inter-class distance and the IG index as clustering evaluation indicators, and selecting the optimal k value;
[0024] The calculation formula for the average intra-class distance is:
[0025]
[0026] in, I i represents the i-th cluster u i The average distance between a subsequence in a class and other subsequences in the class, L i Represents class u i The number of subsequences contained in Representative Class The lth and cth subsequences in represent and Pearson distance;
[0027] The calculation formula for the average inter-class distance is:
[0028]
[0029] in, is the cluster u i With cluster u j The average distance in
[0030] The calculation formula of the IG indicator is:
[0031]
[0032] The smaller the average intra-class distance, the smaller the internal differences of each class in the clustering result, and the larger the average inter-class distance, the greater the difference between classes in the clustering result. When the intra-class distance is small and the inter-class distance is large, the IG value is close to 1, and the clustering effect is good; when the intra-class distance is large and the inter-class distance is small, the IG value is close to -1, and the clustering effect is poor. Therefore, the optimal k value for clustering can be obtained by evaluating the average intra-class distance, the average inter-class distance and the IG index.
[0033] Furthermore, the steps of building the combined prediction model specifically include:
[0034] S400: Based on the trend clustering results, PM2.5 spatiotemporal characteristics, air pollutants, and meteorological data are used as prediction features to construct a sample set for the PM2.5 subsequences in each clustering period; the structure of the sample set is n is the number of samples, x i is the PM2.5 prediction feature, y i For PM2.5 sequences, the sample set is divided into training set, validation set and test set;
[0035] S500: Based on the sample set, multiple different types of multi-step prediction models are established for the PM2.5 subsequences in each clustering period;
[0036] S600: Compare the prediction accuracies of different types of multi-step prediction models in different clustering periods, and select the model with the highest prediction accuracy in each clustering period to form a combined prediction model.
[0037] Further, in S500, the type of the multi-step prediction model includes an RFR model, and S500 includes:
[0038] S501: RFR model construction steps;
[0039] The steps of building the RFR model include:
[0040] S5011: Input training set data (X train ,Y train );
[0041] S5012: Set the resampling ratio, use the Bootstrap method to resample from the training set, generate a training sample subset, randomly extract m features from the prediction features of the training sample subset, and construct a least squares regression tree;
[0042] S5013: Repeat step S5012 to build M regression trees and obtain a random forest regression model;
[0043] S5014: Averaging the prediction values of the M regression trees to obtain the final prediction result.
[0044] Further, in S500, the type of the multi-step prediction model includes a GBRT model, and S500 includes:
[0045] S502: GBRT model construction step;
[0046] The GBRT model construction steps include:
[0047] S5021: Input training set data (X train ,Y train );
[0048] S5022: Initialize GBRT model:
[0049]
[0050] S5023: Iteratively generate M regression trees. The following three steps are performed for each of the M regression trees, where m represents the mth regression tree:
[0051] I: For all n training samples, calculate the negative gradient of the loss function of the m-1th regression tree according to the following formula and use it as the estimated value of the residual r im , where i represents the i-th sample:
[0052]
[0053] II: Based on the calculated residual r im Fit the mth regression tree g m (x), and calculate the step size of the gradient descent:
[0054]
[0055] III: Update GBRT model:
[0056] f m (x) = f m-1 (x)+lr*ρ m g m (x)
[0057] Among them, lr represents the learning rate, which is used to control the impact of a single regression tree model on the overall GBRT model;
[0058] S5024: Get the overall GBRT model:
[0059]
[0060] Further, in S500, the type of the multi-step prediction model includes an Xgboost model, and S500 includes:
[0061] S503: Xgboost model construction step;
[0062] The Xgboost model building steps include:
[0063] S5031: Input training set data (X train ,Y train );
[0064] S5032: Iteratively generate an Xgboost model and iteratively generate M regression trees. During the iteration process, the loss function is defined as follows:
[0065]
[0066] By performing a second-order Taylor expansion of the objective function, we can obtain:
[0067]
[0068] In the formula, g i and h i are the first-order and second-order coefficients of Taylor expansion, is the predicted value of the i-th sample, y i is the true value, f m represents the mth regression tree, Ω(f m ) is a regularization term used to prevent overfitting:
[0069]
[0070] Among them, T and ω are the number of leaf nodes and leaf weight values, respectively, and γ and λ are the weight penalty coefficients of the number of leaf nodes and leaf weight values, respectively;
[0071] S5033: Taking the objective function value as the residual value, the residual value of the previous regression tree is continuously fitted through an iterative method, and finally all regression trees are added together to obtain the overall Xgboost model.
[0072] Furthermore, in S500, the type of multi-step prediction model includes the LightGBM model, and S500 includes:
[0073] S504: LightGBM model construction steps;
[0074] The LightGBM model construction steps include:
[0075] S5041: Input training set data (X train ,Y train );
[0076] S5042: Iteratively generate M regression trees. The following four steps are performed for each of the M regression trees, where m represents the mth tree:
[0077] I: For the i-th sample of all n training samples, calculate the negative gradient value of the loss function of the m-1-th regression tree model, and update the regression tree according to the gradient descent direction and step size;
[0078] II: Construct a histogram of the feature values of the training samples, calculate the gain of each segmentation point, and find the optimal segmentation point;
[0079] III: Use Leaf_wise tree growth strategy with depth limit to limit the number of leaves in the tree;
[0080] IV: Update training results:
[0081]
[0082] S5043: Get the LightGBM overall model: add all regression trees together to get the final LightGBM model.
[0083] Furthermore, the present application also discloses a PM2.5 hourly concentration combined prediction system based on trend clustering and integrated tree, which uses the above method. BRIEF DESCRIPTION OF THE DRAWINGS
[0084] Figure 1 This is a flow chart of an embodiment of a PM2.5 hourly concentration combined prediction method and system based on trend clustering and integrated tree in this application;
[0085] Figure 2 A schematic diagram of a 24-hour mean concentration sequence of PM2.5 in an embodiment of a PM2.5 hourly concentration combined prediction method and system based on trend clustering and integrated tree of this application;
[0086] Figure 3 A schematic diagram of 24 subsequences obtained by dividing the mean sequence in the PM2.5 hourly concentration combined prediction method and system embodiment based on trend clustering and ensemble tree of this application;
[0087] Figure 4 This is a comparison chart of the RMSE values at T1 of the combined prediction model and other models in the PM2.5 hourly concentration combined prediction method and system embodiment based on trend clustering and ensemble tree of this application on the test sets of 71 stations in different seasons;
[0088] Figure 5 This is a comparison chart of the RMSE values of the combined prediction model and other models in the embodiment of the PM2.5 hourly concentration combined prediction method and system based on trend clustering and ensemble tree of this application on the test sets of 71 stations in different seasons at the T2 moment;
[0089] Figure 6 This is a comparison chart of the RMSE values of the combined prediction model and other models in the embodiment of the PM2.5 hourly concentration combined prediction method and system based on trend clustering and ensemble tree of this application at the T3 moment on the test sets of 71 stations in different seasons;
[0090] Figure 7 This is a graph of the prediction results of the combined prediction model at time T1 on the Shunyi New Town site test set in different seasons in the PM2.5 hourly concentration combined prediction method and system embodiment based on trend clustering and ensemble tree of this application;
[0091] Figure 8This is a graph of the prediction results of the combined prediction model at time T2 on the Shunyi New Town site test set in different seasons in the PM2.5 hourly concentration combined prediction method and system embodiment based on trend clustering and ensemble tree of this application;
[0092] Fig. 9 This is a graph of the T3 prediction results of the combined prediction model in the PM2.5 hourly concentration combined prediction method and system embodiment based on trend clustering and integrated tree in the present application on the test sets of different seasons at the Shunyi New Town station. DETAILED DESCRIPTION
[0093] The following is further described in detail through specific implementation methods:
[0094] Embodiment 1
[0095] like Figure 1 As shown, the PM2.5 hourly concentration combined prediction method based on trend clustering and integrated tree of this embodiment includes a trend clustering step, a combined prediction model construction step and a prediction step.
[0096] In the trend clustering step, the PM2.5 mean sequence is divided into different clustering periods according to trend similarity based on the historical PM2.5 mean sequence; in the combined prediction model construction step, according to the clustering results of the trend clustering step, a variety of different types of multi-step prediction models are established for each clustering period, and a combined prediction model is constructed based on the multi-step prediction models in each clustering period; in the prediction step, the multi-step prediction results of PM2.5 hourly concentration are output according to the combined prediction model.
[0097] Specifically, in the solution of this embodiment, the trend clustering step specifically includes:
[0098] S100: Obtaining a PM2.5 mean sequence based on the historical data of PM2.5 over a long period of time; S100 specifically includes: obtaining the historical data of PM2.5, calculating the mean concentration of PM2.5 over 24 hours in a day, and constructing a 24-hour mean concentration sequence of PM2.5
[0099] S200: Divide the mean sequence into multiple subsequences of different time periods according to the prediction step length; S200 specifically includes: Divide into 24 subsequences of length T, and get the subsequence set Where T is the prediction step size, which is the number of PM2.5 at an unknown time that the multi-step prediction model can predict.
[0100] S300: Based on the K-means method, the subsequences of different time periods are divided into different clustering time periods according to trend similarity.
[0101] The S300 specifically includes:
[0102] S301: Select multiple different k values, execute S302 to S305 for each k value to obtain a clustering result for each k value, and then execute S306;
[0103] S302: randomly selecting k subsequences from the subsequence set as initial clustering centers;
[0104] S303: Calculate the Pearson distance between each subsequence and the cluster center, and divide the subsequence into the cluster with the closest distance;
[0105] The Pearson distance is: d p =1-r, where r represents the Pearson correlation coefficient;
[0106] S304: Calculate the cluster center of each class again;
[0107] S305: When the cluster center cannot be adjusted, the iteration is terminated; otherwise, steps S303 and S304 are repeated;
[0108] S306: using the average intra-class distance, the average inter-class distance and the IG index as clustering evaluation indicators, and selecting the optimal k value;
[0109] The calculation formula for the average intra-class distance is:
[0110]
[0111] in, I i represents the i-th cluster u i The average distance between a subsequence in a class and other subsequences in the class, L i Represents class u i The number of subsequences contained in Representative class u i The lth and cth subsequences in represent and Pearson distance;
[0112] The calculation formula for the average inter-class distance is:
[0113]
[0114] in, is the cluster u i With cluster u j The average distance in
[0115] The calculation formula of the IG indicator is:
[0116]
[0117] The smaller the average intra-class distance, the smaller the internal differences of each class in the clustering result, and the larger the average inter-class distance, the greater the difference between classes in the clustering result. When the intra-class distance is small and the inter-class distance is large, the IG value is close to 1, and the clustering effect is good; when the intra-class distance is large and the inter-class distance is small, the IG value is close to -1, and the clustering effect is poor.
[0118] The steps of building the combined prediction model include:
[0119] S400: Based on the trend clustering results, PM2.5 spatiotemporal characteristics, air pollutants, and meteorological data are used as prediction features to construct a sample set for the PM2.5 subsequences in each clustering period; the structure of the sample set is n is the number of samples, x i is the PM2.5 prediction feature, y i For PM2.5 sequences, the sample set is divided into training set, validation set and test set;
[0120] S500: Based on the sample set, multiple different types of multi-step prediction models are established for the PM2.5 subsequences in each clustering period;
[0121] S600: Compare the prediction accuracies of different types of multi-step prediction models in different clustering periods, and select the model with the highest prediction accuracy in each clustering period to form a combined prediction model.
[0122] In this embodiment, in S500, the types of multi-step prediction models include four models: RFR model, GBRT model, Xgboost model and LightGBM model.
[0123] S500 includes:
[0124] S501: RFR model construction steps;
[0125] S502: GBRT model construction step;
[0126] S503: Xgboost model construction step;
[0127] S504: LightGBM model construction step.
[0128] The steps of building the RFR model include:
[0129] S5011: Input training set data (X train ,Y train );
[0130] S5012: Set the resampling ratio, use the Bootstrap method to resample from the training set, generate a training sample subset, randomly extract m features from the prediction features of the training sample subset, and construct a least squares regression tree;
[0131] S5013: Repeat step S5012 to build M regression trees and obtain a random forest regression model;
[0132] S5014: Averaging the prediction values of the M regression trees to obtain the final prediction result.
[0133] The GBRT model construction steps include:
[0134] S5021: Input training set data (X train ,Y train );
[0135] S5022: Initialize GBRT model:
[0136]
[0137] S5023: Iteratively generate M regression trees. The following three steps are performed for each of the M regression trees, where m represents the mth regression tree:
[0138] I: For all n training samples, calculate the negative gradient of the loss function of the m-1th regression tree according to the following formula and use it as the estimated value of the residual r im , where i represents the i-th sample:
[0139]
[0140] II: Based on the calculated residual r im Fit the mth regression tree g m (x), and calculate the step size of the gradient descent:
[0141]
[0142] III: Update GBRT model:
[0143] f m (x) = f m-1 (x)+lr*ρ m g m (x)
[0144] Among them, lr represents the learning rate, which is used to control the impact of a single regression tree model on the overall GBRT model;
[0145] S5024: Get the overall GBRT model:
[0146]
[0147] The Xgboost model building steps include:
[0148] S5031: Input training set data (X train ,Y train );
[0149] S5032: Iteratively generate the Xgboost model. Referring to the construction process of GBRT, iteratively generate M regression trees. During the iteration process, the loss function is defined as follows:
[0150]
[0151] By performing a second-order Taylor expansion of the objective function, we can obtain:
[0152]
[0153] In the formula, g i and h i are the first-order and second-order coefficients of Taylor expansion, is the predicted value of the i-th sample, y i is the true value, f m represents the mth regression tree, Ω(f m ) is a regularization term used to prevent overfitting:
[0154]
[0155] Among them, T and ω are the number of leaf nodes and leaf weight values, respectively, and γ and λ are the weight penalty coefficients of the number of leaf nodes and leaf weight values, respectively;
[0156] S5033: Taking the objective function value as the residual value, the residual value of the previous regression tree is continuously fitted through an iterative method, and finally all regression trees are added together to obtain the overall Xgboost model.
[0157] The LightGBM model construction steps include:
[0158] S5041: Input training set data (X train ,Y train );
[0159] S5042: Iteratively generate M regression trees. The following four steps are performed for each of the M regression trees, where m represents the mth tree:
[0160] I: For the i-th sample of all n training samples, calculate the negative gradient value of the loss function of the m-1-th regression tree model, and update the regression tree according to the gradient descent direction and step size;
[0161] II: Construct a histogram of the feature values of the training samples, calculate the gain of each segmentation point, and find the optimal segmentation point;
[0162] III: Use Leaf_wise tree growth strategy with depth limit to limit the number of leaves in the tree;
[0163] IV: Update training results:
[0164]
[0165] S5043: Get the LightGBM overall model: add all regression trees together to get the final LightGBM model.
[0166] The PM2.5 hourly concentration combined prediction system based on trend clustering and integrated tree of this embodiment uses the PM2.5 hourly concentration combined prediction method based on trend clustering and integrated tree of this embodiment.
[0167] In this embodiment, taking 71 air monitoring stations in the Beijing-Tianjin-Hebei urban agglomeration from 2016 to 2018 as an example, the prediction method of this embodiment is adopted, the prediction step is set equal to 3, and a combined prediction model is used to conduct multi-step prediction experiments on various stations in the Beijing-Tianjin-Hebei region, and compared with single-item integrated tree multi-step prediction models such as GBRT, Xgboost, LightGBM and RFR.
[0168] 1) PM2.5 concentration subsequence division
[0169] Taking the Beijing-Tianjin-Hebei urban agglomeration as the experimental area, the monitoring data of 71 stations in the Beijing-Tianjin-Hebei urban agglomeration from 2016 to 2018 were collected. The data sources are divided into two categories: ① air quality data; ② meteorological data. The air quality data selected were the air quality data of 71 air monitoring stations in the Beijing-Tianjin-Hebei urban agglomeration from January 1, 2016 to December 31, 2018, and the meteorological data were the meteorological data of the urban areas where the air monitoring stations were located from January 1, 2016 to December 31, 2018. After the data was acquired, it was cleaned and the abnormal data, erroneous data and incomplete data were deleted, corrected or filled.
[0170] The daily 24-hour mean concentration series of PM2.5 obtained based on PM2.5 monitoring data from 71 stations is as follows: Figure 2 As shown in the figure, the change trend of the 24-hour mean concentration series of PM2.5 is in a 'W' shape, with a "downward" trend between 0:00-8:00 and 11:00-17:00, and an "increasing" trend between 8:00-11:00 and 17:00-24:00.
[0171] When the prediction step is 3, the mean sequence can be divided into 24 subsequences of the same length and different time periods. The division results are as follows: Figure 3As shown in the figure, the horizontal axis represents time and the vertical axis represents the average PM2.5 concentration.
[0172] Figure 3 The 24 subsequences in include the time periods of all prediction sequences that can be output by the PM2.5 multi-step prediction model with a prediction step size of 3. Therefore, when the prediction step size is 3, multi-step prediction of PM2.5 is equivalent to predicting the PM2.5 concentration for the time periods of these 24 subsequences. As can be seen from the figure, the PM2.5 subsequences in different time periods have similar change trends.
[0173] 2) K-means trend clustering
[0174] The trend distance between subsequences is measured by Pearson distance, and K-means trend clustering is performed on the PM2.5 subsequences of 24 different time periods. First, the number of clusters k is set to 2, 3, 4, 5, 6, 7, 8; then, the 24 subsequences are clustered by K-means using Pearson distance as the distance metric. The average intra-class distance, average inter-class distance and IG index obtained with different cluster numbers are shown in Table 1. It can be seen that when the number of clusters is 6, the average intra-class distance value is small, which is 0.009, the average inter-class distance value is large, which is 1.14, and the IG index reaches the optimal value of 0.98, so the optimal number of clusters selected in the experiment is 6.
[0175] Table 1 Cluster test coefficient
[0176]
[0177] When the number of clusters is 6, the K-means trend clustering results of PM2.5 subsequences in 24 different time periods are shown in Table 2. Figure 3 Compared with the subsequence change trend of , it can be seen that the overall change trend of the subsequence of cluster period 1 is continuous decline; the change trend of cluster period 2 is first decline and then rise; the change trend of cluster period 3 is continuous rise; the change trend of cluster period 4 is similar to that of cluster period 3, and the overall trend is rising, but compared with the sequence of cluster period 3, the sequence of cluster period 4 has a smaller rise at the 2nd and 3rd moments; the change trend of cluster period 5 is first rise and then decline; the change trend of cluster period 6 is similar to that of cluster period 2, and the overall trend is first decline and then rise, but compared with the sequence of cluster period 2, the sequence of cluster period 6 has a larger decline at the 1st and 2nd moments. In general, when the number of clusters is 6, the K-means method can divide the 24 PM2.5 subsequences into different cluster periods according to the change trend, and the division is more detailed, which shows that the K-means clustering algorithm based on Pearson distance can effectively cluster PM2.5 subsequences, providing a basis for the subsequent establishment of a combined prediction model.
[0178] Table 2 Clustering results when the number of clusters is 6
[0179]
[0180] 3) Establishment of prediction model for each clustering period
[0181] According to the trend clustering results, this embodiment uses the spatiotemporal characteristics of PM2.5 (annual, monthly, seasonal, etc.), air pollutants (air pollutants at the current site and nearby sites), and meteorological data (air humidity, temperature, rainfall, wind speed, wind direction, etc.) as prediction features, and establishes multi-step prediction models such as GBRT, Xgboost, LightGBM and RFR for the PM2.5 subsequences of each time period.
[0182] First, construct the overall sample set. In this embodiment, the input prediction features of the multi-step prediction model are the impact features of PM2.5 at the 6 closest moments to the target moment and 24 hours from the target moment. Each impact feature includes 96 feature variables such as air pollutant variables, meteorological variables, time feature variables and spatial feature variables, with a total of 96×7=672-dimensional features. The output value is the PM2.5 hourly concentration value at the unknown T moments, and T is the prediction step. Therefore, the structure of the sample can be (X, Y), X contains 672-dimensional variables, and Y contains T PM2.5 hourly concentration values. A total of more than 1.86 million samples were extracted from the monitoring data of 71 stations in the Beijing-Tianjin-Hebei urban agglomeration from 2016 to 2018.
[0183] Then, a sample set for each clustering period is constructed, and each sample set is divided into a training set, a test set, and a validation set. According to the clustering results of the time periods of categories 1-6 in Table 2, the overall sample set can be divided into sub-sample sets of 6 clustering periods according to the clustering period to which Y in the sample belongs. For the sample set of each clustering period, the experiment divides the training set and the test set by season, and selects The samples in the last 15 days of the four quarters of 2018 (Spring: 2018 / 5 / 17-2018 / 5 / 31, Summer: 2018 / 8 / 17-2018 / 8 / 31, Autumn: 2018 / 11 / 16-2018 / 11 / 30, Winter: 2018 / 2 / 14-2018 / 25 / 28) are the test set, and the rest are the training set. 2% of the samples are extracted from the training set as the validation set.
[0184] Finally, the training set of each clustering period is used to train multi-step prediction models such as RFR, GBRT, Xgboost, and LightGBM, and the test set of each clustering period is used to test the prediction effect of each model.
[0185] The choice of parameters has a great impact on the prediction results of the model. From the construction process of RFR, GBRT, Xgboost and LightGBM models, it can be seen that the prediction accuracy of the RFR model is mainly affected by the number of decision subtrees (M), the maximum number of features in the feature subset (max_features), and the minimum number of samples required for leaf node re-division (min_samples_split). The prediction accuracy of the GBRT model is mainly affected by the number of iterations / number of decision subtrees (M), learning efficiency (lr), sample sampling ratio (subsample) and the minimum number of samples required for leaf node re-division (min_samples_leaf). The prediction accuracy of the Xgboost model is mainly affected by the number of iterations (number of decision subtrees M), learning rate (lr), L1 regularization term (γ), L2 regularization term (λ) and the minimum loss function drop value (gamma) required for leaf node splitting. The prediction accuracy of the LightGBM model is mainly affected by parameters such as the number of iterations (the number of decision subtrees M), the learning rate (lr), the number of leaves per tree (num_leaves), the maximum number of histograms (max_bin), and the sample sampling ratio (subsample). Therefore, when establishing the RFR, GBRT, Xgboost, and LightGBM multi-step prediction models, this embodiment uses the grid search method to train the multi-step prediction model, and optimizes the model hyperparameters in combination with the accuracy of the validation set.
[0186] In addition, considering the large sample size of the experiment, too many iterations will lead to too long training time, so the number of decision subtrees of the prediction model is set to 50. The main parameter values of each model after tuning are shown in Table 3. Except for the parameters listed in the table, the other parameters use the default values.
[0187] Table 3 Tuning results of hyperparameters of multi-step prediction model
[0188]
[0189] 4) Experimental results and analysis
[0190] Analysis of prediction results for each clustering period:
[0191] Taking the root mean square error RMSE as the evaluation index, the test results of multi-step prediction models such as RFR, GBRT, Xgboost, and LightGBM in each clustering period are shown in Table 4.
[0192] Table 4 Prediction accuracy of each model at different clustering time periods
[0193]
[0194] In the table, T1-RMSE, T2-RMSE, and T3-RMSE respectively represent the RMSE values of the model at the first, second, and third prediction moments. The smaller the value, the higher the prediction accuracy. As can be seen from the table, (1) from the perspective of time, as the prediction time increases, the RMSE value of the model gradually increases and the accuracy decreases. This is because there are many interference factors for PM2.5, and the uncertainty will continue to increase with the extension of the prediction time; (2) from the perspective of the model, the prediction accuracy of the GBRT, Xgboost, and LightGBM models using the Boosting integration framework is higher than that of the RFR model using the Bagging integration framework; (3) from the perspective of time periods, the LightGBM model has the best prediction effect in the 1, 2, 5, and 6 clustering periods, and the GBRT model has the best prediction effect in the 3 and 4 clustering periods.
[0195] The combined prediction model selects the integrated tree prediction model with the highest prediction accuracy in each clustering time period as the basic model of the combined prediction model. Therefore, in this embodiment, the LightGBM multi-step prediction model is used to predict the subsequences of 1, 2, 5, and 6 clustering time periods, and the GBRT model is used to predict the subsequences of 3 and 4 clustering time periods. In this way, a combined prediction model is constructed to predict the multi-step PM2.5 hourly concentrations in different time periods.
[0196] Comparative analysis of the combined prediction model and the single-item ensemble tree prediction model:
[0197] The prediction results of the combined prediction model and single ensemble tree models such as GBRT, Xgboost, LightGBM, and RFR models on all test sets of 71 stations in the Beijing-Tianjin-Hebei urban agglomeration are shown in Table 5. It can be seen that (1) at the T1 prediction time, the RMSE, MAE, and IA of the combined model are better than those of other models; at the T2 prediction time, the RMSE of the combined model is better than that of other models; at the T3 prediction time, the RMSE and MAE of the combined model are better than those of other models, indicating that the combined prediction model combined with trend clustering is better than the single ensemble tree model without trend division to a certain extent; (2) with the increase of the prediction time, the accuracy of the combined model gradually decreases, but the RMSE values of the combined model at the T1, T2, and T3 prediction times are all less than 30, the MAE values are all less than 15, and the IA values are all greater than 0.95, indicating that the combined prediction model has the advantages of low error and high accuracy, and is suitable for predicting multi-step PM2.5 hourly concentrations.
[0198] Table 5 Comparison of prediction results of each model
[0199]
[0200] Figure 4The RMSE values of the combined prediction model, SSAE-LSTM, GBRT, Xgboost, LightGBM, and RFR models at T1 on the four seasons test sets of 71 stations in Beijing, Tianjin and Hebei are listed. It can be seen that: 1) the prediction accuracy of the combined prediction model and the SSAE-LSTM prediction model on most stations is better than that of the single ensemble tree prediction model; 2) on the autumn and winter test sets, the prediction accuracy of SSAE-LSTM on some stations is better than that of the combined prediction model.
[0201] Figure 5 , Figure 6 The RMSE values of the combined prediction model, GBRT, Xgboost, LightGBM, and RFR models at T2 and T3 on the spring, summer, autumn, and winter test sets of 71 stations in Beijing, Tianjin, and Hebei are listed. It can be seen that the RMSE value of the combined prediction model at most stations is lower than that of other comparison models, indicating that the prediction accuracy of the combined prediction model in PM2.5 multi-step prediction is higher than that of the single ensemble tree multi-step prediction model, and it has a stronger generalization ability.
[0202] Applicability analysis of combined forecasting models in different seasons:
[0203] Taking Beijing Shunyi New Town Station (1008A) as an example, the applicability of the combined prediction model in different seasons is verified. Figure 7 The following are the prediction results of the combined prediction model and SSAE-LSTM at time T1 in different seasons. It can be seen that the predicted values of the SSAE-LSTM model and the combined prediction model are relatively close to the true value curve, but compared with the combined prediction model, the predicted value of SSAE-LSTM at the position of "PM2.5 concentration peak" is more consistent with the true value, indicating that in single-step prediction, the prediction performance of the SSAE-LSTM model is better than that of the combined prediction model.
[0204] Figure 8 , Fig. 9 The figures are the prediction results of the combined prediction model at T2 and T3 in different seasons. It can be seen that although the fit between the predicted value curve and the true value curve gradually decreases with the increase of the prediction time step, in general, the overall prediction effect of the combined prediction model is good, and it can accurately identify the PM2.5 peak and valley values in different seasons, indicating that the combined prediction model can adapt to the multi-step prediction needs of PM2.5 hourly concentration in different seasons.
[0205] In the technical solution of this embodiment, a direct multi-step prediction strategy is adopted to combine PM2.5 time series trend clustering with the integrated tree prediction model to form a combined prediction model. First, the model uses the K-means clustering algorithm to divide the subsequences of PM2.5 in different time periods within 24 hours of a day into different clustering time periods according to trend similarity; then, integrated tree prediction models such as RFR, GBRT, Xgboost and LightGBM are constructed for the PM2.5 subsequences of each time period; finally, the model with the highest prediction accuracy in each cluster is selected to construct a combined prediction model to predict the PM2.5 hourly concentration in multiple steps. This embodiment uses 71 air monitoring points in the Beijing-Tianjin-Hebei urban agglomeration from 2016 to 2018 as an example to conduct a multi-step prediction experiment, and compares it with single integrated tree multi-step prediction models such as GBRT, Xgboost, LightGBM and RFR. The results show that the combined prediction model proposed in this patent has the advantages of low error and high accuracy, which is superior to the single ensemble tree prediction model to a certain extent. The combined prediction model can adapt to the multi-step prediction needs of PM2.5 hourly concentration in different stations and seasons, and has strong generalization ability.
[0206] The above are only embodiments of the present invention. The invention is not limited to the fields involved in this implementation case. The common sense such as the known specific structures and characteristics in the scheme is not described in detail here. The ordinary technicians in the relevant field know all the common technical knowledge in the technical field to which the invention belongs before the application date or the priority date, can obtain all the existing technologies in the field, and have the ability to apply the conventional experimental means before that date. The ordinary technicians in the relevant field can improve and implement this scheme in combination with their own abilities under the enlightenment given by this application. Some typical known structures or known methods should not become obstacles for ordinary technicians in the relevant field to implement this application. It should be pointed out that for those skilled in the art, without departing from the structure of the present invention, several deformations and improvements can be made, which should also be regarded as the protection scope of the present invention, which will not affect the effect of the implementation of the present invention and the practicality of the patent. The protection scope required by this application shall be based on the content of its claims, and the specific implementation methods and other records in the specification can be used to explain the content of the claims.
Claims
1. A combined prediction method for PM2.5 hourly concentration based on trend clustering and ensemble tree, characterized by: Includes the following: Trend clustering step: Based on the PM2.5 mean sequence and prediction step, the PM2.5 mean sequence is divided into different clustering periods according to trend similarity; Combined prediction model construction step: According to the clustering results of the trend clustering step, a variety of different types of multi-step prediction models are established for each clustering period, and the multi-step prediction model with the highest prediction accuracy in each clustering period is selected to construct a combined prediction model; Prediction step: Output the multi-step prediction results of PM2.5 hourly concentration based on the combined prediction model; The trend clustering step specifically includes: S100: Get the PM2.5 mean value series based on the historical data of long-term PM2.5 series; S200: Divide the mean sequence into multiple subsequences of different time periods according to the prediction step length; S300: Based on the K-means method, the subsequences of different time periods are divided into different clustering time periods according to trend similarity.
2. The PM2.5 hourly concentration combined prediction method based on trend clustering and integrated tree according to claim 1 is characterized in that: The S100 specifically includes: obtaining historical data of PM2.5, calculating the average concentration of PM2.5 within 24 hours in a day, and constructing a 24-hour average concentration sequence of PM2.
5. ; S200 specifically includes: converting the PM2.5 mean sequence Divide into 24 subsequences of length T, and get the subsequence set , where T is the prediction step length, which is the number of PM2.5 at unknown time that can be predicted by the multi-step prediction model.
3. The PM2.5 hourly concentration combined prediction method based on trend clustering and integrated tree according to claim 2 is characterized in that: The S300 specifically includes: S301: Select multiple different k values, execute S302 to S305 for each k value to obtain a clustering result for each k value, and then execute S306; S302: randomly selecting k subsequences from the subsequence set as initial clustering centers; S303: Calculate the Pearson distance between each subsequence and the cluster center, and divide the subsequence into the cluster with the closest distance; The Pearson distance is: , where r represents the Pearson correlation coefficient; S304: Calculate the cluster center of each class again; S305: When the cluster center cannot be adjusted, the iteration is terminated; otherwise, steps S303 and S304 are repeated; S306: using the average intra-class distance, the average inter-class distance and the IG index as clustering evaluation indicators, and selecting the optimal k value; The calculation formula for the average intra-class distance is: in, , Represents the i-th cluster The average distance between a subsequence in a class and other subsequences in the class, Representation Class The number of subsequences contained in , Representative Class The lth and cth subsequences in represent and Pearson distance; The calculation formula for the average inter-class distance is: in, , for clustering With clustering The average distance in The calculation formula of the IG indicator is: 。 4. The PM2.5 hourly concentration combined prediction method based on trend clustering and integrated tree according to claim 3 is characterized in that: The steps of building the combined prediction model include: S400: Based on the trend clustering results, PM2.5 spatiotemporal characteristics, air pollutants, and meteorological data are used as prediction features to construct a sample set for the PM2.5 subsequences in each clustering period; the structure of the sample set is , n is the number of samples, is the PM2.5 prediction feature, For the PM2.5 monitoring value sequence, the sample set is divided into training set, validation set and test set; S500: Based on the sample set, multiple different types of multi-step prediction models are established for the PM2.5 subsequences in each clustering period; S600: Compare the prediction accuracies of different types of multi-step prediction models in different clustering periods, and select the model with the highest prediction accuracy in each clustering period to form a combined prediction model.
5. The PM2.5 hourly concentration combined prediction method based on trend clustering and integrated tree according to claim 4 is characterized in that: In S500, the type of multi-step prediction model includes an RFR model. S500 includes: S501: RFR model construction steps; The steps of building the RFR model include: S5011: Input training set data (Xtrain, Ytrain); S5012: Set the resampling ratio, use the Bootstrap method to resample from the training set, generate a training sample subset, randomly extract m features from the prediction features of the training sample subset, and construct a least squares regression tree; S5013: Repeat step S5012 to build M regression trees and obtain a random forest regression model; S5014: Averaging the prediction values of the M regression trees to obtain the final prediction result.
6. The PM2.5 hourly concentration combined prediction method based on trend clustering and ensemble tree according to claim 5 is characterized in that: In S500, the type of multi-step prediction model includes a GBRT model. S500 includes: S502: GBRT model construction step; The GBRT model construction steps include: S5021: Input training set data (Xtrain, Ytrain); S5022: Initialize GBRT model: S5023: Iteratively generate M regression trees. The following three steps are performed for each of the M regression trees, where m represents the mth regression tree: I: For all n training samples, calculate the negative gradient of the loss function of the m-1th regression tree according to the following formula and use it as the estimated value of the residual , where i represents the i-th sample: II: Based on the calculated residual Fit the mth regression tree , and calculate the step size of the gradient descent: III: Update GBRT model: Among them, lr represents the learning rate, which is used to control the impact of a single regression tree model on the overall GBRT model; S5024: Get the overall GBRT model: 。 7. The PM2.5 hourly concentration combined prediction method based on trend clustering and ensemble tree according to claim 6 is characterized in that: In S500, the types of multi-step prediction models include Xgboost models. S500 includes: S503: Xgboost model construction step; The Xgboost model building steps include: S5031: Input training set data (Xtrain, Ytrain); S5032: Iteratively generate an Xgboost model and iteratively generate M regression trees. During the iteration process, the loss function is defined as follows: By performing a second-order Taylor expansion of the objective function, we can obtain: In the formula, and are the first-order and second-order coefficients of Taylor expansion, is the predicted value of the i-th sample, is the true value, represents the mth regression tree, is a regularization term used to prevent overfitting: Among them, T and are the number of leaf nodes and leaf weight values respectively, , are the weight penalty coefficients for the number of leaf nodes and leaf weight values respectively; S5033: Taking the objective function value as the residual value, the residual value of the previous regression tree is continuously fitted through an iterative method, and finally all regression trees are added together to obtain the overall Xgboost model.
8. The PM2.5 hourly concentration combined prediction method based on trend clustering and ensemble tree according to claim 7 is characterized in that: In S500, the types of multi-step prediction models include LightGBM models. S500 includes: S504: LightGBM model construction steps; The LightGBM model construction steps include: S5041: Input training set data (Xtrain, Ytrain); S5042: Iteratively generate M regression trees. The following four steps are performed for each of the M regression trees, where m represents the mth tree: I: For the i-th sample of all n training samples, calculate the negative gradient value of the loss function of the m-1-th regression tree model, and update the regression tree according to the gradient descent direction and step size; II: Construct a histogram of the feature values of the training samples, calculate the gain of each segmentation point, and find the optimal segmentation point; III: Use Leaf_wise tree growth strategy with depth limit to limit the number of leaves in the tree; IV: Update training results: S5043: Get the LightGBM overall model: add all regression trees together to get the final LightGBM model.
9. A PM2.5 hourly concentration combined prediction system based on trend clustering and ensemble tree, characterized by: A combined prediction method for hourly PM2.5 concentration based on trend clustering and integrated tree as described in any one of claims 1 to 8 is used.
