PM2.5 prediction method based on optimized modal decomposition and attention-enhanced time series network
Patent Information
- Application Number
- CN202611090240.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-22
- Publication Date
- 2026-10-16
AI Technical Summary
[0004]现有PM2.5预测模型的不足有:原始信号非平稳性处理不充分,PM2.5原始序列包含多尺度振荡与噪声,直接输入循环网络易导致梯度不稳定、预测滞后,而经验模态分解(EMD)及其变体存在模态混叠与端点效应问题,变分模态分解(VMD)虽能有效缓解模态混叠,但其分解层数K和惩罚因子α通常依赖人工经验设定,不同站点、季节的最优参数差异大,难以自适应获取;局部时序特征提取能力弱,主流循环网络(LSTM/GRU)擅长捕捉长程依赖,但对时间轴上的短期突变模式(如污染峰值前的快速爬升)不敏感,缺乏局部感受野机制;特征注意力机制缺失,现有模型对所有时间步和特征通道给予相同权重,无法自适应聚焦于关键信息(如高污染时段、强相关气象因子),导致重污染事件预测偏差大;单向信息利用片面,即使采用双向网络,若缺乏前端特征筛选,仍会受到冗余噪声干扰,制约预测精度
[0028] 1. As described in claim 2, this invention employs the Whale Optimization Algorithm (WOA) with the goal of minimizing the average envelope entropy, adaptively optimizing the decomposition level K and penalty factor α of VMD. The envelope entropy, based on the Hilbert transform, extracts the instantaneous amplitude envelope of the IMF and calculates the information entropy, accurately characterizing modal purity and energy concentration; when noise or modal aliasing exists, the envelope entropy value is significantly higher. This objective effectively guides WOA to screen out high-purity effective components, overcoming the modal aliasing and over/under-decomposition problems caused by traditional VMD empirical parameter settings, providing high signal-to-noise ratio input for subsequent time series modeling, and supporting an overall improvement in prediction accuracy.
Smart Images

