A PM2.5 prediction method and system based on spatiotemporal characteristics
Through the combination of multi-scale decomposition and graph attention neural network, the problem of uncertainty and spatial relationship underutilization in hourly level prediction is solved, and a higher precision PM2.5 concentration prediction is achieved.
Patent Information
- Application Number
- CN202510519360.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-24
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2045-04-24
AI Technical Summary
The existing PM2.5 prediction model is affected by a variety of factors during hourly prediction, resulting in uncertainty in prediction results and degradation in performance, which cannot fully reflect the changing trend of PM2.5 concentration, and does not fully consider the data of nearby sites and the essential relationship between the predicted sites.
The prediction method based on spatiotemporal features is adopted, through multi-scale decomposition, feature enhancement mapping and linear prediction, combined with the graph attention neural network, pay attention to the spatial relationship between data between different monitoring sites, improve spatial feature expression capabilities, and dynamically fuse time and spatial prediction results through the gated network.
The prediction accuracy of PM2.5 at the hour level is significantly improved, the robustness and adaptability of the model are enhanced, and the changes in PM2.5 concentration can be captured more accurately.
Smart Images

Figure CN120030339B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of atmospheric pollutant prediction, and in particular to a PM2.5 prediction method and system based on spatiotemporal characteristics. Background Art
[0002] Existing PM2.5 prediction models are often affected by multiple factors when processing hourly forecasts, including meteorological conditions, geographic location, and temporal variations. This diversity of factors leads to uncertainty in prediction results. Furthermore, information redundancy and loss can also affect model performance, making it impossible to fully reflect the changing trends of PM2.5 concentrations.
[0003] Chinese patent application publication number CN114694767A discloses a PM2.5 concentration prediction method based on a space-time graph ordinary differential equation network. Using a Gaussian diffusion model, the method combines the Euclidean distance and wind direction data of the monitoring stations to construct an adjacency matrix, representing the gas monitoring stations within an industrial park as a graph. After processing the air humidity data, a space-time graph ordinary differential equation network model is constructed. Finally, the PM2.5 concentration data, adjacency matrix, and air humidity data are input into the model for training. This patent only incorporates wind direction data.
[0004] Chinese patent application publication number CN114662791A discloses a long-term PM2.5 prediction method and system based on spatiotemporal attention. The method first inputs processed data into a feature extraction network for feature extraction. Features extracted from different sites are then concatenated and fused using a spatial attention network. Past features are then acquired through a multi-layer bidirectional LSTM. Finally, known future feature data for the time period to be predicted is extracted through a neural network and concatenated to yield the final prediction result. While this patent considers the impact of nearby meteorological data on the predicted area during PM2.5 prediction, its method fails to consider the essential relationship between the data from nearby sites and the prediction site. Summary of the Invention
[0005] The present invention aims to address the above-mentioned issues. To this end, it provides a PM2.5 prediction method and system based on spatiotemporal features. Through multi-scale decomposition, feature enhancement mapping, and linear prediction, it effectively extracts trend and seasonal components, thereby capturing the changing patterns of PM2.5 concentration. It also introduces a graph attention neural network to focus on the spatial relationships between data from different monitoring sites, improving the ability to express spatial features. Finally, a gating network integrates temporal and spatial prediction results, significantly improving the accuracy of PM2.5 hourly prediction tasks.
[0006] The present invention provides a PM2.5 prediction method based on spatiotemporal characteristics, which adopts the following technical solutions:
[0007] Obtain atmospheric pollutant data and meteorological data for the target site and surrounding sites;
[0008] The atmospheric pollutant data and meteorological data of the surrounding stations are processed using principal component analysis and geographic distance weighting, and then spliced with the atmospheric pollutant data and meteorological data of the target station to obtain the data to be analyzed;
[0009] Normalize the data to be analyzed to obtain normalized time series data;
[0010] The normalized time series data is decomposed into trend features and seasonal features, and subjected to feature enhancement mapping and linear prediction respectively to obtain trend component prediction results and seasonal component prediction results, which are added together to obtain the time prediction result;
[0011] Based on the normalized time series data, the mutual information method is used to construct the graph structure of the PM2.5 sequence, and the spatial prediction results are obtained through the graph attention neural network;
[0012] The temporal prediction results and spatial prediction results are dynamically fused through the gating network, and after denormalization, the predicted value of PM2.5 concentration at the target site is obtained.
[0013] Furthermore, atmospheric pollutant data include fine particulate matter, inhalable particulate matter, sulfur dioxide, nitrogen dioxide, carbon monoxide and ozone, and meteorological data include temperature, air pressure, dew point temperature, wind direction and wind speed.
[0014] Furthermore, in the principal component analysis, the principal component with the largest variance was selected;
[0015] The calculation process of geographic distance weighting is:
[0016] Calculate the geographical distance between the target site and each surrounding site;
[0017] Calculate weights based on geographic distance;
[0018] The principal component analysis results of each surrounding station are weighted and summed according to their weights to obtain the pollutant and meteorological data of the surrounding stations after dimensionality reduction.
[0019] Furthermore, the normalization process is as follows:
[0020] Calculate the mean and standard deviation of the data to be analyzed;
[0021] Use the mean and standard deviation to normalize the data to be analyzed to obtain normalized data;
[0022] Add noise to the normalized data;
[0023] The normalized data with added noise is scaled and translated to obtain the normalized time series data.
[0024] Furthermore, the standard deviation of the noise is dynamically adjusted. The calculation formula for the noise standard deviation is:
[0025]
[0026] in, represents the noise standard deviation, represents the value of the loss function, It means to find the maximum value, Indicates finding the minimum value.
[0027] Furthermore, the process of decomposing the normalized time series data into trend characteristics and seasonal characteristics is as follows:
[0028] The normalized time series data were smoothed using multiple moving average kernels of different scales. The moving average of each kernel was calculated and the mean of the multiple moving averages was used as the trend feature. The normalized time series data and trend features were differentiated to obtain seasonal features. The kernel sizes were 17, 25, 33, 49, 65, and 73, respectively.
[0029] Furthermore, the calculation formula of the feature enhancement map is:
[0030]
[0031] in, represents the output tensor, represents the input tensor, represents the weight matrix, represents the bias matrix, represents the batch size, represents the time step, represents the input channel dimension, Indicates the number of output features mapped to each input channel, and c represents the cth dimension.
[0032] Furthermore, the prediction process of the spatial prediction result is:
[0033] Based on the normalized time series data, the mutual information method is used to construct the graph structure of the PM2.5 series;
[0034] Use symmetric normalization to process the adjacency matrix of the graph structure to obtain a symmetric normalized adjacency matrix;
[0035] The node feature matrix of the graph structure and the symmetrically normalized adjacency matrix are input into the graph attention neural network to obtain the spatial prediction results.
[0036] Furthermore, during the prediction process of the graph attention neural network, the node feature matrix is processed using sine and cosine position encoding.
[0037] The present invention also provides a PM2.5 prediction system based on spatiotemporal features, which adopts the following technical solution: comprising: a data acquisition module, a data processing module, a feature normalizer, a time prediction module, a space prediction module and a gated prediction module,
[0038] Data acquisition module, used to obtain atmospheric pollutant data and meteorological data of the target site and surrounding sites;
[0039] The data processing module is used to process the atmospheric pollutant data and meteorological data of the surrounding stations using principal component analysis and geographic distance weighting, and then splice them with the atmospheric pollutant data and meteorological data of the target station to obtain the data to be analyzed;
[0040] Feature normalizer, used to normalize the data to be analyzed to obtain normalized time series data;
[0041] The time prediction module is used to decompose the normalized time series data into trend features and seasonal features. After feature enhancement mapping and linear prediction, the trend component prediction results and seasonal component prediction results are obtained respectively, and the time prediction results are obtained by adding them together.
[0042] The spatial prediction module is used to construct the graph structure of the PM2.5 sequence based on the normalized time series data using the mutual information method, and predict the spatial prediction results through the graph attention neural network;
[0043] The gated prediction module is used to dynamically fuse the temporal prediction results and the spatial prediction results through the gated network, and obtain the predicted value of the PM2.5 concentration at the target site after denormalization.
[0044] The above one or more technical solutions in the embodiments of the present invention have at least one of the following technical effects:
[0045] 1. This paper proposes a data fusion method based on principal component analysis (PCA) and geographic distance weighting to improve the prediction accuracy of PM2.5 concentration. First, pollutant and meteorological data from multiple surrounding stations are synchronously collated and projected onto the direction of maximum variance using PCA, effectively reducing data dimensionality and preserving key information. Next, the latitude and longitude distances between each surrounding station and the target station are calculated and used as weighting factors, with closer stations given higher weights and farther stations given lower weights. In this way, the influence of surrounding stations is adaptively adjusted based on their spatial location. Finally, the weighted PCA results are fused with the target station data and compressed to one-dimensional data through scaling to ensure data consistency and comparability. This method fully utilizes the spatial information of surrounding stations, enhances the spatiotemporal prediction capabilities of the target station, and improves the accuracy and robustness of PM2.5 concentration predictions.
[0046] 2. This paper designs a trend-seasonality decomposer that performs a multi-dimensional decomposition on the input normalized time series data, extracting long-term trends and seasonal variations layer by layer to adapt to feature variations across different time dimensions. This process utilizes six convolution kernels of different sizes (17, 25, 33, 49, 65, and 73) to flexibly address data diversity. This not only effectively removes noise and retains valuable information, but also enables the model to accurately predict PM2.5 data trends across different dimensions.
[0047] 3. This invention performs feature-enhanced mapping on trend and seasonal features, mapping them to more dimensions. Then, by integrating the individual components, a comprehensive feature representation is obtained. Feature mapping integration can better capture complex nonlinear relationships and improve prediction accuracy.
[0048] 4. The present invention combines position encoding, graph attention neural network and pollutant data from multiple nearby surrounding areas to more accurately capture the mutual influence relationship between the characteristics affecting PM2.5 concentration in the region, thereby improving the accuracy of spatial prediction.
[0049] Additional aspects and advantages of the present invention will be set forth in part in the description which follows and, in part, will be obvious from the description which follows, or may be learned by practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0051] Figure 1 It is a flow chart of the method provided by the present invention.
[0052] Figure 2 This is a comparison result diagram of the predicted value and the true value provided by the present invention. DETAILED DESCRIPTION
[0053] To make the purpose, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below in conjunction with the accompanying drawings of the present invention. Obviously, the embodiments described are part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention. The following embodiments are used to illustrate the present invention, but are not used to limit the scope of the present invention.
[0054] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the embodiment of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures or characteristics described can be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art can combine and combine different embodiments or examples described in this specification and features of different embodiments or examples without contradiction.
[0055] The following combination Figures 1 to 2 The present invention is further described in detail, and a PM2.5 prediction method and system based on spatiotemporal characteristics of the present invention are described:
[0056] In this embodiment, Figure 1 As shown, a PM2.5 prediction method based on spatiotemporal characteristics is provided, comprising the following steps:
[0057] Step 1: Obtain air pollutant data and meteorological data for the target site and surrounding sites.
[0058] In this embodiment, the atmospheric pollutant data includes fine particulate matter, inhalable particulate matter, sulfur dioxide, nitrogen dioxide, carbon monoxide, and ozone, and the meteorological data includes temperature, air pressure, dew point temperature, wind direction, and wind speed. In this embodiment, seven surrounding stations around the target station are selected.
[0059] The atmospheric pollutant and meteorological data of the target site and the seven surrounding sites are all in the same time period, which ensures the temporal consistency of the data.
[0060] Step 2: Use principal component analysis and geographic distance weighting to process the atmospheric pollutant data and meteorological data of surrounding stations, and then splice them with the atmospheric pollutant data and meteorological data of the target station to obtain the data to be analyzed.
[0061] Step 2.1: Principal component analysis (PCA) is used to reduce dimensionality and extract key features. The goal is to reduce redundant information and project the data toward the direction of maximum variance. This approach preserves the most useful variation between sites, making the data representation more concise while reducing the computational complexity of the model. A PCA is performed on the atmospheric pollutant and meteorological data for each surrounding site. The principal component to be retained is selected, with the one with the largest variance, to preserve the most critical features of the data. The PCA results for each surrounding site are obtained.
[0062] Step 2.2: The calculation process of geographical distance weighting is:
[0063] Calculate the geographical distance between the target site and each surrounding site. In this embodiment, the spherical distance between the target site and the surrounding sites is calculated using longitude and latitude.
[0064] Geographic distance is used as a weighting factor and the weight is calculated based on the geographic distance. This embodiment adopts an inverse weighting strategy, that is, the closer the distance, the greater the weight. The weight calculation formula is:
[0065]
[0066] in, It is The weight of surrounding sites, It is The geographical distance between the surrounding sites and the target site, is the weight decay coefficient.
[0067] After calculating the weight of each surrounding station, these weights are used to fuse the weighted principal component analysis results. Weighted PCA fusion: The principal component analysis results of each surrounding station are weighted and summed according to their weights to obtain the pollutant and meteorological data of the surrounding stations after dimensionality reduction. , that is, the weighted eigenvector, is calculated as follows:
[0068]
[0069] in, It is The principal component analysis results of the surrounding sites.
[0070] Step 2.3: Final feature fusion: The pollutant and meteorological data of the surrounding sites after dimensionality reduction are merged with the atmospheric pollutant data and meteorological data of the target site using the splicing method to form a new feature vector and obtain the data to be analyzed.
[0071] This example uses multiple variables to predict a single variable to predict hourly PM2.5 concentrations. The data to be analyzed is constructed using the 11-dimensional data of the target site and the reduced-dimensional data of surrounding sites obtained through principal component analysis and geographic distance weighting. This example uses 18-dimensional data to construct the data to predict hourly PM2.5 concentrations at the target site, as shown in Table 1.
[0072] Table 1 Variable table
[0073]
[0074] Step 3: Normalize the data to be analyzed to obtain normalized time series data.
[0075] This method designs a feature normalizer to normalize the data to be analyzed. The feature normalizer is an adaptive normalization layer designed to address the limitations of traditional normalization methods when dealing with varying time dimensions and data distributions in PM2.5 prediction. Traditional normalization methods (such as standardization and denormalization) often have limited effectiveness when dealing with multidimensional and complex data and cannot adapt to the dynamic changes in time series data. The feature normalizer dynamically calculates the mean and standard deviation of the input data to adjust the data to accommodate different time dimensions. This is particularly true for PM2.5 data, where pollutant concentrations are influenced by multiple factors and exhibit significant time dependence. Furthermore, the feature normalizer dynamically adjusts the noise standard deviation during the normalization process to enhance data robustness. This approach not only improves the normalization performance of PM2.5 time series data but also restores the original data distribution during the denormalization process using preserved statistical information and affine parameters, ensuring the accuracy and stability of the model when dealing with complex time series data.
[0076] The process used in the feature normalizer is as follows:
[0077] Step 3.1: Calculate the mean and standard deviation of the data to be analyzed.
[0078] For PM2.5 series data, accurately calculating the mean and standard deviation helps capture the overall trend of the data and reduce the impact of changes in the time dimension. The formulas for the mean and standard deviation are as follows:
[0079]
[0080]
[0081] in, For the data to be analyzed, is the mean of the data to be analyzed, To obtain the mean, is the standard deviation of the data to be analyzed, is a hyperparameter, which is a very small value used to prevent the denominator from being zero. is the i-th parameter of the data to be analyzed.
[0082] Step 3.2: Use the mean and standard deviation to normalize the data to obtain normalized data.
[0083] The goal of the normalization process is to transform the data to be analyzed Convert to data with zero mean and unit variance. Using normalization can reduce the interference of noise and outliers in PM2.5 series data on model training and improve the convergence speed and stability of the model. The normalization process formula is as follows:
[0084]
[0085] in, Represents the normalized data.
[0086] Step 3.3: Add noise to the normalized data.
[0087] Adding noise can prevent the model from overfitting, especially when processing PM2.5 data, and help the model better generalize to unseen data, thereby further enhancing the robustness of the model. The formula for adding noise is as follows:
[0088]
[0089] in, represents the noise standard deviation, Represents Standard normally distributed noise with the same shape, represents the normalized data with noise added.
[0090] During the normalization process, the noise standard deviation is dynamically adjusted according to the value of the loss function to adapt to the changes in PM2.5 data in different time periods, improve the adaptability of the model in different time dimensions, and enhance the robustness of the model. The noise standard deviation is dynamically adjusted. The noise standard deviation calculation formula is:
[0091]
[0092] in, represents the value of the loss function, It means to find the maximum value, Indicates finding the minimum value.
[0093] The loss function refers to the error calculated during model training. Common loss functions include Mean Absolute Error (MAE) and Mean Squared Error (MSE). These two metrics are important in measuring the accuracy and stability of prediction models. In this example, MAE was selected as the loss function.
[0094] The mean absolute error (MAE) measures the average absolute difference between the predicted and actual values. It is the average of the prediction errors and reflects the degree of deviation in the prediction results. A smaller MAE indicates that the model's predictions are closer to the actual values and the errors are smaller. The mean squared error (MSE) measures the average squared difference between the predicted and actual values. It is the average of the sum of the squared prediction errors and reflects the volatility of the prediction results. A smaller MSE indicates that the model's predictions are closer to the actual values and the volatility is smaller. Compared to MAE, MSE is more sensitive to outliers because the errors are amplified by squaring.
[0095] The core idea of dynamically adjusting noise is to control the size of the noise through the value of the loss function. Specifically:
[0096] When the loss is large, it means that the model's prediction effect at the current stage is poor, and the noise standard deviation needs to be increased to prevent the model from being too dependent on certain fixed patterns, thereby improving the model's generalization ability.
[0097] When the loss is small (i.e., the model performs better), the noise standard deviation can be reduced, allowing the model to focus more on the key features of the data and avoid excessive introduction of unnecessary interference.
[0098] A threshold can be set based on experience to determine whether the loss is large or small.
[0099] Step 3.4: Affine transformation: Affine transformation is used to scale and translate data. Affine transformation enables the model to flexibly adjust the data distribution and improve the effect of feature extraction, especially in PM2.5 prediction, which can better capture complex patterns. Scaling and translating the normalized data with added noise to obtain the normalized time series data The specific formula is as follows:
[0100]
[0101] in, represents the scaling factor, represents the translation amount, and is a learnable parameter.
[0102] Step 4: Decompose the normalized time series data into trend features and seasonal features, and perform feature enhancement mapping and linear prediction respectively to obtain trend component prediction results and seasonal component prediction results, and add them together to obtain the time prediction result.
[0103] Step 4.1: The normalized time series data is decomposed into trend features and seasonal features through multi-scale convolution kernel and difference processing.
[0104] The specific process is:
[0105] The normalized time series data were smoothed using six moving average kernels of different scales. The moving average of each kernel was calculated, and the mean of the six moving averages was used as the trend feature. The normalized time series data and trend features were differentiated to obtain seasonal features. The kernel sizes were 17, 25, 33, 49, 65, and 73, respectively.
[0106] This method designs a multi-scale seasonal trend decomposer. In the PM2.5 prediction task, the design of the multi-scale seasonal trend decomposer aims to enhance the model's understanding and prediction capabilities of complex data patterns through an efficient time series decomposition method. PM2.5 concentration data is usually affected by multiple factors, showing significant seasonal fluctuations, trend changes, and high noise characteristics. Traditional time series decomposition methods, such as the classic STL decomposition method and exponential smoothing method, although they perform well when processing stationary series, are difficult to effectively capture long-term trends and short-term seasonal fluctuations when faced with complex and noisy PM2.5 data, resulting in limited prediction accuracy. Therefore, it is particularly important to adopt a multi-scale decomposition method that adapts to the characteristics of complex data.
[0107] The multi-scale seasonal trend decomposer overcomes the shortcomings of traditional methods in capturing complex fluctuations by introducing a smoothing process using multi-scale convolution kernels. In this example, six convolution kernel sizes of 17, 25, 33, 49, 65, and 73 were used to perform multi-scale smoothing on the normalized input time series data. Smaller convolution kernels (17, 25, and 33) can remove high-frequency noise and extract short-term seasonal variations, while larger convolution kernels (49, 65, and 73) are more suitable for extracting long-term trend components, revealing the overall trend of PM2.5 concentration over a longer time span. By combining these convolution kernels of different scales, the multi-scale seasonal trend decomposer can efficiently extract key data features at multiple time scales, thereby achieving accurate decomposition of complex time series. In this example, the normalized time series data is passed through six moving average kernels of different scales to obtain six moving averages, which are then averaged to obtain the final trend features.
[0108] After extracting the trend component from the normalized time series data, the multi-scale seasonal trend decomposer extracts the seasonal component from the data through a differencing operation. The core idea of this operation is to remove the trend component from the series while retaining the cyclical fluctuations. In other words, the trend characteristics are subtracted from the normalized time series data to obtain the seasonal characteristics.
[0109] Differencing effectively eliminates the influence of long-term trends and highlights cyclical characteristics, thereby more accurately capturing seasonal fluctuations in PM2.5 concentration data. Overall, the multi-scale seasonal trend decomposer, through its combination of multi-scale convolution and differencing techniques, significantly improves the model's performance in complex time series analysis, particularly in capturing trend changes and seasonal characteristics in PM2.5 concentration data, demonstrating strong adaptability and predictive effectiveness. This separation of trend and seasonality enables the model to better understand the inherent patterns in the data, thereby improving the accuracy of PM2.5 concentration forecasts.
[0110] By adopting a multi-dimensional smoothing method, the multi-scale seasonal trend decomposer significantly improves the model's ability to understand time series data and enhances its ability to predict complex patterns. The decomposer can effectively deal with the high noise, nonlinear characteristics and seasonal fluctuations in PM2.5 data, making the prediction results more accurate and reliable. The modular design ensures that the trend components and seasonal components extracted from different dimensions can provide more refined features for subsequent prediction models, improving the model's adaptability and robustness. Therefore, the application of the multi-scale seasonal trend decomposer in PM2.5 concentration prediction not only optimizes the model's performance when processing complex nonlinear data, but also demonstrates efficiency and accuracy in actual scenarios, providing strong technical support for PM2.5 concentration prediction.
[0111] Step 4.2: This method designs a feature enhancement mapper to implement feature enhancement mapping. The feature enhancement mapper performs a linear transformation on the input data through the weight matrix and the bias matrix, and then uses the Einstein sum convention (einsum), which can efficiently multiply the input features with the weight matrix to generate a new high-dimensional feature representation. The shape of the input data is (B, T, C), where B is the batch size, T is the time step, and C is the input channel dimension. Through matrix multiplication, the shape of the weight matrix is (C, F), which is mapped to the F features corresponding to each channel, generating This method extracts complex underlying patterns from the raw data, helping to capture both long-term trends and short-term fluctuations in PM2.5 concentrations. After linear transformation, the Einstein summation convention is used to fuse the mapped features one by one to form a more comprehensive feature.
[0112] The calculation formula of feature enhancement map is:
[0113]
[0114] in, represents the output tensor, represents the input tensor, represents the weight matrix, represents the bias matrix, represents the batch size, represents the time step, represents the input channel dimension, Indicates the number of output features mapped to each input channel, and c represents the cth dimension.
[0115] In this embodiment, after the trend feature undergoes feature enhancement mapping, a mapped trend feature is obtained; after the seasonal feature undergoes feature enhancement mapping, a mapped seasonal feature is obtained.
[0116] In this embodiment, F is determined by the ratio of the sequence length of the input tensor to the sequence length of the output tensor. This mapping method can improve the expressiveness of features, enabling the model to effectively extract information at different time scales. Due to the nonlinear and time-varying characteristics of PM2.5 concentration data, the feature enhancement mapper is particularly important when integrating complex features. The calculation formula is:
[0117]
[0118] in, Indicates the sequence length of the input tensor. In this embodiment is 96; Indicates the sequence length of the output tensor. In this embodiment 1, 3, 6, 9, 12, 24; Indicates rounding down. The feature dimension can be adjusted to help the model adapt to data of different sizes. In this embodiment, The formula of this embodiment is designed to use input data to control the value of F. Generally, the value of F is an integer, and preferably, the value of F is 1-10.
[0119] Step 4.3: The output tensor of the feature enhancement mapper is linearly predicted to obtain the prediction result. That is, the mapped trend features are linearly predicted to obtain the trend component prediction result; the mapped seasonal features are linearly predicted to obtain the seasonal component prediction result.
[0120] In this embodiment, linear prediction is performed using a fully connected linear layer.
[0121] Step 4.4: Add the trend component forecast results and the seasonal component forecast results to obtain the time forecast results.
[0122] Step 5: Based on the normalized time series data, the mutual information method is used to construct the graph structure of the PM2.5 sequence, and the spatial prediction results are obtained through graph attention neural network prediction.
[0123] Step 5.1: First, convert the normalized time series data into a graph structure. The nodes of the graph structure represent sites, and the edges represent the correlation between sites. In this embodiment, the number of nodes is 8, corresponding to the target site and 7 surrounding sites. Based on the normalized time series data, the mutual information method is used to construct the graph structure of the PM2.5 sequence. Mutual information is a statistic that measures the correlation between random variables. In this model, the adjacency matrix of the graph structure is constructed based on mutual information, which captures the spatial dependency between different sites. The adjacency matrix defines which nodes have a strong correlation.
[0124] Step 5.2: Since the degrees of different nodes (number of connections to other nodes) may vary greatly, directly using the adjacency matrix may lead to instability in the training process. Therefore, symmetric normalization is used to process the adjacency matrix of the graph structure to obtain a symmetric normalized adjacency matrix to ensure that the input signal of each node can be transmitted in a balanced manner. Symmetrically normalized adjacency matrix The calculation formula is:
[0125]
[0126]
[0127] in, The adjacency matrix representing the graph structure, represents the degree matrix, Is a diagonal matrix, the diagonal elements of the degree matrix are nodes The degree, Representation and Node The number of directly connected edges, Degree matrix The inverse of the square root of Represents the nodes in the adjacency matrix and nodes edge.
[0128] Step 5.3: Input the node feature matrix of the graph structure and the symmetrically normalized adjacency matrix into the graph attention neural network to predict the spatial prediction results.
[0129] The graph attention neural network introduces sine and cosine positional encoding to add positional encoding to input features, thereby enhancing the representation of spatiotemporal information. After processing node features, an adaptive attention mechanism focuses on the key information of connected nodes, effectively capturing spatially interdependent features. Finally, the linear layer outputs the predicted PM2.5 concentration value by weightedly aggregating the node features. Weighted aggregation dynamically adjusts the influence of neighboring nodes based on inter-regional dependencies, improving the model's prediction performance in complex environments.
[0130] First, we use sine and cosine positional encoding to process the node feature matrix. This approach aims to provide more contextual information for each node, helping the model better understand the relationships between nodes. Sine and cosine positional encoding not only provides rich positional information but also effectively captures relative positional relationships in sequence data, further improving the model's ability to handle temporal changes.
[0131] The sine formula for even dimensions is:
[0132]
[0133] in, means selecting all columns of even dimensions in the positional encoding matrix, Column vector representing position index, ranging from 0 to , Indicates the maximum sequence length. Represents the calculated scaling factor to ensure that the encoding amplitude of each dimension is appropriate, and its value decreases as the dimension increases. Represents the scaling factor used to adjust the amplitude of the sine value to fit the length of the entire position encoding.
[0134] The formula for calculating the cosine of odd dimensions is:
[0135]
[0136] in, Indicates selecting all odd-dimensional columns in the position encoding matrix. By combining the cosine and sine functions, the encoding of each position is made both periodic and variable in high-dimensional space.
[0137] The node features after sine and cosine position encoding are mapped to the new space. Attention weights are calculated based on the connectivity defined by the symmetric normalized adjacency matrix. The features of neighboring nodes are weighted and aggregated using the attention weights. The linear layer outputs the spatial prediction result (the output of the graph attention network).
[0138] In the spatial prediction of PM2.5, an adjacency matrix constructed based on mutual information provides the foundation for graph neural networks to model spatial relationships. Specifically, the adjacency matrix identifies which nodes in the graph (data from monitoring stations) have strong correlations. GAL leverages these adjacency relationships to dynamically assign weights, determining the influence of neighboring nodes on the central node. This approach captures key correlations in the spatial distribution of PM2.5 and provides strong support for inter-regional PM2.5 concentration prediction.
[0139] The attention mechanism further calculates the attention weight between each pair of connected region data , and perform weighted aggregation on the features of the neighbors, the formula is as follows:
[0140]
[0141] in, Is with the node The set of connected neighbor nodes, Representation node The eigenvector of Representation node The eigenvector of . Represents a join operation. is a learnable parameter vector, usually used to calculate the attention score, and T represents the transpose. is used The transpose of is multiplied by the concatenated eigenvector to obtain a scalar value, which is used to measure the node and nodes The similarity or correlation between them. Indicates the number of neighbor nodes of a node. Represents a learnable parameter matrix that maps input features to a new representation space. Represents the activation function.
[0142] Step 6: Dynamically fuse the temporal prediction results and the spatial prediction results through the gating network, and after denormalization, obtain the predicted value of PM2.5 concentration at the target site.
[0143] In a gated network, the gating mechanism typically outputs values between 0 and 1 (e.g., calculated using a sigmoid function). These values are used to adjust the model's weight matrix, for example, by scaling weights up or down or performing selective filtering. This mechanism allows the model to dynamically adjust its weights at runtime, allowing for more flexible adaptation to data.
[0144] The calculation process of the gating mechanism:
[0145] First, the gating network calculates the control coefficient through the temporal prediction results and the spatial prediction results :
[0146]
[0147] in, is the weight matrix of the gating network, which is responsible for extracting information from the temporal and spatial prediction results. is the time prediction result, is the spatial prediction result. σ is the sigmoid activation function, ensuring The output is between 0 and 1. is the bias term of the gating network.
[0148] when When it is close to 1, it means the time prediction result The importance of
[0149] when When it is close to 0, it means the spatial prediction result More important.
[0150] Secondly, after calculating the control coefficient Finally, the model fuses the temporal and spatial prediction results in a weighted manner to generate the final fusion result. :
[0151]
[0152] Among them, when When it is close to 1, the model is more dependent on the time prediction results. When it is close to 0, the model makes more use of spatial prediction results. The gating network adjusts the integration weights of temporal and spatial prediction results based on the input data.
[0153] Gated Network and The weights and biases are continuously updated with the backpropagation during model training. Specifically, the model optimizes these weights and biases by minimizing the loss function during training, so that the model can dynamically adjust the fusion weights of temporal and spatial features according to different input data.
[0154] Time feature weight: In the period when seasonal changes are more significant, the time feature may be more important, so Will be close to 1, at this time the model relies more on the time prediction results. At this time, the gating network will strengthen the weight of the time feature, making the time prediction results Dominant in.
[0155] Spatial feature weight: When the air quality differences between monitoring sites (target site, surrounding sites) are large, spatial features may dominate, so Will be close to 0, the model relies more on the spatial prediction results. At this time, the gating network adjusts the weights so that the spatial prediction results are occupies a dominant position in .
[0156] Adjust weights: In the actual PM2.5 prediction task, the gated network will dynamically adjust according to the characteristics of the input data For example, in some time periods, seasonal fluctuations make temporal features more important, while in other time periods, differences between monitoring sites lead to higher weights for spatial features. The gating network adjusts according to these dynamic changes. , so that the model can make predictions in the way that best suits the current situation at any moment.
[0157] After denormalization, the predicted PM2.5 concentration at the target site is obtained. The denormalization is performed in the opposite way to step 3.
[0158] In order to verify the effectiveness of this method, this example selects the DRSA dataset, which contains hourly air pollutant data from 12 nationally controlled air quality monitoring points. This example takes the prediction of Guanyuan area as an example and only uses the data of Guanyuan area and the data of the seven monitoring points closest to its surrounding geographical locations. In the experiment, time series prediction models such as BI-LSTM, Transformer, Autoformer, TEFN, and TSMixer were selected and the spatiotemporal model proposed by this method was used for experiments to compare the performance of different models in PM2.5 concentration prediction. The indicators selected were MAE, RMSE (Root Mean Squared Error) and R 2 (R-squared, coefficient of determination), the experimental results are shown in Table 2. The comparison results of the predicted value and the true value of this method in the next 116 time steps are as follows Figure 2 shown.
[0159] Table 2 Comparison of results of spatiotemporal model and other time series prediction models
[0160]
[0161] This embodiment also provides a PM2.5 prediction system based on spatiotemporal features, which adopts the following technical solution: including: a data acquisition module, a data processing module, a feature normalizer, a time prediction module, a space prediction module and a gated prediction module.
[0162] The data acquisition module is used to obtain atmospheric pollutant data and meteorological data of the target site and surrounding sites.
[0163] The data processing module is used to process the atmospheric pollutant data and meteorological data of the surrounding sites using principal component analysis and geographic distance weighting, and then splice them with the atmospheric pollutant data and meteorological data of the target site to obtain the data to be analyzed.
[0164] The feature normalizer is used to normalize the data to be analyzed to obtain normalized time series data.
[0165] The time prediction module is used to decompose the normalized time series data into trend features and seasonal features, and obtain trend component prediction results and seasonal component prediction results through feature enhancement mapping and linear prediction respectively, and add them together to obtain the time prediction result. The time prediction module mainly includes a multi-scale seasonal trend decomposer, a feature enhancement mapper and a fully connected linear layer. The multi-scale seasonal trend decomposer is used to decompose the normalized time series data into trend features and seasonal features. The feature enhancement mapper is used to perform feature enhancement mapping on the trend features and seasonal features respectively to obtain mapped trend features and mapped seasonal features. The fully connected linear layer is used to perform linear prediction on the mapped trend features and mapped seasonal features respectively to obtain trend component prediction results and seasonal component prediction results.
[0166] The spatial prediction module is used to construct the graph structure of the PM2.5 sequence based on the normalized time series data using the mutual information method, and predict the spatial prediction results through the graph attention neural network.
[0167] The gated prediction module is used to dynamically fuse the temporal prediction results and the spatial prediction results through the gated network, and obtain the predicted value of the PM2.5 concentration at the target site after denormalization.
[0168] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A PM2.5 prediction method based on spatiotemporal characteristics, characterized in that: include: Obtain atmospheric pollutant data and meteorological data for the target site and surrounding sites; The atmospheric pollutant data and meteorological data of the surrounding stations are processed using principal component analysis and geographic distance weighting, and then spliced with the atmospheric pollutant data and meteorological data of the target station to obtain the data to be analyzed; The calculation process of geographic distance weighting is: Calculate the geographical distance between the target site and each surrounding site; Using geographical distance as a weighting factor, an inverse weighting strategy is adopted to calculate weights based on geographical distance; The principal component analysis results of each surrounding station are weighted and summed according to their weights to obtain the pollutant and meteorological data of the surrounding stations after dimensionality reduction; Normalize the data to be analyzed to obtain normalized time series data; The normalized time series data is decomposed into trend features and seasonal features, and subjected to feature enhancement mapping and linear prediction respectively to obtain trend component prediction results and seasonal component prediction results, which are added together to obtain the time prediction result; The calculation formula of feature enhancement map is: in, represents the output tensor, represents the input tensor, represents the weight matrix, represents the bias matrix, represents the batch size, represents the time step, represents the input channel dimension, Indicates the number of output features mapped to each input channel, and c represents the cth dimension; The calculation formula is: in, represents the sequence length of the input tensor, represents the sequence length of the output tensor, Indicates rounding down; Based on the normalized time series data, the mutual information method is used to construct the graph structure of the PM2.5 sequence, and the spatial prediction results are obtained through the graph attention neural network; The temporal prediction results and spatial prediction results are dynamically fused through the gating network, and after denormalization, the predicted value of PM2.5 concentration at the target site is obtained.
2. A PM2.5 prediction method based on spatiotemporal characteristics according to claim 1, characterized in that: Atmospheric pollutant data include fine particulate matter, inhalable particulate matter, sulfur dioxide, nitrogen dioxide, carbon monoxide and ozone, and meteorological data include temperature, air pressure, dew point temperature, wind direction and wind speed.
3. The PM2.5 prediction method based on spatiotemporal characteristics according to claim 1, wherein: In principal component analysis, the principal component with the largest variance is selected.
4. The PM2.5 prediction method based on spatiotemporal characteristics according to claim 1, wherein: The normalization process is: Calculate the mean and standard deviation of the data to be analyzed; Use the mean and standard deviation to normalize the data to be analyzed to obtain normalized data; Add noise to the normalized data; The normalized data with added noise is scaled and translated to obtain the normalized time series data.
5. The PM2.5 prediction method based on spatiotemporal characteristics according to claim 4, characterized in that: Dynamically adjust the standard deviation of noise. The noise standard deviation calculation formula is: in, represents the noise standard deviation, represents the value of the loss function, It means to find the maximum value, Indicates finding the minimum value.
6. The PM2.5 prediction method based on spatiotemporal characteristics according to claim 1, wherein: The process of decomposing normalized time series data into trend features and seasonal features is as follows: The normalized time series data is smoothed using multiple moving average kernels of different scales. The moving average of each kernel is calculated separately, and the mean of the multiple moving averages is used as the trend feature. The normalized time series data and trend characteristics are used to obtain seasonal characteristics through differentiation; The kernel sizes are 17, 25, 33, 49, 65, and 73, respectively.
7. The PM2.5 prediction method based on spatiotemporal characteristics according to claim 1, wherein: The prediction process of spatial prediction results is: Based on the normalized time series data, the mutual information method is used to construct the graph structure of the PM2.5 series; Use symmetric normalization to process the adjacency matrix of the graph structure to obtain a symmetric normalized adjacency matrix; The node feature matrix of the graph structure and the symmetrically normalized adjacency matrix are input into the graph attention neural network to obtain the spatial prediction results.
8. The PM2.5 prediction method based on spatiotemporal characteristics according to claim 7, characterized in that: During the prediction process of the graph attention neural network, the node feature matrix is processed using sine and cosine position encoding.
9. A PM2.5 prediction system based on spatiotemporal characteristics, characterized in that: Used to execute a PM2.5 prediction method based on spatiotemporal features as described in any one of claims 1 to 8, comprising: a data acquisition module, a data processing module, a feature normalizer, a time prediction module, a space prediction module and a gated prediction module, Data acquisition module, used to obtain atmospheric pollutant data and meteorological data of the target site and surrounding sites; The data processing module is used to process the atmospheric pollutant data and meteorological data of the surrounding stations using principal component analysis and geographic distance weighting, and then splice them with the atmospheric pollutant data and meteorological data of the target station to obtain the data to be analyzed; Feature normalizer, used to normalize the data to be analyzed to obtain normalized time series data; The time prediction module is used to decompose the normalized time series data into trend features and seasonal features. After feature enhancement mapping and linear prediction, the trend component prediction results and seasonal component prediction results are obtained respectively, and the time prediction results are obtained by adding them together. The spatial prediction module is used to construct the graph structure of the PM2.5 sequence based on the normalized time series data using the mutual information method, and predict the spatial prediction results through the graph attention neural network; The gated prediction module is used to dynamically fuse the temporal prediction results and the spatial prediction results through the gated network, and obtain the predicted value of the PM2.5 concentration at the target site after denormalization.
Citation Information
Patent Citations
Long time sequence pm2.5 prediction method and system based on space-time attention
CN114662791A
PM2.5 concentration prediction method based on space-time diagram ordinary differential equation network
CN114694767A
Regional air quality prediction model based on multi-scale dynamic synchronous graph mechanism
CN117371571A
Deep learning quantile water quality prediction method based on trend decomposition
CN117689081A
PM2.5 spatio-temporal change prediction system and method based on neural network
CN118861543A