A PM2.5 concentration prediction method
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- YANGTZE DELTA REGION INST (QUZHOU) UNIV OF ELECTRONIC SCI & TECH OF CHINA
- Filing Date
- 2026-05-11
- Publication Date
- 2026-08-04
AI Technical Summary
然而,LSTM网络存在一个显著的缺陷:当模型层数加深或训练过程发生过拟合时,其门控机制可能会异常工作
第一,本申请整体架构的特征在于将残差连接机制嵌入到双向长短期记忆网络中,并在其输出端专门配置一个多层感知机,用于将所提取的深层时序特征与经过相关性筛选的辅助环境变量进行非线性融合后生成预测值。
Smart Images

Figure CN122508044A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of air pollution detection technology, and in particular to a method for predicting PM2.5 concentration. Background Technology
[0002] In recent years, air pollution has received increasing public attention, especially fine particulate matter (PM2.5) with an aerodynamic equivalent diameter of 2.5 micrometers or less. Due to their small size, these particles can penetrate the respiratory tract's defense mechanisms, reaching deep into the alveoli and entering the bloodstream, causing significant damage to the respiratory and cardiovascular systems. Therefore, accurate prediction of PM2.5 concentrations is of significant public health value and environmental management importance for issuing early public health warnings and guiding government departments to implement timely pollution reduction measures.
[0003] PM2.5 concentration variations fall into a typical category of time series forecasting problems. Its formation sources are extremely complex, including anthropogenic sources such as fuel combustion, industrial emissions, and vehicle exhaust, as well as natural sources such as crustal dust and sea salt particles. This complex composition means that PM2.5 concentration variations exhibit both periodicity and seasonality, and often experience drastic fluctuations caused by changes in meteorological conditions or sudden pollution events. These characteristics present a significant challenge to accurately predicting PM2.5 concentrations.
[0004] Currently, existing PM2.5 prediction methods are mainly divided into two categories: methods based on traditional statistics and methods based on deep learning. Each of them has obvious drawbacks.
[0005] The first category is based on traditional statistical methods, such as the Autoregressive Moving Average (ARIMA) model, which mainly extrapolates linearly by analyzing the trends and periodicity of historical PM2.5 sequences (see reference: ZHANG LANYI et al., PM2.5 Prediction Research). The fundamental drawback of this type of method is that its assumptions based on data stationarity and linear relationships make it difficult to capture the strong nonlinear characteristics present in PM2.5 data and the complex interactions between various influencing factors, resulting in limited prediction accuracy.
[0006] The second category, based on deep learning methods, particularly Long Short-Term Memory (LSTM) networks and their variants, is currently the mainstream technology. LSTM effectively alleviates the gradient vanishing problem of traditional Recurrent Neural Networks (RNNs) when processing long sequences by controlling the flow of information through its ingeniously designed forget gate, input gate, and output gate, thus performing excellently in time series prediction (see: Zhao F et al., LSTM-based spatiotemporal prediction model for air quality). However, LSTM networks have a significant drawback: when the number of model layers increases or overfitting occurs during training, its gating mechanism may malfunction. Specifically, an overly strong forget gate may prematurely discard the basic pattern information contained in the input sequence, while an overly sensitive input gate may mix some key features with noisy data. The superposition of these two effects causes the time-series features stored within the network to gradually deviate from the essential patterns of the original data, i.e., the loss of original features occurs. This drawback causes the model to misjudge when identifying long-term dependencies and key change patterns, severely limiting further improvements in predictive ability. Regarding model input, most existing prediction schemes use only a single historical data series of PM2.5 for autoregressive prediction. However, in real-world environments, PM2.5 concentration changes often occur synchronously and in complex coupled with other factors such as inhalable particulate matter (PM10), meteorological conditions, and traffic emissions. Single-variable models cannot capture these concentration abrupt changes caused by the synergistic effects of external factors, thus exhibiting inherent limitations in prediction accuracy.
[0007] In summary, existing technologies have two key problems: First, deep LSTM networks lose original temporal features and suffer long-term degradation in modeling capabilities due to gating overfitting during training; second, existing models rely solely on a single historical data sequence and cannot fully integrate multiple related factors for collaborative prediction, resulting in inaccurate predictions of sudden pollution events.
[0008] Therefore, it is necessary to develop a method for predicting PM2.5 concentration to solve the above problems. Summary of the Invention
[0009] The purpose of this invention is to design a PM2.5 concentration prediction method to solve the above problems.
[0010] The present invention achieves the above objectives through the following technical solutions: A method for predicting PM2.5 concentration includes the following steps: S1. Acquire data and screen auxiliary variables; including: collect hourly air quality monitoring data of the target location, the air quality monitoring data includes PM2.5 concentration data series and at least one auxiliary environmental variable series that affects PM2.5 concentration, calculate the Pearson correlation coefficient between PM2.5 and each auxiliary environmental variable series, and select the auxiliary environmental variable series with the highest correlation coefficient as the primary auxiliary variable; S2. Data preprocessing and sample construction; including: missing value imputation, normalization, and time window slicing; S3. Construct the core prediction model; the core prediction model includes a residual bidirectional long short-term memory module, a feature splicing layer, and a multilayer perceptron fusion and prediction module. S4. Model Training and Application; S5. End and obtain the PM2.5 concentration prediction results.
[0011] Preferably, in step S1, the air quality monitoring data is collected over a period of three years or more.
[0012] Preferably, in step S1, the sequence of auxiliary environmental variables that affect PM2.5 concentration includes PM10, SO2, and NO2, with PM10 being the primary auxiliary variable.
[0013] Specifically, in step S2, Missing value imputation includes: for a missing value, finding the valid data values at the two times before and after it, using the linear trend of these two points over time to estimate the value at the missing time in the middle and then filling it in; Normalization processing includes: using the maximum-minimum normalization method, the calculation formula of which is: new value = (original value - minimum value of the sequence) / (maximum value of the sequence - minimum value of the sequence); where the minimum and maximum values of the sequence are obtained based on global statistics of the entire data sequence, and the sequence is either a PM2.5 concentration data sequence or an auxiliary environmental variable sequence. PM2.5 and auxiliary environmental variables are treated as different sequences, and their respective normalization operations are performed. The time window slicing includes: setting the input time length as T_in hours and the prediction time length as T_out hours. The construction method of a training sample is: extracting all auxiliary environmental variable data in the sequence for consecutive T_in hours as the input features of the model, and using the real PM2.5 concentration records for consecutive T_out hours as the prediction target. When generating the dataset, the time window slides backward in chronological order with a step size of one hour to generate all samples in sequence.
[0014] Specifically, in step S3: Residual bidirectional long short-term memory module: The residual bidirectional long short-term memory module is the basic feature extractor of the entire core prediction model. The residual bidirectional long short-term memory module is used to deeply analyze the historical concentration data sequence of PM2.5 and extract the deep temporal change features containing contextual information. The residual bidirectional long short-term memory module contains at least one bidirectional long short-term memory layer with residual connections. The specific construction and computation process of a single bidirectional long short-term memory layer with residual connections is as follows: First, the bidirectional long short-term memory layer with residual connections receives an input data matrix, the dimensions of which include the number of samples, time step, and number of features. Second, inside the bidirectional long short-term memory layer with residual connections, a forward long short-term memory network and a backward long short-term memory network are run simultaneously. The forward long short-term memory network reads the historical concentration data sequence sequentially from past to future time and extracts forward dependent features. The backward long short-term memory network reads the historical concentration data sequence in reverse order from future to past time and captures inverse potential correlations. Finally, the forward hidden state obtained at each time step is concatenated with the backward hidden state to form the bidirectional hidden state at that moment that incorporates complete contextual information. The bidirectional hidden states at all time steps constitute the original output matrix H_raw of this layer. The residual connection mechanism of the bidirectional long short-term memory layer with residual connections is as follows: The original input matrix X of the bidirectional long short-term memory layer with residual connections is provided with skip connections. The original input matrix X is then fused with the original output matrix H_raw of the bidirectional long short-term memory layer with residual connections to obtain the final output H_out of the bidirectional long short-term memory layer with residual connections. The specific fusion rules are as follows: When the feature dimensions of the original input matrix X are the same as those of the original output matrix H_raw, the element-wise addition operation is directly performed on the original input matrix X and the original output matrix H_raw, that is, H_out = H_raw + X; When the feature dimensions of the original input matrix X are inconsistent with the feature dimensions of the original output matrix H_raw, a fully connected layer is first used to map the feature dimensions of the original input matrix X to be consistent with the dimensions of the original output matrix H_raw. Then, the mapped input features are added element by element to H_raw to obtain the final output H_out. Multiple bidirectional long short-term memory layers with residual connections are stacked according to the problem complexity to form a deep feature extractor. The output of the previous layer will be used as the input of the next layer. After the input data is processed by all bidirectional long short-term memory layers with residual connections, the bidirectional hidden state vector of the last time step of the historical concentration data sequence is extracted. This vector condenses the complete temporal information of the entire input historical concentration data sequence and is denoted as the temporal feature vector F_ts. Feature splicing layer: The temporal feature vector F_ts finally extracted by the residual bidirectional long short-term memory module is concatenated with the normalized auxiliary environmental variable values at the prediction start time in the feature dimension to form a fused feature vector F_concat. Multilayer perceptron fusion and prediction module: The multilayer perceptron fusion and prediction module is used for deep, nonlinear feature interaction and learning, and ultimately generates predicted values. The module includes a multilayer perceptron module and a fully connected output layer. In use, the fused feature vector F_concat generated in the previous step is fed into a multilayer perceptron module. The multilayer perceptron is a feedforward neural network structure composed of multiple fully connected layers stacked sequentially, with a nonlinear activation function inserted between each pair of fully connected layers. This multilayer perceptron module uses multilayer nonlinear transformations to automatically and deeply learn and mine the interaction between historical PM2.5 change patterns and current auxiliary environmental variables, and analyzes the different contributions of various internal and external factors to future PM2.5 concentration changes. The number of neurons in the fully connected output layer is set to be equal to the prediction time length T_out. The fully connected output layer outputs predicted PM2.5 concentration values for the next T_out time steps, and these predicted values are normalized values that have not yet been denormalized.
[0015] Specifically, in step S4, model training and application include: First, the dataset is divided: all samples generated in step S2 are divided into three non-overlapping subsets according to their chronological order: training set, validation set and test set. No random shuffling is allowed. Secondly, training configuration: During the training phase, mean squared error is used as the loss function to measure the difference between the predicted and true values; the adaptive moment estimation optimizer is used as the parameter optimization algorithm, with an initial learning rate of 0.001; the model is trained in batches of 128 samples each time, with a batch size of 128; a complete traversal of the entire dataset is called a training cycle, and the upper limit of the training cycle is set to 20; at the same time, an early stopping mechanism is used to prevent overfitting: after each training cycle, the loss value of the model on the validation set is observed. If the loss value on the validation set does not reach a new low within 3 consecutive training cycles, the training process is immediately terminated, and the model weights that performed best on the validation set are restored as the final training result; Once the model is trained and deployed, it is used to perform predictions. For any time period to be predicted, the PM2.5 and auxiliary environmental variable data of the previous consecutive T_in hours are collected. Missing values are filled in, normalized, and time window sliced in the manner of step S2 to form an input sample. This input sample is fed into the trained model, and the model will forward calculate and output the normalized prediction value of PM2.5 for the next T_out hours. Finally, the normalized predicted values output by the model are subjected to an operation that is completely reversed from the normalization process in step S2, to obtain the actual PM2.5 concentration prediction values with physical meaning and units of μg / m³.
[0016] Preferably, the training set consists of the first 70% of the data, the validation set consists of the middle 10% of the data, and the test set consists of the last 20% of the data.
[0017] The beneficial effects of this invention are: First, the overall architecture of this application is characterized by embedding the residual connection mechanism into a bidirectional long short-term memory network and configuring a multilayer perceptron at its output end, which is used to nonlinearly fuse the extracted deep temporal features with the auxiliary environmental variables that have been filtered for correlation to generate predicted values.
[0018] Second, the specific mechanism of the residual connection in this application is to establish a dimensionally adaptive additive jump connection between the input and output of the bidirectional long short-term memory layer, which forcibly preserves the transmission path for the original low-order features, thus overcoming the feature loss problem caused by LSTM gated overfitting from the network topology level.
[0019] Third, the architecture of this application realizes a layered and decoupled fusion: in the time dimension, the residual bidirectional LSTM itself completes the first fusion of the forward and reverse context of the sequence and the historical residual information; in the feature dimension, the multilayer perceptron performs a second deep cross-fusion of highly abstract temporal features and auxiliary variables with clear physical meaning.
[0020] A comparison of the specific technical methods of this invention with existing traditional LSTM prediction schemes reveals clear and significant differences. In terms of temporal feature extraction, traditional LSTM can only process unidirectionally, inferring the future from past data, while this invention employs a bidirectional structure, simultaneously capturing contextual patterns and obtaining more symmetrical and complete information. Regarding information transmission in deep networks, traditional LSTM relies on gating layers for layer-by-layer transformations, where the original pattern is easily diluted or distorted. This invention introduces residual skip connections, allowing the original pattern to directly reach deep networks, providing structural resistance to over-filtering of information. In terms of multi-factor utilization, traditional schemes typically do not use or input them as ordinary features into the network for black-box processing. This invention first performs scientific correlation coefficient screening, and then, after temporal feature extraction, hands them over to a dedicated perceptron module for focused deep interactive learning, resulting in a clear division of tasks. Ultimately, in terms of overall generalization ability, traditional solutions often rely on general techniques such as dropout to resist overfitting. The residual structure of this invention itself provides a powerful layer of structural regularization for the network, which, together with the early stopping strategy, forms a double guarantee for the robustness of the model.
[0021] Objective experimental results show that, in comparison with many mainstream models, the proposed solution outperforms the other two core indicators, root mean square error (RMSE) and mean absolute error (MAE). In particular, in the long-term prediction task of 48 hours, the error increase is significantly smaller, which strongly demonstrates the excellent ability of the combined architecture to capture long-term dependencies and external mutation factors. Attached Figure Description
[0022] Figure 1 This is a schematic diagram of the method flow of the present invention; Figure 2 This is a schematic diagram of the network structure of the core prediction model in this invention. Detailed Implementation
[0023] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0024] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.
[0025] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0026] In the description of this invention, it should be understood that the terms "upper," "lower," "inner," "outer," "left," "right," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, or the orientation or positional relationship commonly used when the product of this invention is in use, or the orientation or positional relationship commonly understood by those skilled in the art. They are only used to facilitate the description of this invention and to simplify the description, and are not intended to indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this invention.
[0027] Furthermore, the terms "first," "second," etc., are used only to distinguish descriptions and should not be interpreted as indicating or implying relative importance.
[0028] In the description of this invention, it should also be noted that, unless otherwise explicitly specified and limited, terms such as "set" and "connection" should be interpreted broadly. For example, "connection" can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium; it can be a connection within two components. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.
[0029] The specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
[0030] like Figure 1 As shown, a method for predicting PM2.5 concentration includes the following steps: S1. Obtain data and filter auxiliary variables; First, hourly air quality monitoring data for the target location over a relatively long historical period (e.g., three years or more) needs to be collected. The collected data should include at least the PM2.5 concentration sequence, as well as one or more candidate sequences of auxiliary environmental variables that may affect the PM2.5 concentration, such as data on other air pollutants such as inhalable particulate matter (PM10), sulfur dioxide (SO2), and nitrogen dioxide (NO2).
[0031] Next, to scientifically select the most effective auxiliary variables, this invention uses the Pearson correlation coefficient as a metric. By calculating the Pearson correlation coefficient between PM2.5 and each candidate auxiliary variable, the strength of their linear correlation can be quantified. The closer the absolute value of the correlation coefficient is to 1, the stronger the linear relationship. Finally, the variable with the highest absolute value of the correlation coefficient and that passed the significance test is selected as the auxiliary variable formally participating in the predictive model. In a typical embodiment, the calculated Pearson correlation coefficient between PM10 and PM2.5 is as high as 0.94, showing an extremely strong positive correlation, and therefore it was selected as the primary auxiliary variable.
[0032] S2, Data Preprocessing and Sample Construction; Data preprocessing comprises three key sub-steps, which address data quality issues, standardize units, and construct sample structures that can be learned by the model.
[0033] Sub-step 2.1, Missing Value Imputation: Due to instrument malfunctions or other reasons, a small amount of data may be missing in the acquired raw time series data. This invention uses linear interpolation to impute these missing values. Specifically, for a missing value, the valid data values at the two moments before and after it are found. Using the linear trend of these two points over time, the value at the intermediate missing moment is estimated and filled in. This method is suitable for handling small, discontinuous missing values.
[0034] Sub-step 2.2, Normalization: To eliminate the influence of different environmental variables due to differences in units and numerical ranges, and to improve the stability and convergence speed of model training, all data needs to be scaled to a uniform, smaller numerical range, such as [0, 1]. This invention uses the max-min normalization method, and its calculation formula is: New value = (Original value - Minimum value of the sequence) / (Maximum value of the sequence - Minimum value of the sequence). The minimum and maximum values of the sequence are obtained based on global statistics of the entire data sequence. It should be noted that PM2.5 and auxiliary variables are different sequences and should undergo their own normalization operations separately.
[0035] Sub-step 2.3, Time Window Slicing: Time series prediction uses historical data to predict future data, requiring the continuous sequence data to be sliced into supervised learning samples. The input time length is set to T_in hours, and the prediction time length to T_out hours. A training sample is constructed by extracting all variable data from the sequence for consecutive T_in hours as the model's input features, and using the actual PM2.5 concentration records for the following consecutive T_out hours as the prediction target. When generating the dataset, the time window slides sequentially in one-hour increments, generating all samples in turn. As an example, T_in is fixed at 24 hours, while T_out can be set to 1 hour, 4 hours, 12 hours, 24 hours, or 48 hours depending on the needs of the prediction task, to comprehensively evaluate the model's predictive ability across different time spans.
[0036] S3. Construct the core prediction model; construct the complete network structure of the core prediction model, as follows: Figure 2 As shown, in order of data flow, it is organically composed of three parts: "residual bidirectional long short-term memory module", "feature splicing layer" and "multilayer perceptron fusion and prediction module", which will be explained in detail below; Module 3.1: Residual Bidirectional Long Short-Term Memory Module: Its function is to deeply analyze historical PM2.5 concentration data sequences, extracting deep-seated temporal variation features containing contextual information. Simultaneously, its unique structural design effectively avoids feature loss problems in traditional methods. Internally, this module contains at least one bidirectional long short-term memory layer (residual BiLSTM layer) with residual connections. The residual bidirectional long short-term memory module contains at least one bidirectional long short-term memory layer with residual connections. The specific construction and computation process of a single bidirectional long short-term memory layer with residual connections is as follows: First, the bidirectional long short-term memory layer with residual connections receives an input data matrix, the dimensions of which include the number of samples, time step, and number of features. Second, inside the bidirectional long short-term memory layer with residual connections, a forward long short-term memory network and a backward long short-term memory network are run simultaneously. The forward long short-term memory network reads the historical concentration data sequence sequentially from past to future time and extracts forward dependent features. The backward long short-term memory network reads the historical concentration data sequence in reverse order from future to past time and captures inverse potential correlations. Finally, the forward hidden state obtained at each time step is concatenated with the backward hidden state to form the bidirectional hidden state at that moment that incorporates complete contextual information. The bidirectional hidden states at all time steps constitute the original output matrix H_raw of this layer. One of the key innovations of this invention is the introduction of residual connections. The residual connection mechanism of the bidirectional long short-term memory layer with residual connections is as follows: the original input matrix X of the bidirectional long short-term memory layer with residual connections is provided with skip connections; the original input matrix X and the original output matrix H_raw of the bidirectional long short-term memory layer with residual connections are fused to obtain the final output H_out of the bidirectional long short-term memory layer with residual connections. The specific fusion rules are as follows: When the feature dimensions of the original input matrix X are the same as those of the original output matrix H_raw, the element-wise addition operation is directly performed on the original input matrix X and the original output matrix H_raw, that is, H_out = H_raw + X; When the feature dimensions of the original input matrix X and the original output matrix H_raw are inconsistent, a fully connected layer is first used to map the feature dimensions of the original input matrix X to match the dimensions of the original output matrix H_raw. Then, the mapped input features are added element-wise to H_raw to obtain the final output H_out. The design principle of this residual structure is that it opens a fast path for the original input information to go directly to deeper network layers. Even if the gating units in the deep network are biased or overfitted, the original signal from the input will not be easily submerged or covered, thus fundamentally alleviating the feature distortion problem.
[0037] In practical applications, multiple bidirectional long short-term memory layers with residual connections are stacked according to the complexity of the problem to form a deep feature extractor. The output of the previous layer will be used as the input of the next layer. After the input data has been processed by all bidirectional long short-term memory layers with residual connections, the bidirectional hidden state vector of the last time step of the historical concentration data sequence is extracted. This vector condenses the complete temporal information of the entire input historical concentration data sequence and is denoted as the temporal feature vector F_ts. Module 3.2: Feature Concatenation Layer The purpose of this module is to achieve the initial convergence of two types of information: "self-evolutionary patterns" and "external environmental conditions." The specific operation is very simple and direct: the time-series feature vector F_ts extracted by the residual bidirectional long short-term memory module is concatenated with the normalized auxiliary environmental variable value (such as the PM10 concentration value at that moment) at the prediction start time along the feature dimension to form a fused feature vector F_concat; Module 3.3: Multilayer Perceptron Fusion and Prediction Module: The multilayer perceptron fusion and prediction module is used for deep, non-linear feature interaction and learning, ultimately generating predicted values. This module consists of a multilayer perceptron module and a fully connected output layer (the last layer of this module is a fully connected output layer). In use, the fused feature vector F_concat generated in the previous step is fed into a multilayer perceptron module. The multilayer perceptron is a classic feedforward neural network structure, composed of multiple fully connected layers stacked sequentially. Between each pair of fully connected layers, a non-linear activation function, such as the rectified linear function (ReLU), is typically inserted to enhance the signal strength. The network's nonlinear fitting capability; this multilayer perceptron module uses multilayer nonlinear transformations to automatically and deeply learn and mine the interaction between historical PM2.5 change patterns (expressed by F_ts) and current auxiliary environmental variables (concatenated auxiliary variable values), and analyze the different contributions of various internal and external factors to future PM2.5 concentration changes; the number of neurons in the fully connected output layer is set to be equal to the prediction time length T_out, and the fully connected output layer outputs the predicted PM2.5 concentration values for the next T_out time steps, and these predicted values are normalized values that have not yet been denormalized.
[0038] S4. Model Training and Application; This step involves training and deploying the model and applying it in actual predictions; First, the dataset is divided: In order to prevent future information leakage, all samples generated in step S2 are divided into three non-overlapping subsets according to the time sequence: training set (the first 70% of the data), validation set (the middle 10% of the data), and test set (the last 20% of the data). Any random shuffling is strictly prohibited. Secondly, training configuration: During the training phase, mean squared error (MSE) is used as the loss function to measure the difference between the predicted and true values; the adaptive moment estimator optimizer (Adam) is used as the parameter optimization algorithm, with an initial learning rate of 0.001; the model is trained in batches of 128 samples each time, with a batch size of 128; a complete traversal of the entire dataset is called a training cycle, and the upper limit of the training cycle is set to 20; at the same time, in order to further prevent overfitting, an early stopping mechanism is adopted: after each training cycle, the loss value of the model on the validation set is observed. If the loss value on the validation set does not reach a new low within 3 consecutive training cycles, the training process is immediately terminated, and the model weights that performed best on the validation set are restored as the final training result; Once the model is trained and deployed, it is used to perform predictions. For any time period to be predicted, the PM2.5 and auxiliary environmental variable data of the previous consecutive T_in hours are collected. Missing values are filled in, normalized, and time window sliced in the manner of step S2 to form an input sample. This input sample is fed into the trained model, and the model will forward calculate and output the normalized prediction value of PM2.5 for the next T_out hours. Finally, the normalized predicted values output by the model are subjected to an operation that is completely reversed from the normalization process in step S2 (i.e., inverse normalization) to obtain the actual PM2.5 concentration prediction values with physical meaning and units of μg / m³ (micrograms per cubic meter).
[0039] S5. End and obtain the PM2.5 concentration prediction results.
[0040] Example: PM2.5 Concentration Prediction in Chengdu, Sichuan Data Source and Variable Selection: The dataset used in this embodiment comes from the China Meteorological Data Network, collecting hourly air quality monitoring data for Chengdu, Sichuan Province, from January 1, 2019 to December 31, 2022, a total of four years. After calculating the Pearson correlation between PM2.5 and other pollutants such as PM10, SO2, and NO2, PM10 showed the highest correlation coefficient of 0.94. Therefore, PM10 was selected as the sole auxiliary predictor variable in this embodiment.
[0041] Model Structure and Training Details (for easy reproduction): The model is constructed according to step 3 of this invention, with the following specific settings: A two-layer stacked residual bidirectional LSTM is constructed, with 64 hidden units in each layer. In the first layer, the input is 1-dimensional PM2.5 data, which is processed by the bidirectional LSTM to obtain a 128-dimensional concatenated hidden output. Since the input and output dimensions are different, a fully connected layer is used to map the 1-dimensional input to 128 dimensions before adding it to the hidden output. In the second layer, since the input is already 128-dimensional, no mapping is needed when adding it to the 128-dimensional output; they are added directly. The subsequent multilayer perceptron module contains a hidden layer with 32 neurons (using ReLU activation function) and a linear output layer that directly outputs the predicted value. The input duration is fixed at 24 hours, and the prediction duration is set to 1, 4, 12, 24, and 48 hours respectively. The training process uses the mean squared error loss function and the Adam optimizer, with an initial learning rate of 0.001, a batch size of 128, and an early stopping mechanism with a tolerance of 3 training epochs.
[0042] Model Comparison and Evaluation Metrics: To verify the advancement of the models, four benchmark models were selected for comparison: basic RNN, standard LSTM, convolutional LSTM (CNN-LSTM), and Transformer. All models were trained and tested on the same dataset and with the same partitioning method. Root mean square error (RMSE) and mean absolute error (MAE) were used as evaluation metrics, with units of micrograms per cubic meter.
[0043] Comparison of experimental results (test set): The table below shows the performance of all models at different prediction durations.
[0044]
[0045] The experimental results clearly show that the proposed solution achieves the lowest RMSE and MAE values among all models across all prediction durations (from 1 hour to 48 hours), demonstrating the highest prediction accuracy. This advantage is particularly pronounced in long-term predictions of 48 hours, verifying the robustness of the proposed solution in handling long-term dependency issues.
[0046] Ablation experiment (to verify the contribution of each component): To further verify the effectiveness of the key components (residual structure and bidirectional structure) in this invention, ablation experiments were designed. Two variant models were set up: ① "Residual structure removed," where the residual bidirectional LSTM module in the model was replaced with a regular bidirectional LSTM without residual connections; ② "Bidirectional structure removed," where the residual bidirectional LSTM module was replaced with a regular unidirectional residual LSTM module. Each variant was retrained and tested under the same settings, and the results are shown in the table below.
[0047]
[0048] Data from ablation experiments show that the "invention" row, representing the complete scheme, outperforms the two variant models on the vast majority of prediction metrics. Removing either the residual structure or the bidirectional structure leads to an overall decrease in model prediction performance. This conclusion strongly demonstrates that the residual connection mechanism and bidirectional temporal modeling capability in the invention scheme are indispensable components of its superior performance; their synergistic effect results in a significant improvement in model performance.
[0049] The above are merely preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the technical principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method for predicting PM2.5 concentration, characterized in that, Including the following steps: S1. Acquire data and screen auxiliary variables; including: collect hourly air quality monitoring data of the target location, the air quality monitoring data includes PM2.5 concentration data series and at least one auxiliary environmental variable series that affects PM2.5 concentration, calculate the Pearson correlation coefficient between PM2.5 and each auxiliary environmental variable series, and select the auxiliary environmental variable series with the highest correlation coefficient as the primary auxiliary variable; S2. Data preprocessing and sample construction; including: missing value imputation, normalization, and time window slicing; S3. Construct the core prediction model; the core prediction model includes a residual bidirectional long short-term memory module, a feature splicing layer, and a multilayer perceptron fusion and prediction module. S4. Model Training and Application; S5, End, and obtain the PM2.5 concentration prediction results.
2. The PM2.5 concentration prediction method according to claim 1, characterized in that, In step S1, the air quality monitoring data was collected over a period of three years or more.
3. The PM2.5 concentration prediction method according to claim 1, characterized in that, In step S1, the sequence of auxiliary environmental variables that affect PM2.5 concentration includes PM10, SO2, and NO2, with PM10 being the primary auxiliary variable.
4. The PM2.5 concentration prediction method according to claim 1, characterized in that, In step S2, Missing value imputation includes: for a missing value, finding the valid data values at the two times before and after it, using the linear trend of these two points over time to estimate the value at the missing time in the middle and then filling it in; Normalization processing includes: using the maximum-minimum normalization method, the calculation formula of which is: new value = (original value - minimum value of the sequence) / (maximum value of the sequence - minimum value of the sequence); where the minimum and maximum values of the sequence are obtained based on global statistics of the entire data sequence, and the sequence is either a PM2.5 concentration data sequence or an auxiliary environmental variable sequence. PM2.5 and auxiliary environmental variables are treated as different sequences, and their respective normalization operations are performed. The time window slicing includes: setting the input time length as T_in hours and the prediction time length as T_out hours. The construction method of a training sample is: extracting all auxiliary environmental variable data in the sequence for consecutive T_in hours as the input features of the model, and using the real PM2.5 concentration records for consecutive T_out hours as the prediction target. When generating the dataset, the time window slides backward in chronological order with a step size of one hour to generate all samples in sequence.
5. The PM2.5 concentration prediction method according to claim 4, characterized in that, In step S3: Residual bidirectional long short-term memory module: The residual bidirectional long short-term memory module is the basic feature extractor of the entire core prediction model. The residual bidirectional long short-term memory module is used to deeply analyze the historical concentration data sequence of PM2.5 and extract the deep temporal change features containing contextual information. The residual bidirectional long short-term memory module contains at least one bidirectional long short-term memory layer with residual connections. The specific construction and computation process of a single bidirectional long short-term memory layer with residual connections is as follows: First, the bidirectional long short-term memory layer with residual connections receives an input data matrix, the dimensions of which include the number of samples, time step, and number of features. Second, inside the bidirectional long short-term memory layer with residual connections, a forward long short-term memory network and a backward long short-term memory network are run simultaneously. The forward long short-term memory network reads the historical concentration data sequence sequentially from past to future time and extracts forward dependent features. The backward long short-term memory network reads the historical concentration data sequence in reverse order from future to past time and captures inverse potential correlations. Finally, the forward hidden state obtained at each time step is concatenated with the backward hidden state to form the bidirectional hidden state at that moment that incorporates complete contextual information. The bidirectional hidden states at all time steps constitute the original output matrix H_raw of this layer. The residual connection mechanism of the bidirectional long short-term memory layer with residual connections is as follows: The original input matrix X of the bidirectional long short-term memory layer with residual connections is provided with skip connections. The original input matrix X is then fused with the original output matrix H_raw of the bidirectional long short-term memory layer with residual connections to obtain the final output H_out of the bidirectional long short-term memory layer with residual connections. The specific fusion rules are as follows: When the feature dimensions of the original input matrix X are the same as those of the original output matrix H_raw, the element-wise addition operation is directly performed on the original input matrix X and the original output matrix H_raw, that is, H_out = H_raw + X; When the feature dimensions of the original input matrix X are inconsistent with the feature dimensions of the original output matrix H_raw, a fully connected layer is first used to map the feature dimensions of the original input matrix X to be consistent with the dimensions of the original output matrix H_raw. Then, the mapped input features are added element by element to H_raw to obtain the final output H_out. Multiple bidirectional long short-term memory layers with residual connections are stacked according to the problem complexity to form a deep feature extractor. The output of the previous layer will be used as the input of the next layer. After the input data is processed by all bidirectional long short-term memory layers with residual connections, the bidirectional hidden state vector of the last time step of the historical concentration data sequence is extracted. This vector condenses the complete temporal information of the entire input historical concentration data sequence and is denoted as the temporal feature vector F_ts. Feature splicing layer: The temporal feature vector F_ts finally extracted by the residual bidirectional long short-term memory module is concatenated with the normalized auxiliary environmental variable values at the prediction start time in the feature dimension to form a fused feature vector F_concat. Multilayer perceptron fusion and prediction module: The multilayer perceptron fusion and prediction module is used for deep, nonlinear feature interaction and learning, and ultimately generates predicted values. The module includes a multilayer perceptron module and a fully connected output layer. In use, the fused feature vector F_concat generated in the previous step is fed into a multilayer perceptron module. The multilayer perceptron is a feedforward neural network structure composed of multiple fully connected layers stacked sequentially, with a nonlinear activation function inserted between each pair of fully connected layers. This multilayer perceptron module uses multilayer nonlinear transformations to automatically and deeply learn and mine the interaction between historical PM2.5 change patterns and current auxiliary environmental variables, and analyzes the different contributions of various internal and external factors to future PM2.5 concentration changes. The number of neurons in the fully connected output layer is set to be equal to the prediction time length T_out. The fully connected output layer outputs predicted PM2.5 concentration values for the next T_out time steps, and these predicted values are normalized values that have not yet been denormalized.
6. The PM2.5 concentration prediction method according to claim 5, characterized in that, In step S4, model training and application include: First, the dataset is divided: all samples generated in step S2 are divided into three non-overlapping subsets according to their chronological order: training set, validation set and test set. No random shuffling is allowed. Secondly, training configuration: During the training phase, mean squared error is used as the loss function to measure the difference between the predicted and true values; the adaptive moment estimation optimizer is used as the parameter optimization algorithm, with an initial learning rate of 0.001; the model is trained in batches of 128 samples each time, with a batch size of 128; a complete traversal of the entire dataset is called a training cycle, and the upper limit of the training cycle is set to 20; at the same time, an early stopping mechanism is used to prevent overfitting: after each training cycle, the loss value of the model on the validation set is observed. If the loss value on the validation set does not reach a new low within 3 consecutive training cycles, the training process is immediately terminated, and the model weights that performed best on the validation set are restored as the final training result; Once the model is trained and deployed, it is used to perform predictions. For any time period to be predicted, the PM2.5 and auxiliary environmental variable data of the previous consecutive T_in hours are collected. Missing values are filled in, normalized, and time window sliced in the manner of step S2 to form an input sample. This input sample is fed into the trained model, and the model will forward calculate and output the normalized prediction value of PM2.5 for the next T_out hours. Finally, the normalized predicted values output by the model are subjected to an operation that is completely reversed from the normalization process in step S2, to obtain the actual PM2.5 concentration prediction values with physical meaning and units of μg / m³.
7. The PM2.5 concentration prediction method according to claim 6, characterized in that, The training set uses the first 70% of the data, the validation set uses the middle 10% of the data, and the test set uses the last 20% of the data.