Figure CN122925829A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of air quality prediction technology, specifically relating to a PM2.5 concentration prediction method based on optimized mode decomposition and attention-enhanced temporal network, and more particularly to a PM2.5 concentration prediction method that integrates whale optimization algorithm-variable mode decomposition (WOA-VMD), one-dimensional convolutional neural network (1DCNN), convolutional block attention module (CBAM), and bidirectional gated recurrent unit (BiGRU). Background Technology
[0002] PM2.5 concentration prediction plays a crucial role in many fields, including air quality early warning, emergency control of heavy pollution, and public health protection, and is a key technological support for achieving refined environmental governance. Existing prediction methods are mainly divided into three categories: First, statistical models, represented by ARIMA and MLR, rely on the linear assumption of historical sequences, making it difficult to characterize the nonlinear dynamics of the atmospheric system; second, machine learning methods, represented by random forests and support vector regression, can capture some nonlinear relationships, but are limited by shallow structures and lack the ability to model long-term dependencies; and third, time-series networks based on deep learning, such as LSTM, GRU, and TCN, have a strong ability to uncover the time dependence of PM2.5 concentrations.
[0003] However, the strong nonlinearity, multi-scale oscillations, and sudden peak fluctuations in PM2.5 concentration sequences significantly reduce prediction accuracy. These complex characteristics make it difficult for traditional prediction models to capture their true evolutionary patterns, increasing both prediction uncertainty and model building difficulty. Therefore, combining signal decomposition techniques with deep learning models has become a research hotspot in the field.
[0004] The shortcomings of existing PM2.5 prediction models include: insufficient handling of the non-stationarity of the original signal. The original PM2.5 sequence contains multi-scale oscillations and noise, and direct input into recurrent networks can easily lead to gradient instability and prediction lag. Empirical Mode Decomposition (EMD) and its variants suffer from mode aliasing and endpoint effects. Although Variational Mode Decomposition (VMD) can effectively alleviate mode aliasing, its decomposition layer K and penalty factor α usually depend on manual experience setting, and the optimal parameters vary greatly for different sites and seasons, making it difficult to adaptively obtain them. The ability to extract local temporal features is weak. Mainstream recurrent networks (LSTM / GRU) are good at capturing long-range dependencies, but they are not sensitive to short-term abrupt changes on the time axis (such as rapid rises before pollution peaks) and lack a local receptive field mechanism. The lack of a feature attention mechanism means that existing models give the same weight to all time steps and feature channels, and cannot adaptively focus on key information (such as high pollution periods and strongly correlated meteorological factors), resulting in large prediction biases for heavy pollution events. One-sided information utilization means that even if a two-way network is used, it will still be affected by redundant noise interference if there is a lack of front-end feature screening, which restricts the prediction accuracy.
[0005] Application publication number CN119692173A proposed a PM2.5 concentration prediction method based on VMD-TCN-BiGRU-SA. It provides an effective approach for PM2.5 prediction by using Spearman correlation to screen features, VMD to decompose sequences, and TCN-BiGRU-SA cascade modeling. However, it still has limitations: its VMD parameters rely on human experience, easily leading to decomposition distortion; TCN's unidirectional extraction struggles to capture short-term mutations and lacks an adaptive feature weighting mechanism. This invention employs WOA-VMD to automatically optimize decomposition parameters, eliminating subjective interference; it replaces TCN with 1DCNN to mine local temporal dependencies, and combines CBAM's dual attention to adaptively focus on key features during high-pollution periods, solving the weight uniformity bias.
[0006] Furthermore, the comparative document places the SA module after BiGRU, and its weighting mechanism may have limited ability to dynamically suppress noise in the bidirectional information flow during the feature extraction stage. Also, due to the influence of the normalization method, it may be difficult to fully retain non-significant but potentially valuable contextual information. To address this, this invention constructs a cascaded "CBAM+BiGRU" architecture. By using a pre-processed CBAM to filter noise and enhance key features before the feature input to BiGRU, it helps reduce the interference of noise on bidirectional dependency modeling. Simultaneously, the continuous weighting characteristic of CBAM better preserves contextual information to support more comprehensive long-range dependency modeling, and ultimately, the prediction accuracy is further improved through multi-module collaboration. Summary of the Invention
[0007] This invention aims to solve the problems of the prior art mentioned above. It proposes a PM2.5 prediction method based on optimized mode decomposition and attention-enhanced temporal networks. The technical solution of this invention is as follows:
[0008] A PM2.5 prediction method based on optimized mode decomposition and attention-enhanced temporal networks includes the following steps:
[0009] S1. Acquire historical PM2.5 concentration monitoring data, along with corresponding meteorological data and other pollutant concentration data, to form a multi-source input dataset. Perform missing value imputation, outlier processing, and normalization operations on the dataset. Then, use the Whale Optimization Algorithm (WOA) to adaptively search for the optimal parameters of Variational Mode Decomposition (VMD) to decompose the original PM2.5 concentration sequence into multiple Intrinsic Mode Function (IMF) components. Perform feature fusion of the IMF components with meteorological data and other pollutant concentration data, and construct a standardized time-series input sequence using a fixed-length sliding window.
[0010] S2, Local Temporal Feature Extraction: The multi-channel temporal input samples constructed in step S1 are input into a one-dimensional convolutional neural network 1DCNN, and the local short-term temporal pattern features of the input samples are extracted through the one-dimensional convolutional neural network.
[0011] S3, Key Feature Enhancement: Input the local temporal features extracted in step S2 into the convolutional block attention module (CBAM). The CBAM weights the features in the channel dimension and spatial dimension and outputs the enhanced feature vector.
[0012] S4, Bidirectional long-range temporal dependency feature capture: The weighted feature vector sequence processed in step S3 is input into the bidirectional gated recurrent unit BiGRU, and the bidirectional long-range temporal dependency features of the sequence are captured by the BiGRU and the feature vector is output.
[0013] S5, Predicted value output: Input the feature vector output in step S4 into the fully connected layer, output the predicted PM2.5 concentration for the next time step through the fully connected layer, and perform inverse normalization on the predicted value.
[0014] Furthermore, step S1 specifically includes:
[0015] S11, Input data: The other pollutant concentration data includes hourly PM2.5 concentrations. 10 Concentration data for SO2, NO2, O3 and CO, including hourly data on temperature, air pressure, relative humidity, wind speed, wind direction and rainfall;
[0016] S12, Data Preprocessing: The dataset has few missing values and the data trend is stable, so linear interpolation is used to impute them; box plots are used to identify outliers.
[0017] S13, WOA-VMD decomposition: Using the average envelope entropy of all IMF components obtained from the VMD decomposition of the PM2.5 sequence as the fitness function, the optimal penalty factor for VMD is searched iteratively using WOA. and number of modes The optimal parameters are saved; the optimized VMD is used to decompose the PM2.5 sequence to obtain... IMFs with different center frequencies;
[0018] S14, Normalization processing: Each IMF component is concatenated with the preprocessed meteorological data and other pollutant concentration data to form a multivariate feature matrix; all features in the multivariate feature matrix are uniformly processed using the Min-Max normalization method to map all feature values to the [0,1] interval;
[0019] S15, Constructing a standard time series input sequence: A sliding window of fixed length T is used to slice the normalized multivariate time series data, with the window moving forward successively at 1-hour intervals; each sample contains T time steps, and the feature dimension of each time step is (number of IMF components + number of meteorological and pollutant features); the actual PM2.5 concentration of the next time step is used as the prediction label.
[0020] Furthermore, in step S2, the one-dimensional convolutional neural network sequentially includes a first convolutional layer, a second convolutional layer, and a max-pooling layer; the first convolutional layer employs a causal padding strategy and is configured with a ReLU activation function to extract local temporal features and prevent future information leakage; the second convolutional layer employs a 1×1 convolutional kernel and is configured with a ReLU activation function to perform cross-channel feature fusion and dimensionality compression on the output of the first convolutional layer; the max-pooling layer is used to downsample the output of the second convolutional layer along the time dimension, generate a local feature map, and output it to the CBAM module in step S3.
[0021] Furthermore, in step S3, the CBAM module receives the local feature map output by the 1DCNN and sequentially performs channel and spatial attention operations; the channel attention submodule performs global average pooling and global max pooling on the input feature map respectively, generates channel weights through a shared multilayer perceptron and multiplies them with the original feature map; the spatial attention submodule performs average pooling and max pooling on the channel-weighted feature map along the channel dimension and concatenates them, generates a spatial weight matrix through spatial convolution and Sigmoid activation, and then multiplies it element-wise with the feature map to obtain the enhanced feature vector.
[0022] Furthermore, the specific parameter configuration of the CBAM module is as follows: the channel compression ratio of the shared multilayer perceptron in the channel attention submodule is 8; the convolution kernel size of the spatial convolution in the spatial attention submodule is 3.
[0023] Furthermore, in step S4, the BiGRU module adopts a two-layer stacked bidirectional GRU structure, and the output modes of the two layers are different: the first-layer bidirectional GRU is set to return the complete time series mode, outputting the hidden state of each time step to retain the temporal dynamic information, and then connected to the Dropout layer to prevent overfitting; the second-layer bidirectional GRU is set to return only the state mode of the last time step, directly outputting the final feature vector that integrates the bidirectional long-range dependency information of the entire sequence, as the input of the fully connected layer in step S5.
[0024] Furthermore, step S5 includes: mapping the final feature vector output in step S4 to a predicted PM2.5 concentration value through a fully connected layer, wherein the output dimension of the fully connected layer is consistent with the predicted target dimension and a linear activation function is used; during the model training phase, the model parameters are updated using the mean squared error as the loss function, while maintaining the original temporal order of the samples; after the prediction is completed, the predicted PM2.5 concentration value is denormalized using the normalization parameters saved in step S1 to obtain the restored predicted PM2.5 concentration result.
[0025] An electronic device includes a memory and a processor, the memory storing program code executable by the processor, wherein the processor executes a PM2.5 prediction method based on optimized mode decomposition and attention-enhanced temporal networks as described in any one of the inventions by running the program code.
[0026] A computer-readable storage medium storing computer instructions thereon, characterized in that: when the computer instructions are executed by a processor, they perform a PM2.5 prediction method based on optimized mode decomposition and attention-enhanced temporal networks as described in any one of the above.
[0027] The advantages and beneficial effects of this invention are as follows:
[0028] 1. As described in claim 2, this invention employs the Whale Optimization Algorithm (WOA) with the goal of minimizing the average envelope entropy, adaptively optimizing the decomposition level K and penalty factor α of VMD. The envelope entropy, based on the Hilbert transform, extracts the instantaneous amplitude envelope of the IMF and calculates the information entropy, accurately characterizing modal purity and energy concentration; when noise or modal aliasing exists, the envelope entropy value is significantly higher. This objective effectively guides WOA to screen out high-purity effective components, overcoming the modal aliasing and over / under-decomposition problems caused by traditional VMD empirical parameter settings, providing high signal-to-noise ratio input for subsequent time series modeling, and supporting an overall improvement in prediction accuracy.
[0029] 2. As described in claims 3-5, this invention employs a 1DCNN-CBAM-BiGRU cascaded architecture, embedding CBAM between one-dimensional convolutional units and bidirectional gated recurrent units. Through channel-space dual attention adaptive weighted convolutional features, noise is suppressed and key information is enhanced, followed by BiGRU mining of long-range temporal dependencies. This design overcomes the redundancy and decreased encoding accuracy problems caused by the uniformity of feature weights and the post-positioning of attention in traditional models. Combined with a bidirectional information flow mechanism, it improves the response sensitivity and fitting accuracy to sudden heavy pollution events.
[0030] 3. The model proposed in this invention has excellent prediction accuracy, outperforming the compared models in terms of MAE, RMSE, and R². The architecture is adaptable to time series data from multiple sites and cities, and can be applied to engineering scenarios such as real-time environmental monitoring, air pollution early warning, regional public health management, and urban air control. Attached Figure Description
[0031] Figure 1 This is a flowchart of a preferred embodiment of the present invention for predicting PM2.5 concentration based on optimized mode decomposition and attention-enhanced temporal networks;
[0032] Figure 2 The PM2.5 described in the embodiments of the present invention. Schematic diagram of the time-domain waveforms of each IMF in the original sequence and WOA-VMD decomposition;
[0033] Figure 3 A scatter plot comparing the predicted and actual values of the model on the test set according to the embodiments of the present invention. Detailed Implementation
[0034] The technical solutions of the embodiments of the present invention will be clearly and thoroughly described below with reference to the accompanying drawings. The described embodiments are merely some embodiments of the present invention.
[0035] The technical solution of the present invention to solve the above-mentioned technical problems is:
[0036] A PM2.5 concentration prediction method based on optimized mode decomposition and attention-enhanced temporal networks includes the following steps:
[0037] S1. Acquire historical PM2.5 concentration monitoring data, along with corresponding meteorological data and other pollutant concentration data, to form a multi-source input dataset; perform preprocessing on the multi-source input dataset, including missing data imputation, outlier handling, and normalization.
[0038] S2, Optimized Mode Decomposition: An improved intelligent optimization algorithm is used to adaptively optimize the key parameters of Variational Mode Decomposition (VMD). The optimized VMD is then used to decompose the preprocessed PM2.5 concentration sequence to obtain multiple intrinsic mode components and residual terms with different center frequencies.
[0039] S3, Multi-channel temporal feature extraction: The intrinsic modal components and meteorological covariates obtained in step S2 are concatenated by channel and input into the temporal coding module in the attention-enhanced temporal network to extract the local and long-range temporal dependency features of each channel;
[0040] S4, Dual Attention Weighted Fusion: A dual attention mechanism consisting of temporal step attention and modal attention is introduced to adaptively assign weights to the feature tensors output in step S3 in the temporal and modal dimensions, highlighting the contributions of key temporal steps and key modal components.
[0041] S5, Predicted value output: Input the weighted feature vector processed in step S4 into the fully connected layer, output the predicted PM2.5 concentration for the next time step, and perform inverse normalization on the predicted value.
[0042] Furthermore, in step S1:
[0043] S11, Input data: The other pollutant concentration data includes hourly PM2.5 concentrations. 10 Concentration data for SO2, NO2, O3 and CO, including hourly data on temperature, air pressure, humidity, rainfall, wind direction and wind speed;
[0044] S12, Handling Missing and Outlier Values: For missing values in the dataset, linear interpolation is used for imputation; box plots are used to identify outliers.
[0045] S13, Normalization: The Min-Max normalization method is used to map all feature values to the [0,1] interval, constructing a time-series input sequence with uniform dimension and standardized distribution. The normalization formula is as follows:
[0046]
[0047] in, This represents the original data. For the normalized data, This represents the maximum value in the input data. This represents the minimum value in the input data. The data scale is adjusted by a linear ratio, and the original data is mapped to the [0,1] interval by a linear transformation.
[0048] S14, Constructing a Standard Time Series Input Sequence: A fixed-length sliding window of length T is used to slice the original multivariate time series data. The window moves forward sequentially at 1-hour intervals to achieve rolling updates of the input samples; among which, PM2.5 at the next future time step is used as the basis. Concentration is used as a prediction label, and the model learns and infers based solely on current and historical observations.
[0049] Furthermore, step S2 specifically includes:
[0050] S21, a bivariate joint optimization model is constructed using the minimum envelope entropy of the PM2.5 sequence as the fitness function. The standard Whale Optimization Algorithm (WOA) is selected to optimize the number of mode decomposition layers K and the quadratic penalty factor α of the VMD model. This invention uses envelope entropy as the fitness index for VMD parameter optimization. Envelope entropy characterizes the sparsity of the instantaneous envelope of a modal component; the smaller the value, the more concentrated the temporal energy and the more significant the transient characteristics of that component. WOA achieves global parameter optimization through three iterative strategies: prey encirclement, spiral position update, and random search. It does not rely on manual experience to set initial parameters, effectively avoiding problems such as over-decomposition, under-decomposition, mode aliasing, and noise residue caused by subjective parameter selection, and improving the independence and information purity of each modal component after decomposition. The relevant mathematical model is as follows:
[0051] 1. Formula for calculating envelope entropy:
[0052]
[0053] in, The sequence of IMF mode components is obtained by VMD decomposition, where N is the total length of the signal sequence of the IMF mode components. The normalized envelope amplitude probability density corresponding to the i-th sampling point satisfies the probability normalization constraint. .
[0054] 2. The Whale Optimization Algorithm (WOA) achieves global optimization by simulating the bubble-net feeding behavior of humpback whales. Its core lies in balancing local exploitation with global exploration capabilities. In this invention, WOA is used to adaptively search for the optimal parameter combination of variational mode decomposition, avoiding mode aliasing and noise residue problems caused by manual experience-based settings. During the algorithm iteration process, each individual whale represents a set of parameter vectors to be optimized, and the global optimum is approached collaboratively through the following two position update strategies:
[0055] When the algorithm is in the prey-encircling phase, the individual narrows its search range towards the current optimal solution to enhance its local exploitation capabilities. The distance vector calculation formula for this phase is:
[0056] When the algorithm is in the spiral predation phase, individuals move towards the optimal solution along a logarithmic spiral trajectory, maintaining population diversity while preserving the convergence trend and preventing them from getting trapped in local optima. The position update formula for this phase is:
[0057]
[0058] in, This is the distance vector between the current individual whale and the optimal solution; Let be the coefficient vector, whose values are determined by... Sure, It is a random vector in the interval [0,1]. For the first The global optimal position vector of the objective function in the next iteration; For the first The position vector of the current individual whale in the next iteration; A constant used to control the shape of the logarithmic spiral; It is a random number uniformly distributed in the interval [-1,1], used to adjust the spiral search step size.
[0059] 3. Variational Mode Decomposition (VMD) is an adaptive signal decomposition method based on variational principles. Its core idea is to transform the decomposition process of the original signal into a constrained variational optimization problem. This model introduces a quadratic penalty factor and Lagrange multipliers to simultaneously search for the center frequency and bandwidth of each mode component in the frequency domain. This ensures that each component is compactly distributed around its center frequency, while guaranteeing that the sum of all components strictly reconstructs the original signal, thereby effectively suppressing mode aliasing and noise residue. To solve this constrained optimization problem, the following variational objective function needs to be constructed:
[0060]
[0061] The constraints are:
[0062]
[0063] in, For intrinsic modal components, For the center frequency, Original signal, Dirac function, Number of modes.
[0064] S22, retrieve the optimal parameter combination [K*, α*] output after the WOA algorithm iterative convergence, substitute this set of parameters into the variational mode decomposition model, and perform adaptive decomposition operation on the one-dimensional PM2.5 concentration time series after normalization preprocessing; finally, decompose it into K intrinsic mode components IMF1, IMF2, ..., IMF_K with different center frequencies and non-overlapping spectra, as well as a one-dimensional residual term Res; each mode component is strictly sorted in order of center frequency from low to high, where the low-frequency IMF component represents the long-term concentration change trend of PM2.5 on daily and monthly scales, the mid-frequency IMF component represents the periodic fluctuation term formed by the coupling of meteorological cycle and pollution source emission cycle, and the high-frequency IMF component represents the high-frequency random fluctuation term composed of short-term sudden pollution and monitoring random noise, and the residual term retains a trace amount of residual feature information of the original sequence.
[0065] Furthermore, in step S3, the temporal coding module adopts a cascaded architecture of 1DCNN-CBAM-BiGRU, whose forward propagation logic consists of: a one-dimensional convolutional neural network (1DCNN), a one-dimensional CBAM attention module, and a bidirectional gated recurrent unit (BiGRU). This architecture supports hierarchical and progressive extraction of multi-channel fused features, and the specific execution flow is as follows:
[0066] First, the multi-channel feature tensor after channel concatenation is input into a 1DCNN. Through multi-layer one-dimensional causal convolution kernels and fixed-stride sliding convolution operations, fine-grained local temporal features of each modal component, meteorological covariate, and exogenous pollutant covariate are extracted along the temporal dimension. This captures hourly short-term concentration fluctuation patterns and local correlations, thus overcoming the limitations of traditional recurrent neural networks in terms of limited local receptive fields and insufficient ability to extract short-term abrupt changes and locally coupled features. The 1DCNN convolutional feature extraction formula is as follows:
[0067]
[0068] Further, step S4 includes: inputting the original convolutional feature tensor output by the 1DCNN into a one-dimensional CBAM attention module, filtering out redundant noise and enhancing key features through a channel-space dual adaptive weighting mechanism; and inputting the weighted feature tensor into a BiGRU module for subsequent processing. The one-dimensional CBAM attention module is configured before the BiGRU module, ensuring that the original convolutional features undergo attention weighting optimization before entering temporal encoding.
[0069] Further, step S5 is the BiGRU temporal encoding process. The high-dimensional feature tensor optimized by CBAM dual attention is input into a two-layer stacked bidirectional gated recurrent unit (BiGRU) network. The BiGRU network consists of a forward GRU and a backward GRU operating in parallel: the forward GRU propagates forward along the time axis to capture temporal dependencies from historical moments to the current moment; the backward GRU propagates backward along the time axis to trace back temporal correlation features from the current moment to historical moments. Through the collaborative operation of the forward and backward GRUs, a deep extraction of the global long-range dependencies of pollutant concentration temporal data is achieved. The BiGRU gating state update and bidirectional output fusion formulas are as follows:
[0070]
[0071] BiGRU bidirectional feature fusion formula:
[0072] in, These are updating the door and resetting the door, respectively. Candidate hidden state, The forward and backward GRUs hide their outputs. Vector concatenation operation.
[0073] Further, step S4 employs a one-dimensional CBAM convolutional block attention module to perform channel-space concatenated weighting on the one-dimensional temporal feature tensor output by the 1DCNN. This module is based entirely on one-dimensional convolution and temporal axis pooling operations, specifically including: S41, one-dimensional channel attention weighting: global average pooling and max pooling are performed along the temporal dimension to aggregate the global mean and extreme value features of each channel; after dimensionality reduction and restoration by a shared fully connected layer with a preset compression ratio, the channel attention weights are output by the Sigmoid function; accordingly, effective channels such as meteorological factors, exogenous pollutants, and core low-frequency trends are adaptively enhanced, while high-frequency noise modes and weakly correlated redundant channels are suppressed. The calculation formula is as follows:
[0074]
[0075] in, One-dimensional channels require heavy attention; , These are global average pooling and global max pooling operations performed along the time-series dimension, respectively. , These are a dimensionality-reducing fully connected layer with shared weights and a dimensionality-upgrading fully connected layer, with a channel compression ratio set to 8. This is the Sigmoid activation function.
[0076] S42, One-Dimensional Spatial Attention Weighting: Taking the one-dimensional temporal features corrected for channel attention as input, global average pooling and max pooling are performed along the channel dimension, and the two pooled features are concatenated; a one-dimensional convolution with a preset kernel size is used to fuse the concatenated features, and a one-dimensional spatial attention weight is generated by the Sigmoid activation function; this weight is used to adaptively focus on key temporal locations such as periods of heavy pollution outbreaks and inflection points of concentration abrupt changes. Its calculation formula is as follows:
[0077]
[0078] in, For one-dimensional attention weights, For one-dimensional convolution operations with a preset kernel size, , These represent the global average pooling and max pooling operations along the channel dimension, respectively, and [;] represents the feature vector concatenation operation.
[0079] S43, One-dimensional CBAM Dual Attention Feature Fusion: Channel attention weighting and spatial attention weighting are sequentially applied to the original one-dimensional temporal features. The two levels of attention weights are then multiplied element-wise with the original temporal features to complete the adaptive recalibration of the one-dimensional temporal features. This dual attention mechanism overcomes the shortcomings of uniform global weight distribution and strengthens the feature responses of key temporal positions and sensitive channels. The one-dimensional CBAM feature fusion formula is as follows:
[0080]
[0081] Furthermore, the specific process of model prediction output and training loss constraints in step S6 includes:
[0082] The final time-series state vector output by the second-layer bidirectional gated recurrent unit is directly input into the fully connected output layer; the fully connected output layer adopts a linear activation function, and the output dimension is consistent with the prediction target dimension, so as to obtain the predicted normalized concentration value of PM2.5 at the future preset time step;
[0083] During the model training phase, mean squared error is used as the target loss function, and an adaptive moment estimator optimizer is selected for iterative model training.
[0084] During the model inference stage, the normalization parameters stored in the preprocessing stage are called to perform inverse normalization on the output normalized prediction value, restore the physical dimensions of the actual PM2.5 concentration, and obtain the final prediction result.
[0085] An electronic device includes a memory and a processor, the memory storing program code executable by the processor, the processor executing the program code to perform a PM2.5 concentration prediction method based on optimized mode decomposition and attention-enhanced temporal networks as described in any of the preceding claims.
[0086] A computer-readable storage medium having stored thereon computer instructions that, when executed by a processor, perform a PM2.5 concentration prediction method based on optimized mode decomposition and attention-enhanced temporal networks as described in any of the preceding claims.
[0087] The technical solution of this invention to solve the above-mentioned technical problems is: a PM2.5 concentration prediction method based on optimized mode decomposition and attention-enhanced temporal networks, comprising the following steps:
[0088] S1, Data Acquisition and Preprocessing: The dataset features include PM2.5, ... 10 The dataset contains six air pollutant variables: SO2, CO, NO2, and O3, as well as six meteorological variables: temperature, atmospheric pressure, humidity, wind speed, wind direction, and rainfall. Linear interpolation was used to complete the missing values in the dataset to preserve the complete time series trend and fluctuation characteristics. At the same time, box plot method was used to identify outliers in the time series data. After testing, no outlier samples exceeding the threshold were found in the dataset of this embodiment.
[0089] S2, WOA-VMD decomposition: The Whale Optimization Algorithm (WOA) is used to optimize the number of decomposition modes K and the penalty factor α of VMD. The fitness function is the average value of the envelope entropy of all IMFs. After iteratively solving for the optimal parameter combination, variational mode decomposition is performed on the preprocessed original PM2.5 time series.
[0090] S3, Construction of supervised time series sample sets: For each IMF component sequence obtained from WOA-VMD decomposition, it is treated as an independent target sequence to be predicted; a fixed-length sliding window is used to continuously slice each target sequence, using the target sequence value of the historical time period as the model input feature and the target sequence value of the future time period as the prediction label, and generating labeled time series sample pairs according to a preset step size; after traversing all K IMF components, K sets of mutually independent basic time series sample sets are constructed, each set of sample sets contains only the historical-future mapping relationship of the corresponding single IMF component, where K is the total number of IMF components.
[0091] S4, Feature Extraction, Attention Weighting, and Temporal Modeling: Constructing a 1DCNN-CBAM-BiGRU prediction model. First, a one-dimensional convolutional module is used to extract local temporal abrupt change features; second, a dual attention mechanism of CBAM is introduced to achieve adaptive weighting of features in both channel and spatial dimensions; finally, BiGRU is used to capture global long-range temporal dependencies bidirectionally.
[0092] S5, Model Training, Prediction, and Result Restoration: The hybrid prediction model is trained using the constructed time-series sample set, and model inference prediction is completed based on the test set; the prediction results output by the model are denormalized to obtain the true PM2.5 concentration value.
[0093] Furthermore, the linear interpolation method described in S1, based on the effective data points adjacent to the missing value, completes the time-series missing value through linear fitting. Its calculation formula is as follows:
[0094] in, Calculated by linear interpolation The completed value of a certain feature at a given time point; These are the sampling time points corresponding to the missing values; and They are respectively The two closest valid sampling points; and They are respectively , The corresponding feature monitoring values at each time point.
[0095] Furthermore, the WOA-VMD parameter optimization and mode decomposition calculation process based on minimum envelope entropy in S2 includes:
[0096] 1. Envelope Entropy Calculation: Envelope entropy is constructed based on the Shannon information entropy principle and is used to characterize the complexity and sparsity of signal modal components. The smaller the envelope entropy value, the less noise interference in the component and the better the mode decomposition effect. Its calculation formula is as follows:
[0097]
[0098] in, The sequence of IMF mode components is obtained by VMD decomposition, where N is the total length of the signal sequence of the IMF mode components. The normalized envelope amplitude probability density corresponding to the i-th sampling point satisfies the probability normalization constraint. .
[0099] 2. Whale Optimization Algorithm (WOA) Iteration: WOA relies on the humpback whale bubble net predation mechanism to complete two-parameter global optimization, including prey encirclement and spiral position update.
[0100] Prey Encirclement Formula: Spiral position update formula:
[0101] in, This is the distance vector between the current individual whale and the optimal solution; Let be the coefficient vector, whose values are determined by... Sure, It is a random vector in the interval [0,1]. For the first The global optimal position vector of the objective function in the next iteration; For the first The position vector of the current individual whale in the next iteration; A constant used to control the shape of the logarithmic spiral; It is a random number uniformly distributed in the interval [-1,1], used to adjust the spiral search step size.
[0102] 3. VMD Variational Mode Decomposition Constraint Formula: Substitute the WOA iterative convergence optimal parameters [K*, α*] into the variational constraint model to solve for each independent intrinsic mode component. The formula is as follows:
[0103]
[0104] Among them, u k (t) represents the intrinsic mode components, ω k Let f(t) be the center frequency, f(t) be the original PM2.5 time series, δ(t) be the Dirac function, and K be the number of optimal modes.
[0105] Furthermore, the specific structure and computational principle of the 1DCNN-CBAM-BiGRU prediction model described in S4 are as follows:
[0106] 1. 1DCNN One-Dimensional Convolution Module: For a single IMF component's one-dimensional temporal input, a sliding convolution operation is performed using a one-dimensional causal convolution kernel. This accurately extracts fine-grained temporal features such as short-term concentration fluctuations and local abrupt changes within the component, compensating for the insufficient ability of recurrent neural networks to capture small local changes. The formula for calculating a single-component one-dimensional convolution is as follows:
[0107]
[0108] in, The input is a single-component temporal feature tensor. For one-dimensional convolution kernel weights, For convolution bias terms, This is a one-dimensional convolution operation. It is a non-linear activation function.
[0109] 2. One-dimensional CBAM attention module: placed between 1DCNN and BiGRU, it is composed of channel attention and spatial attention sub-modules connected in series, and performs two-dimensional adaptive weighting on the single-component convolution output features (the default channel compression ratio is 8 and the spatial convolution kernel size is 7).
[0110] The channel attention calculation process is as follows: Global average pooling and global max pooling are performed on the input temporal features along the temporal axis (axis=1) to obtain two pooled features with the same dimension. These two pooled features are then input into a two-layer fully connected layer with shared weights. The first fully connected layer performs dimensionality reduction at a compression ratio of 8 and is processed by the ReLU activation function. The second fully connected layer then increases the dimensionality to restore the original number of feature channels. The two output features are then summed element-wise and processed by the Sigmoid activation function to obtain the channel attention weights. The channel attention calculation formula is as follows:
[0111]
[0112] Spatial attention calculation process: Global average pooling and global max pooling are performed on the channel-weighted features along the feature dimension (axis=-1), and the results of the two pooling operations are concatenated along the feature dimension. Then, the features are compressed into single-channel features by a one-dimensional convolutional layer with a kernel size of 7 and the same padding method. Finally, spatial attention weights are generated by Sigmoid activation. The calculation formula is as follows:
[0113]
[0114] in, For one-dimensional attention weights, For one-dimensional convolution operations with a preset kernel size, , These represent the global average pooling and max pooling operations along the channel dimension, respectively, and [;] represents the feature vector concatenation operation.
[0115] The final weighted output of CBAM is the element-wise multiplication of the original features with the dual-channel, dual-space attention weights, thus completing the adaptive feature enhancement. The overall fusion formula is as follows:
[0116]
[0117] 3. BiGRU Bidirectional Temporal Coding Module: Receives single-component features optimized by CBAM, and through parallel forward and backward GRU encoding, captures the forward temporal evolution pattern and backward correlation information respectively, fusing them to generate a global long-range temporal representation that considers both historical and future aspects. The gating update and fusion formulas are as follows:
[0118] in, , These are updating the door and resetting the door, respectively. Candidate hidden state, The forward and backward GRUs hide the outputs, and ⊕ represents vector concatenation operations; a Dropout layer is added between BiGRU layers to suppress model overfitting.
[0119] Furthermore, the deep temporal features output by the BiGRU are directly fed into the linear output layer to generate normalized prediction values for the corresponding IMF components. Specifically, the second-layer BiGRU returns the hidden state at the final time as a global temporal representation; the output layer uses a linear activation function with dimensions matching the length of the prediction target. Finally, the prediction results for each component are denormalized one by one and superimposed to reconstruct the PM2.5 concentration prediction value.
[0120] Example:
[0121] The dataset used in this embodiment comes from the UCI Machine Learning Knowledge Base (https: / / archive.ics.uci.edu / ). The air pollution variables in this dataset are: PM2.5 and PM2.5. 10 The meteorological variables are: SO2, NO2, CO, O3; dew point temperature, atmospheric pressure, relative humidity, wind speed, wind direction, and rainfall.
[0122] The whale optimization algorithm parameters were set as follows: population size N=30, maximum number of iterations 10; after experimental testing, the VMD parameter optimization interval was selected as follows: number of modes K∈[2,10], penalty factor α∈[100,1000]. The optimization objective was to minimize the average envelope entropy of all IMFs. This index can effectively characterize the sparsity and information content of signal decomposition; the smaller the entropy value, the better the decomposition effect.
[0123] In each iteration, the current whale individual's corresponding The parameters are substituted into the VMD algorithm to decompose the original PM2.5 sequence; the individual positions are globally updated by simulating whale encirclement predation, bubble web attack, and random search behavior, and finally the optimal parameter combination that minimizes the average envelope entropy is output. In this embodiment, the optimal parameters obtained through WOA optimization are: , The decomposition results are as follows Figure 2 As shown.
[0124] In this embodiment, the input time step of the 1DCNN-CBAM-BiGRU prediction model is set to 15, the prediction step is 1, and the input feature dimension is 12. The model uses a two-layer one-dimensional convolutional structure for local temporal feature extraction. The first convolutional layer is configured with 64 filter kernels of size 3, and the second convolutional layer is configured with 32 filter kernels of size 1. After pooling, the features are adaptively weighted by the CBAM module. The channel reduction ratio of the CBAM module is set to 8, and the convolutional kernel size of the spatial attention branch is 3 to enhance the response of key features.
[0125] Subsequently, the feature sequences are input into two layers of BiGRU to capture long-range temporal dependencies: the first BiGRU layer contains 100 neurons, is configured to return the complete sequence, and applies Dropout regularization with a probability of 0.3; the second BiGRU layer contains 50 neurons. Finally, the prediction result is obtained by mapping through a fully connected linear output layer. During model training, the Adam optimization algorithm is used, with an initial learning rate set to 0.001, the loss function chosen as MSE, a batch size of 128, a maximum training epoch of 100, and an early stopping mechanism introduced to prevent overfitting.
[0126] This embodiment uses root mean square error (RMSE), mean absolute error (MAE), and coefficient of determination (R²). 2 (Perform performance evaluation.)
[0127] Where n is the total number of samples in the test set, ŷᵢ is the predicted PM2.5 concentration for the i-th sample, yᵢ is the corresponding actual observed value, and ȳ is the mean of the actual samples in the test set.
[0128] The RMSE, MAE, and R of the prediction results of the model shown in the embodiments of the present invention and other models 2 As shown in Table 1, the model in this embodiment of the invention performs well in terms of evaluation metrics MAE, RMSE, and R. 2 All of these achieved optimal results. From Figure 3 As can be seen from the distribution characteristics, all the blue scatter points are closely clustered on both sides of the ideal fitting dashed line, with no abnormal samples with large-area discrete deviations, and only a small number of samples have slight deviations.
[0129] Table 1: Comparison of prediction performance between this embodiment and other models
[0130]
[0131] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions.
[0132] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0133] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0134] The above embodiments should be understood as illustrative only and not as limiting the scope of protection of the present invention. After reading the description of the present invention, those skilled in the art can make various alterations or modifications to the present invention, and these equivalent changes and modifications also fall within the scope defined by the claims of the present invention.
Claims
1. A PM2.5 prediction method based on optimized mode decomposition and attention-enhanced temporal networks, characterized in that, Includes the following steps: S1. Acquire historical PM2.5 concentration monitoring data, along with corresponding meteorological data and other pollutant concentration data, to form a multi-source input dataset. Perform missing value imputation, outlier processing, and normalization operations on the dataset. Then, use the Whale Optimization Algorithm (WOA) to adaptively search for the optimal parameters of Variational Mode Decomposition (VMD) to decompose the original PM2.5 concentration sequence into multiple Intrinsic Mode Function (IMF) components. Perform feature fusion of the IMF components with meteorological data and other pollutant concentration data, and construct a standardized time-series input sequence using a fixed-length sliding window. S2, Local Temporal Feature Extraction: The multi-channel temporal input samples constructed in step S1 are input into a one-dimensional convolutional neural network 1DCNN, and the local short-term temporal pattern features of the input samples are extracted through the one-dimensional convolutional neural network. S3, Key Feature Enhancement: Input the local temporal features extracted in step S2 into the convolutional block attention module (CBAM). The CBAM weights the features in the channel dimension and spatial dimension and outputs the enhanced feature vector. S4, Bidirectional long-range temporal dependency feature capture: The weighted feature vector sequence processed in step S3 is input into the bidirectional gated recurrent unit BiGRU, and the bidirectional long-range temporal dependency features of the sequence are captured by the BiGRU and the feature vector is output. S5, Predicted value output: Input the feature vector output in step S4 into the fully connected layer, output the predicted PM2.5 concentration for the next time step through the fully connected layer, and perform inverse normalization on the predicted value.
2. The PM2.5 prediction method based on optimized mode decomposition and attention-enhanced temporal networks according to claim 1, characterized in that, Step S1 specifically includes: S11, Input data: The other pollutant concentration data includes hourly PM2.5 concentrations. 10 Concentration data for SO2, NO2, O3 and CO, including hourly data on temperature, air pressure, relative humidity, wind speed, wind direction and rainfall; S12, Data Preprocessing: The dataset has few missing values and the data trend is stable, so linear interpolation is used to impute them; box plots are used to identify outliers. S13, WOA-VMD decomposition: Using the average envelope entropy of all IMF components obtained from the VMD decomposition of the PM2.5 sequence as the fitness function, the optimal penalty factor for VMD is searched iteratively using WOA. and number of modes The optimal parameters are saved; the optimized VMD is used to decompose the PM2.5 sequence to obtain... IMFs with different center frequencies; S14, Normalization processing: Each IMF component is concatenated with the preprocessed meteorological data and other pollutant concentration data to form a multivariate feature matrix; all features in the multivariate feature matrix are uniformly processed using the Min-Max normalization method to map all feature values to the [0,1] interval; S15, Constructing a standard time series input sequence: A sliding window of fixed length T is used to slice the normalized multivariate time series data, with the window moving forward successively at 1-hour intervals; each sample contains T time steps, and the feature dimension of each time step is (number of IMF components + number of meteorological and pollutant features); the actual PM2.5 concentration of the next time step is used as the prediction label.
3. The PM2.5 prediction method based on optimized mode decomposition and attention-enhanced temporal networks according to claim 1, characterized in that, In step S2, the one-dimensional convolutional neural network sequentially includes a first convolutional layer, a second convolutional layer, and a max-pooling layer. The first convolutional layer employs a causal padding strategy and is configured with a ReLU activation function to extract local temporal features and prevent future information leakage. The second convolutional layer employs a 1×1 convolutional kernel and is configured with a ReLU activation function to perform cross-channel feature fusion and dimensionality compression on the output of the first convolutional layer. The max-pooling layer is used to downsample the output of the second convolutional layer along the time dimension, generate a local feature map, and output it to the CBAM module in step S3.
4. The PM2.5 prediction method based on optimized mode decomposition and attention-enhanced temporal networks according to claim 1, characterized in that, In step S3, the CBAM module receives the local feature map output by the 1DCNN and performs channel and spatial attention operations in sequence. The channel attention submodule performs global average pooling and global max pooling on the input feature map, generates channel weights through a shared multilayer perceptron, and multiplies them with the original feature map. The spatial attention submodule performs average pooling and max pooling on the channel-weighted feature map along the channel dimension and concatenates them. It then generates a spatial weight matrix through spatial convolution and Sigmoid activation, and multiplies it element-wise with the feature map to obtain the enhanced feature vector.
5. The PM2.5 prediction method based on optimized mode decomposition and attention-enhanced temporal networks according to claim 1, characterized in that, In step S4, the BiGRU module adopts a two-layer stacked bidirectional GRU structure, and the output modes of the two layers are different: the first layer of bidirectional GRU is set to return the complete time series mode, outputting the hidden state of each time step to retain the temporal dynamic information, and then connected to the Dropout layer to prevent overfitting; the second layer of bidirectional GRU is set to return only the state mode of the last time step, directly outputting the final feature vector that integrates the bidirectional long-range dependency information of the whole sequence, as the input of the fully connected layer in step S5.
6. The PM2.5 prediction method based on optimized mode decomposition and attention-enhanced temporal networks according to claim 1, characterized in that, Step S5 includes: mapping the final feature vector output in step S4 to the predicted PM2.5 concentration value through a fully connected layer, wherein the output dimension of the fully connected layer is consistent with the predicted target dimension and a linear activation function is used; during the model training phase, the model parameters are updated using the mean squared error as the loss function, while maintaining the original temporal order of the samples; after the prediction is completed, the predicted PM2.5 concentration value is denormalized using the normalization parameters saved in step S1 to obtain the restored predicted PM2.5 concentration result.
7. An electronic device comprising a memory and a processor, the memory storing program code executable by the processor, characterized in that, The processor executes the PM2.5 prediction method based on optimized mode decomposition and attention-enhanced temporal networks as described in any one of claims 1 to 6 by running the program code.
8. A computer-readable storage medium storing computer instructions thereon, characterized in that: When the computer instruction is executed by the processor, it performs a PM2.5 prediction method based on optimized mode decomposition and attention-enhanced temporal network as described in any one of claims 1 to 6.
Citation Information
Patent Citations
PM2.5 concentration prediction method based on VMD-TCN-BiGRU-SA model
CN119692173A