PM2.5 pollution prediction method and device based on causal enhanced spatio-temporal attention mechanism
The PM2.5 pollution prediction method based on the causal-enhanced spatiotemporal attention mechanism utilizes multi-source data and counterfactual sample generation strategies to construct a causal-enhanced graph structure and a deep network. This solves the problems of insufficient accuracy and ambiguous decision-making basis in existing technologies for PM2.5 pollution prediction, and achieves efficient and intelligent PM2.5 concentration prediction and decision support.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-28
- Publication Date
- 2026-06-23
Smart Images

Figure CN122266526A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent environmental monitoring technology, and in particular to a PM2.5 pollution prediction method and device based on a causal enhanced spatiotemporal attention mechanism. Background Technology
[0002] Current efforts to control PM2.5 pollution face two major challenges: insufficient prediction accuracy and ambiguous decision-making basis. In particular, PM2.5 concentration changes are not only influenced by emission sources but also exhibit complex nonlinear relationships with continuous meteorological variables such as humidity and temperature. On the one hand, within a certain humidity range, the hygroscopic growth effect of aerosols leads to an increase in particulate matter size, causing a nonlinear jump in monitored concentrations. On the other hand, when humidity further increases or reaches saturation, it is often accompanied by a wet deposition removal effect due to precipitation or condensation, which in turn causes a sharp decrease in PM2.5 concentration. This inverted U-shaped physical characteristic of "rising first and then falling" varies greatly across different seasons and regions. Traditional PM2.5 concentration prediction models are often based on fixed empirical thresholds or simple linear assumptions, making it difficult to identify these characteristics and resulting in low prediction accuracy under complex weather conditions such as high humidity. Although the physical and chemical model is based on atmospheric physical equations and has strong interpretability, it has high computational complexity. A single 72-hour prediction requires a 64-core server to run for more than 8 hours, which cannot meet the needs of real-time early warning. Furthermore, the parameterization scheme for continuous variables such as humidity relies on expert experience and is difficult to adapt to regional climate characteristics.
[0003] Urban air pollution prediction technology based on machine learning algorithms primarily relies on pattern recognition and learning from data. By training the algorithm on data, it can effectively identify air pollutants and predict air quality. This method does not depend on prior physical models, allowing for faster training, deployment, and prediction. Utilizing machine learning algorithms, and even deep learning, to predict air pollutant concentrations—for example, employing advanced architectures such as graph attention mechanisms and spatiotemporal graph convolutional networks to capture the complex spatial dependencies of air pollutants between monitoring stations—can significantly improve the accuracy of PM2.5 concentration predictions. However, these models are essentially still "black boxes." While they can accurately predict PM2.5 concentrations, they cannot clearly answer key decision-making questions such as "why this prediction was made" and "how and to what extent key driving factors influence PM2.5 levels."
[0004] Causal inference methods can identify causal relationships between variables. However, most existing causal inference methods, when applied to the environmental field, typically focus on dealing with discrete pollution sources or events, and cannot handle continuous environmental variables such as humidity. This leads to difficulties in accurately quantifying their nonlinear causal effects on PM2.5 across the entire concentration range. Simply treating such continuous environmental variables as linear variables or discretizing them will result in the loss of significant information and may lead to erroneous causal conclusions. Summary of the Invention
[0005] The technical problem to be solved by this invention is: in view of the technical problems existing in the prior art, this invention provides a PM2.5 pollution prediction method and device based on causal enhanced spatiotemporal attention mechanism that is simple to implement, low in cost, highly accurate and efficient in prediction, and intelligent.
[0006] To solve the above-mentioned technical problems, the technical solution proposed by this invention is as follows: A PM2.5 pollution prediction method based on a causal enhanced spatiotemporal attention mechanism, comprising the following steps: Step S01. Multi-source data acquisition: Acquire multi-source data from multiple monitoring stations as raw samples. The multi-source data includes PM2.5 concentration data, meteorological data, and geographic static features. The meteorological data includes humidity. Step S02. Causal Enhancement Graph Structure Construction: Calculate the transfer entropy between each monitoring station based on the PM2.5 concentration data of each monitoring station and use it as the corresponding causal strength between each monitoring station. Construct causal enhancement fusion weights based on the spatial weights between each monitoring station and the causal strengths. The spatial weights between each monitoring station are calculated based on the spatial distance between each monitoring station. Step S03. Prediction Model Construction: A prediction model is constructed based on a deep network with an encoder-decoder architecture. In the encoder-decoder architecture, a causal-guided spatial attention layer and a physically adaptive temporal attention unit are integrated to dynamically capture spatiotemporal dependencies. In the causal-guided spatial attention layer, the causal-enhanced fusion weights are fused into the unnormalized attention scores corresponding to the original attention coefficients, and Softmax normalization is performed on the fused unnormalized attention scores to obtain attention weights. The physically adaptive temporal attention unit uses a physical attenuation gate to correct the historical hidden state. The input of the prediction model is the original sample, and the output is the predicted value of PM2.5 concentration. Step S04. Counterfactual sample generation: The acquired humidity data is perturbed and filtered according to geographic static features to form counterfactual samples. The original samples and the counterfactual samples are combined to form counterfactual sample pairs. A training dataset is constructed based on the counterfactual sample pairs to train the prediction model. Step S05. Intelligent decision control: Input the real-time acquired sample data into the trained prediction model to obtain the predicted PM2.5 concentration value, calculate the real-time sensitivity of the predicted PM2.5 concentration value to humidity, and output the corresponding decision command based on the predicted PM2.5 concentration value and the real-time sensitivity.
[0007] Furthermore, the meteorological data also includes any one or more continuous variables among temperature, wind speed, and air pressure; the geographic static features include latitude and longitude coordinates and altitude; and the multi-source data also includes land feature vectors, which are obtained by compressing and fusing semantic information of land use types within a specified range around the corresponding monitoring station.
[0008] Furthermore, step S01 also includes standardizing and aligning the PM2.5 concentration data with the meteorological feature vector, the steps of which include: If the meteorological data comes from a monitoring dataset, the PM2.5 concentration data will be matched with the meteorological data at the same time after the acquired meteorological data is time-converted. If the meteorological data comes from meteorological stations, the Euclidean distance between each PM2.5 monitoring station and all meteorological stations is calculated; the meteorological station with the smallest Euclidean distance is selected as the matching source, and a mapping relationship between PM2.5 concentration data and meteorological data is established.
[0009] Further, step S01 also includes obtaining the dependency curve between humidity and SHAP value, and determining the effect onset threshold and adaptive physical inflection point based on the dependency curve between humidity and SHAP value, wherein the effect onset threshold... The humidity value corresponding to the transition from the linear stationary region to the gradient enhancement region of the dependency curve, the adaptive physical inflection point. The humidity value corresponding to the change from positive to negative of the derivative of the dependency curve; based on the effect onset threshold. and the adaptive physical inflection point Construct a dynamic mapping function, the dynamic mapping function The expression is:
[0010] In the formula, This is the moisture absorption growth gain coefficient. This is the wet settlement attenuation coefficient. This corresponds to the linear stationary region. This corresponds to the gradient enhancement region. This corresponds to the gradient inversion region.
[0011] Further, step S02 includes: The transfer entropy between each monitoring station is calculated according to the following formula and used as the corresponding causal strength between each monitoring station:
[0012] in, This represents a historical state sequence with a time length of k, where i and j represent the monitoring station numbers, respectively. Causality strength Normalized causality strength is obtained after normalization. ; Based on spatial weight and the normalized causality strength The causal reinforcement fusion weights are obtained: ,in For causal enhancement coefficients, spatial weights For Haversine distance Calculated.
[0013] Further, in step S03, the calculation expression for the attention weights in the causal-guided spatial attention layer is:
[0014] in, Indicates monitoring stations With monitoring stations Attention weights between them Indicates monitoring stations With monitoring stations Attention coefficient between them , It is a linear activation function. Let be the learnable weight vector of a single-layer feedforward neural network, where || denotes vector concatenation and T denotes transpose. The weight matrix is a linear transformation matrix. Monitoring stations With monitoring stations The feature set, Represents a node The set of neighboring nodes, For monitoring sites With monitoring stations The causal enhancement fusion weights between them.
[0015] Furthermore, in step S03, a physical decay gate is used in the physically adaptive temporal attention unit. Correcting the hidden history status Among them, physical attenuation gate The calculation expression is:
[0016] in: Based on the attenuation rate, This is a physical violation mask, assuming the current humidity level is [not specified]. Compared to the previous moment If the mutation exceeds a preset threshold and there is no precipitation record, then =1, otherwise 0; Revised state update formula:
[0017] In the formula, Candidate state: , Simultaneously, calculate the update gate. To control the fusion ratio of new and old information:
[0018] in It is the Sigmoid activation function. and These are the corresponding weights and bias parameters.
[0019] Further, in step S04, the prediction model is trained based on the counterfactual sample pairs using a hybrid loss function that includes counterfactual gradient consistency and physical monotonicity penalties. The expression for the hybrid loss function is:
[0020]
[0021]
[0022] in, Indicates the prediction error. The counterfactual consistency loss is used to constrain the model's sensitivity to humidity so that it approximates the physical reality. and For balance coefficient, It is the upper limit of the maximum allowed physical gradient. This represents the prediction gradient calculated based on the predicted values corresponding to the original samples and counterfactual samples, used to characterize the response gradient of the model's predicted values to changes in humidity; This represents the predicted PM2.5 concentration corresponding to the counterfactual sample. This represents the predicted PM2.5 concentration corresponding to the original sample. This represents the humidity values in the counterfactual sample; This indicates the humidity value in the original sample. This represents a physical monotonicity penalty. This indicates the precipitation code; if precipitation is recorded at the current time, then... Otherwise, it is 1.
[0023] Further, in step S05, the decision instruction output based on the predicted PM2.5 concentration and the real-time sensitivity includes: If the predicted PM2.5 concentration is less than the preset concentration threshold, it is determined to be in a normal state, and a normal monitoring and control command is sent. If the predicted PM2.5 concentration is greater than the preset concentration threshold and the real-time sensitivity is less than the preset first sensitivity threshold, then it is determined that the current pollution is dominated by emission sources, and a control command requiring emission reduction is sent. If the predicted PM2.5 concentration is greater than the preset concentration threshold, and the real-time sensitivity is between the first preset sensitivity threshold and the second preset sensitivity threshold, then it is determined that the current pollution is due to the combined effect of meteorological conditions and emission sources, and a corresponding control command to adjust the emission source is sent, wherein the first preset sensitivity threshold is less than the second preset sensitivity threshold. If the predicted PM2.5 concentration is greater than the preset concentration threshold, and the real-time sensitivity is greater than the second preset sensitivity threshold, then it is determined that the current atmosphere is in a period of explosive hygroscopic growth, and a hygroscopic warning command is sent.
[0024] An electronic device includes a processor and a memory, the memory being used to store a computer program, and the processor being used to execute the computer program to perform the method described above.
[0025] Compared with the prior art, the beneficial effects of the present invention are as follows: 1. This invention calculates the causal strength between monitoring stations by utilizing the transfer entropy between monitoring stations, and combines it with spatial weights based on spatial distance to form a causal-enhanced fusion weight. The causal-enhanced fusion weight is then used for spatial attention calculation, which helps to improve the ability to characterize the spatiotemporal correlation between monitoring stations, thereby improving the accuracy and interpretability of PM2.5 concentration prediction.
[0026] 2. This invention integrates a causal-guided spatial attention layer and a physically adaptive temporal attention unit in the encoder-decoder architecture, enabling dynamic capture of the spatiotemporal dependencies between monitoring stations. Simultaneously, by combining a counterfactual sample generation strategy, controlled perturbation of humidity features and filtering with physical constraints are used to construct counterfactual sample pairs to train the prediction model. This helps enhance the model's ability to characterize the nonlinear effects of continuous meteorological variables such as humidity, and improves the model's robustness and decision support capabilities under complex meteorological conditions. Attached Figure Description
[0027] Figure 1This is a schematic diagram illustrating the implementation process of the PM2.5 pollution prediction method based on the causal enhanced spatiotemporal attention mechanism in this embodiment.
[0028] Figure 2 This is a schematic diagram of the system structure principle for PM2.5 pollution prediction based on the causal enhanced spatiotemporal attention mechanism in this embodiment. Detailed Implementation
[0029] The present invention will be further described below with reference to the accompanying drawings and specific preferred embodiments, but this does not limit the scope of protection of the present invention.
[0030] As disclosed in this invention, unless the context clearly indicates otherwise, words such as "a," "an," "an," and / or "the" do not specifically refer to the singular and may also include the plural. The terms "first," "second," and similar terms used in this invention disclosure do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Similarly, words such as "comprising" or "including" mean that the element or object preceding the word encompasses the elements or objects listed after the word and their equivalents, without excluding other elements or objects. Words such as "connected" or "linked" are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect.
[0031] like Figure 1 As shown, the steps of the PM2.5 pollution prediction method based on the causal enhanced spatiotemporal attention mechanism in this embodiment include: Step S01. Multi-source data acquisition: Acquire multi-source data from multiple monitoring stations as raw samples. Multi-source data includes PM2.5 concentration data, meteorological data, and geographic static features, etc. Meteorological data includes humidity.
[0032] In this embodiment, multi-source data, including PM2.5 concentration data, meteorological data, and geographic static features from multiple monitoring stations, are acquired as the raw sample. Optionally, the meteorological data includes not only humidity but also continuous variables such as temperature, wind speed, and air pressure (Pa), while the geographic static features include latitude and longitude coordinates and altitude.
[0033] Optionally, the multi-source data may also include land feature vectors, which are obtained by compressing and fusing semantic information of land use types within a specified range around the corresponding monitoring station.
[0034] Specifically, the original dataset is first defined as follows: Among them, air quality data An hourly PM2.5 concentration sequence comprising N monitoring stations is denoted as... and , For time steps, the unit is uniformly set as follows: Meteorological data Including meteorological feature vectors of the corresponding stations , For feature dimensions, meteorological feature vectors Features include relative humidity (Rh), temperature (Tmp), wind speed (Ws), and air pressure (Pa). Geographic static features. Includes the latitude and longitude coordinates of the station ( ),altitude Simultaneously, land use data within a 1km radius of the site is acquired and divided into K categories (e.g., industrial, transportation, residential, forest). Each category is then mapped to an embedding vector using Word2Vec or a lookup table method. Finally, the land feature vector of the site is obtained through average pooling. This land feature vector serves as a static underlying surface representation of the monitoring station, describing the differences in land use structures such as industry, transportation, residence, and forest around the station. It is combined with the PM2.5 concentration characteristics, meteorological characteristics, and geographical static characteristics of the corresponding station to form the station input features, thereby characterizing the long-term impact of different land use backgrounds on the local pollution generation, diffusion, and accumulation processes.
[0035] Optionally, after acquiring multi-source data, the process also includes standardizing and aligning PM2.5 concentration data with meteorological data according to the meteorological data source type. The steps include: (1) If the meteorological data comes from the monitoring dataset, the PM2.5 concentration data is matched with the meteorological data at the same time after the acquired meteorological data is converted to time. For example, if the meteorological data comes from the ERA5 dataset, the PM2.5 monitoring data is matched with the meteorological data at the same time after the time conversion is performed, with the hour as the reference.
[0036] (2) If the meteorological data comes from meteorological stations, calculate the Euclidean distance between each PM2.5 monitoring station and all meteorological stations; select the meteorological station with the smallest Euclidean distance as the matching source, establish the mapping relationship between PM2.5 concentration data and meteorological data, and avoid the introduction of human error by interpolation.
[0037] For example, for each PM2.5 monitoring station The following formula can be used to calculate the relationship between all meteorological stations. Euclidean distance : (1) Then select to make The smallest weather station serves as the matching source, directly establishing a mapping relationship.
[0038] Traditional prediction models based on fixed empirical thresholds or simple linear assumptions, when applied to PM2.5 prediction, struggle to dynamically capture the critical inflection point transitioning from "hygroscopic growth" to "wet deposition and removal," leading to severe distortion in prediction accuracy under complex, high-humidity weather conditions. As a preferred implementation, after acquiring multi-source data, this method further includes obtaining the dependency curve between humidity and SHAP values, and determining the effect initiation threshold h_start and the adaptive physical inflection point h_peak based on this curve. The effect initiation threshold h_start characterizes the starting point where the influence of humidity on PM2.5 concentration begins to significantly increase, while the adaptive physical inflection point h_peak characterizes the turning point where the influence of humidity on PM2.5 concentration reverses from increasing to decreasing. A dynamic mapping function is constructed based on the effect initiation threshold h_start and the adaptive physical inflection point h_peak to map the humidity data in the original samples into feature values containing physical gradients, thus fully preserving the specific physical threshold characteristics of the relative humidity data.
[0039] For example, the following dynamic mapping function can be used. Humidity data Perform mapping: (2) In the formula, This is the moisture absorption growth gain coefficient. This is the wet settlement attenuation coefficient. This corresponds to the linear stationary region. This corresponds to the gradient enhancement region. This corresponds to the gradient inversion region.
[0040] Specifically, this embodiment constructs a dependency curve between humidity and SHAP value, identifies the critical point where the derivative of the curve turns from positive to negative, and determines this critical point as an adaptive physical inflection point. This enables the identification of the critical point of transition from "hygroscopic growth" to "wet deposition and removal". Based on this adaptive physical inflection point, a humidity dynamic mapping function is further constructed, enabling the model to distinguish between the enhancement stage and the reversal stage of the influence of humidity on PM2.5 concentration, thereby realizing the modeling of this critical change process.
[0041] In a specific application embodiment, a tree-based benchmark predictor can be constructed using historical training data. The marginal contribution of humidity characteristics of each sample in the test set to the predicted PM2.5 value is calculated, i.e., the SHAP value is obtained. The "humidity-SHAP value" dependency curve is plotted, and the scatter points are smoothed by local weighted regression. The critical point where the derivative of the curve turns from positive to negative is identified and marked as the adaptive physics inflection point. In other words, the adaptive physics inflection point is the humidity value corresponding to the time when the derivative of the "humidity-SHAP value" dependency curve turns from positive to negative, and the humidity value corresponding to the time when the positive contribution of humidity to the predicted PM2.5 value begins to appear significantly in the smoothed "humidity-SHAP value" dependency curve is used to obtain the effect threshold. The threshold for this effect to take effect. Used to determine the boundary between the linear stationary region and the gradient enhancement region, adaptive physical inflection point. This is used to determine the boundary between the gradient enhancement region and the gradient reversal region. Specifically, the effect activation threshold is less than the adaptive physics inflection point. Then, a dynamic mapping function is constructed based on the identified physical parameters. , original humidity Mapped to eigenvalues containing physical gradients .
[0042] Optionally, PM2.5 concentration and meteorological continuous variables other than humidity in the multi-source data can be standardized to eliminate the influence of different physical dimensions on the model gradient descent. For example, Z-Score standardization can be performed according to the following formula: (3) in, The original data, and These are the mean and standard deviation of the feature on the training set, respectively.
[0043] Optionally, to capture diurnal and seasonal variations, the method also includes performing a sine / cosine transformation on the linear timestamp t to achieve a periodic mapping of time characteristics. For example, time can be transformed using the following formulas: (4) (5) The above transformation results are then combined to obtain the time feature vector: The temporal feature vector can characterize the diurnal and seasonal periodicity of PM2.5 concentration changes. In this embodiment, the temporal feature vector, together with the PM2.5 concentration features, meteorological features, geographic static features, and land feature vectors at the corresponding time, constitute the station input feature set, which is then provided to the subsequent spatial attention layer and temporal modeling unit.
[0044] Step S02. Construction of Causal Enhancement Graph Structure: Calculate the transfer entropy between each monitoring station based on the PM2.5 concentration data of each monitoring station and use it as the corresponding causal strength between each monitoring station. Construct fusion weights for causal enhancement based on the spatial weights between each monitoring station and the causal strength. The spatial weights between each monitoring station are calculated based on the spatial distance between each monitoring station.
[0045] In this embodiment, by utilizing the transfer entropy between monitoring stations to calculate the causal strength between each monitoring station, the nonlinear causal relationship between each monitoring station can be fully explored. Furthermore, by combining spatial weights based on spatial distance with causal strength, a causal enhancement fusion weight can be formed. Alternatively, the propagation entropy between each monitoring station can be calculated according to the following formula and used as the corresponding causal strength between each monitoring station: (6) in, This represents a historical state sequence of length k, specifically the historical PM2.5 concentration sequence of each monitoring station over k consecutive time steps prior to the current moment. i and j represent the monitoring station numbers, respectively. i For station i, its historical state sequence is represented as the PM2.5 concentration sequence from time t-k+1 to time t. For monitoring station j, its historical state sequence is represented as the PM2.5 concentration sequence from time t-k+1 to time t. Indicates monitoring stations exist PM2.5 concentration values at different times and monitoring stations Monitoring stations Continuous before the current moment The joint probability of the simultaneous occurrence of historical PM2.5 concentration sequences at each time step. These respectively indicate that monitoring sites are considered simultaneously. With monitoring stations When considering historical state sequences, and considering only monitoring sites When monitoring stations are tracking their own historical state sequences, exist The conditional probability of the PM2.5 concentration at any given time.
[0046] Further increase the causal strength Normalized causality strength is obtained after normalization. ; Based on spatial weight and normalized causal strength The causal reinforcement fusion weights are obtained: (7) in, For causal enhancement coefficients, spatial weights For Haversine distance Calculated.
[0047] In a specific application embodiment, the adjacency matrix is first constructed. Spatial weight Based on Haversine distance Calculated, for example ,in This is a preset value for the characteristic scale used to characterize the attenuation of spatial correlation. For example, it can be 15km. In different implementation scenarios, it can be adjusted accordingly based on the layout of monitoring stations and actual application needs. The parameters control how quickly the spatial weight decays as the distance between stations increases. Specifically, the distance between stations is first calculated based on the latitude and longitude coordinates of each monitoring station. Then, substitute the distance into the spatial weighting function to calculate the spatial weight. Thus, the resulting spatial weights It can reflect the spatial distribution characteristics where nearby sites have a stronger influence and distant sites have a weaker influence. Furthermore, it quantifies sites based on transfer entropy. j right i Directed causal strength: , Representing a historical state sequence (i.e., an embedding vector) with a time length of k, and then... Normalized to the interval [0, 1] : (8) in To prevent tiny values with a denominator of zero, normalization is performed at each target node. neighborhood The process is performed independently within each section. The fusion weights are then calculated. ,in It is a learnable causal reinforcement coefficient, initially set to 0.5. This is used in calculating the propagation entropy. At that time, due to For continuous variables, the probability density function can be estimated in advance using symbolic mapping or Gaussian kernel density estimation (KDE). Preferably, an adaptive binning method can be used to discretize PM2.5 concentration and meteorological variables into Q state intervals, such as Q=20, thereby calculating the discretized transfer entropy.
[0048] Step S03. Prediction Model Construction: A prediction model is constructed based on a deep network with an encoder-decoder architecture. This architecture integrates a causally guided spatial attention layer and a physically adaptive temporal attention unit to dynamically capture spatiotemporal dependencies. Causally enhanced fusion weights are fused into the unnormalized attention scores corresponding to the original attention coefficients, and Softmax normalization is performed on the fused unnormalized attention scores to obtain the attention weights. The physically adaptive temporal attention unit uses a physical attenuation gate to correct historical hidden states. The input to the prediction model is the original samples, and the output is the predicted PM2.5 concentration. In this embodiment, causal-guided spatial attention layers inject causal-enhanced fusion weights before the Softmax normalization process, ultimately yielding normalized attention weights. This allows for a bias towards nodes that have both spatial and causal connections, thereby fully exploring the spatial and causal relationships between monitoring data from different monitoring stations. This enables the deep integration of a high-precision spatiotemporal attention prediction model with a rigorous causal inference framework, accurately constructing a causal enhancement network, and effectively quantifying the causal effects of continuous meteorological variables such as humidity on pollutants.
[0049] Specifically, the original attention coefficients are first calculated based on node features. Then, the causal reinforcement fusion weights are fused into the unnormalized attention scores corresponding to these original attention coefficients to obtain the fused unnormalized attention scores. Finally, Softmax normalization is performed on the fused unnormalized attention system to obtain the final attention weights. By employing the above method, attention allocation can be tilted towards nodes with strong spatial and causal relationships even before normalization. For example, the final attention weights can be obtained by injecting causal-enhancing fusion weights using the following formula. : (9) in, Indicates monitoring stations With monitoring stations Attention weights between them Indicates monitoring stations With monitoring stations Attention coefficient between them , Let be the learnable weight vector of a single-layer feedforward neural network, where || denotes the vector concatenation operation. T Indicates transpose. The weight matrix is a linear transformation matrix. Represents a node The set of neighboring nodes, Monitoring stations With monitoring stations The feature set, Represents a node The set of neighboring nodes, For monitoring sites With monitoring stations The causal reinforcement fusion weights between them.
[0050] In a specific application example, the input is the feature set of all stations at time t. That is, at time The set of node features of all monitoring stations input to the spatial attention layer, where, Indicates the first Each monitoring station at time The site feature vector, which includes the monitoring site at time... The PM2.5 concentration characteristics, humidity characteristics, and meteorological characteristics such as temperature, wind speed, and air pressure are used to map the humidity characteristics into feature values containing physical gradients through the dynamic mapping function as shown in equation (2). The feature vector of this station can also further include geographical static features such as latitude and longitude coordinates and altitude, as well as land feature vectors and time feature vectors. The above feature set This feature set can characterize the overall status of each monitoring station at the current moment, and then, based on this feature set... compute nodes With nodes Attention coefficient between For example, nodes can be calculated using the following formula. and Attention coefficient between : (10) In the formula, For a single-layer feedforward neural network, the learnable weight vector is... This represents a vector concatenation operation. This indicates transpose.
[0051] In this embodiment, a physical attenuation gate is used in the physically adaptive temporal attention unit. Correcting the hidden history status Among them, physical attenuation gate The calculation expression is: (11) in: The base decay rate (a trainable parameter, for example, can be initialized to 0.9). This is a physical violation mask, assuming the current humidity level is [not specified]. Compared to the previous moment If the mutation exceeds a preset threshold and there is no precipitation record, then =1, otherwise 0 It is a linear activation function used to truncate negative values in the input to 0, so as to ensure that the correction term in the physical attenuation gate is non-negative; The feature vector input to the physical adaptive temporal attention unit at the current time is preferably the site feature vector of the corresponding monitoring station at time t, such as PM2.5 concentration features, humidity, and one or more meteorological features among temperature, wind speed, and air pressure, and may further include geographic static features, land feature vectors and time feature vectors; Representation with weight parameters The corresponding bias parameters are used to offset the calculation results of the physical attenuation gate.
[0052] Revised state update formula: (12) In the formula, Candidate state: , Indicates physical attenuation gate The corrected previous hidden state is used to represent the historical time-series information filtered by physical constraints; the candidate state represents the current time-series candidate representation generated by combining the current input information with the corrected historical state. Simultaneously, the update gate is calculated. To control the fusion ratio of new and old information: (13) in It is the Sigmoid activation function. and These are the corresponding weights and bias parameters.
[0053] This embodiment employs the above-described physical attenuation gate. Correcting the hidden history status The mechanism enables automatic reduction when physical anomalies (such as data drift or sudden changes caused by sensor malfunctions) are detected. This effectively cuts off the spread of erroneous historical information.
[0054] Step S04. Counterfactual sample generation: The acquired humidity data is perturbed and filtered according to geographical static features to form counterfactual samples. The original samples and counterfactual samples are combined to form counterfactual sample pairs. A training dataset is constructed based on the counterfactual sample pairs to train the prediction model.
[0055] This embodiment implements a counterfactual sample generation strategy under physical constraints by controlling the perturbation of humidity features and filtering them with geographic static features, thereby constructing a semi-online sample pool for verifying model logic.
[0056] In a specific application embodiment, the following steps can be used to generate counterfactual sample pairs: Step S401. Construction of the semi-online counterfactual pool. Before the start of each training epoch, the original training set is copied. Generate a set of counterfactual facts For sample x, keeping other variables constant, only the humidity h is perturbed: (14) Step S402. Define the filtering function Only samples that meet the conditions are retained. For example, the range constraint is initially set as follows: Elevation-humidity constraints, if the station's altitude... Then limit the maximum humidity. (Simulating the dry characteristics of high-altitude areas); finally, dew point constraints are implemented to ensure... The corresponding dew point temperature should not exceed the current air temperature (to prevent a physically impossible supersaturation state).
[0057] Step S403. Pair Input: Pair the original sample x with the filtered counterfactual samples. Composition of pairs Simultaneously input into the model, and output predicted values respectively. and .
[0058] As a preferred implementation, the prediction model is trained based on counterfactual sample pairs using a hybrid loss function that includes a counterfactual gradient consistency penalty and a physical monotonicity penalty, wherein the expression for the hybrid loss function is: (15) in, Indicates the prediction error. The counterfactual consistency loss is used to constrain the model's sensitivity (gradient) to humidity so that it approximates the physical reality. This represents a physical monotonicity penalty. and This is a balancing coefficient used to weigh the accuracy of prediction against physical consistency; for example, it can be empirically set to a value of [value missing]. = 0.1, = 0.05, to prioritize ensuring the accuracy of basic predictions. Its dominant position.
[0059] Physical monotonicity penalty It can be calculated using the following formula: (16) in, It is the upper limit of the maximum allowed physical gradient. This represents the prediction gradient calculated based on the predicted values corresponding to the original samples and counterfactual samples, used to characterize the response gradient of the model's predicted values to changes in humidity; This represents the predicted PM2.5 concentration corresponding to the counterfactual sample. This represents the predicted PM2.5 concentration corresponding to the original sample. This represents the humidity values in the counterfactual sample; This indicates the humidity value in the original sample.
[0060] Physical monotonicity penalty The calculation expression is: (17) in, This indicates the precipitation code; if precipitation is recorded at the current time, then... Otherwise, it is 1.
[0061] This embodiment constructs the aforementioned hybrid loss function, which includes counterfactual gradient consistency and physical monotonicity penalty. Through multi-task joint training, it forces the model to maintain the self-consistency of physical laws while improving prediction accuracy. The physical monotonicity penalty... In calm and stable weather conditions, increased humidity typically promotes the formation of secondary particulate matter. and If an increase in humidity results in a significant decrease in predicted concentration, a penalty is imposed; simultaneously, precipitation coding is introduced. If there is a precipitation record at the current moment, then Otherwise, it is 1, a physical monotonicity penalty. Then, only when the model violates the "hygroscopic growth" rule, the activation condition must simultaneously satisfy the condition that the current humidity is less than the adaptive inflection point. The penalty term is activated only when the model is in a state of no precipitation, humidity is artificially increased, but the predicted concentration decreases significantly. When humidity When precipitation occurs, the system automatically disables the penalty term, allowing the model to learn the wet deposition removal effect under high humidity conditions.
[0062] Furthermore, multi-parameter optimization strategies can be employed, such as configuring the AdamW optimizer in PyTorch / TensorFlow, where Group A (network weights W) represents the learning rate. Group B (physical parameters) Learning rate The gradient is automatically calculated using loss.backward(), which enables synchronous convergence of model parameters and physical hyperparameters.
[0063] Step S05. Intelligent decision control: Input the real-time acquired sample data into the trained prediction model to obtain the predicted PM2.5 concentration value, and generate corresponding decision instructions based on the predicted PM2.5 concentration value.
[0064] In this embodiment, the PM2.5 concentration of the real-time measured sample is predicted using a trained prediction model. The predicted PM2.5 concentration value is then used to generate corresponding decision instructions. That is, the appropriate decision instructions are generated based on the high or low state of the predicted PM2.5 concentration to achieve appropriate regulation.
[0065] As a preferred implementation, after obtaining the predicted PM2.5 concentration, the method further includes calculating the real-time sensitivity of PM2.5 to humidity using the predicted PM2.5 concentration, and generating corresponding decision instructions by combining the predicted PM2.5 concentration and the real-time sensitivity. This can establish a decision support mechanism based on causal sensitivity and transform the prediction results into graded environmental management and control strategies.
[0066] Specifically, after the model is trained, for real-time input samples... PM can be calculated using automatic differentiation. 2.5 Partial derivative with respect to humidity: This value quantifies "how much the PM2.5 concentration will increase for every 1% increase in humidity at the current moment". Therefore, a hierarchical decision-making logic is adopted, based on the predicted value. and sensitivity Output decision instructions.
[0067] Optionally, the decision instructions output based on the predicted PM2.5 concentration and real-time sensitivity include: (1) If the predicted PM2.5 concentration is less than the preset concentration threshold, it is determined to be in a normal state and a normal monitoring and control command is sent. (2) If the predicted PM2.5 concentration is greater than the preset concentration threshold and the real-time sensitivity is less than the preset first sensitivity threshold, then it is determined that the current pollution is dominated by emission sources, and a control command that requires emission reduction is sent. (3) If the predicted PM2.5 concentration is greater than the preset concentration threshold, and the real-time sensitivity is between the first preset sensitivity threshold and the second preset sensitivity threshold, then it is determined that the current pollution is due to the combined effect of meteorological conditions and emission sources, and a corresponding control command to adjust the emission source is sent, and the first preset sensitivity threshold is less than the second preset sensitivity threshold. (4) If the predicted PM2.5 concentration is greater than the preset concentration threshold and the real-time sensitivity is greater than the second preset sensitivity threshold, then it is determined that the current atmosphere is in the period of explosive growth of hygroscopicity, and a hygroscopicity warning instruction is sent.
[0068] In a specific application embodiment, taking a concentration threshold of 75, a first preset sensitivity threshold of 0.2, and a second preset sensitivity threshold of 0.5 as an example, the system calculates based on the predicted value. and sensitivity Output decision instructions: Scenario 1 is low risk, at this time... The instruction is normal monitoring; scenario two is high pollution + low sensitivity, in which case... and The pollution was determined to be primarily caused by direct emissions from the source, with meteorological conditions not being the main factor. The directive was to recommend routine emission reductions. Scenario three involved high pollution and moderate sensitivity. and The scenario was determined to be a combination of meteorological conditions and emission sources, and the instruction was to activate a Level II response, recommending staggered production restrictions on non-key emission sources; Scenario 4 is characterized by high pollution and high sensitivity, in which case... and The atmosphere has been determined to be in a "hygroscopic growth surge period," and a hygroscopic warning has been issued. It is recommended that enterprises with high humidity emissions (such as chemical plants and wet desulfurization processes in thermal power plants) within the key control area activate their flue gas heating (whitening) facilities to reduce flue gas humidity and cut off the conditions for secondary aerosol conversion. It is also recommended to suspend the operation of fog cannons within the jurisdiction to avoid artificially increasing environmental humidity.
[0069] To implement the above method, this embodiment constructs a PM2.5 pollution prediction system, such as... Figure 2 As shown, the system includes an input layer, a feature enhancement layer, a core layer, and an output layer. The input layer includes a multi-source data acquisition module and a spatiotemporal alignment module. The multi-source data acquisition module is used to access data from air quality monitoring stations, meteorological data, and geographic information databases in real time, while the spatiotemporal alignment module performs spatiotemporal alignment and cleaning. The feature enhancement layer includes a humidity nonlinear mapping module and a fusion graph construction module. The humidity nonlinear mapping module is used to apply a dynamic mapping function to the humidity data. Mapped to eigenvalues containing physical gradients The fusion graph construction module calculates the transfer entropy between sites and combines spatial distance to generate causally enhanced fusion weights (adjacency matrix). The core layer includes a prediction module construction module, a counterfactual sample generation module, and a hybrid loss function optimization layer. The prediction module construction module builds a prediction model based on an encoder-decoder architecture deep network and integrates a causally guided spatial attention layer and a physically adaptive temporal attention unit within the encoder-decoder architecture. The counterfactual sample generation module constructs a counterfactual sample pool by controlling the perturbation of humidity features and filtering them in conjunction with geographical feature constraints to train the prediction model. A hybrid loss function is used for optimization during training. The output layer contains a deep learning inference acceleration card to load the trained prediction model and output the predicted PM2.5 value and the corresponding humidity sensitivity coefficient. It combines PM2.5 prediction values with real-time sensitive values to generate hierarchical control instructions according to preset hierarchical decision-making logic.
[0070] This embodiment further provides a computer device, including a processor and a memory. The memory is used to store a computer program, and the processor is used to execute the computer program to perform the method described above. This method is particularly suitable for environmental governance that uses an edge computing device and a central server collaborative architecture to interpretably model the dynamic relationship between continuous meteorological variables (such as humidity) and PM2.5, and to generate pollution intervention strategies that conform to atmospheric physical laws.
[0071] It is understood that the method described in this embodiment can be executed by a single device, such as a computer or server, or it can be applied to a distributed scenario where multiple devices cooperate to complete the task. In a distributed scenario, one of the multiple devices may execute only one or more steps of the method described in this embodiment, and the multiple devices interact to complete the method. The processor can be implemented using a general-purpose CPU, microprocessor, application-specific integrated circuit, or one or more integrated circuits, and is used to execute relevant programs to implement the method described in this embodiment. The memory can be implemented using read-only memory (ROM), random access memory (RAM), static storage devices, and dynamic storage devices. The memory can store the operating system and other applications. When the method described in this embodiment is implemented through software or firmware, the relevant program code is stored in the memory and called and executed by the processor.
[0072] This embodiment further provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method described above.
[0073] Those skilled in the art will understand that the above embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-readable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code. The present invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, produce implementations of the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 The computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The functions specified in one or more boxes. These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable apparatus for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0074] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention in any way. Although the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the invention. Therefore, any simple modifications, equivalent changes, and alterations made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention should fall within the protection scope of the present invention.
Claims
1. A PM2.5 pollution prediction method based on a causal enhanced spatiotemporal attention mechanism, characterized by the following steps: include: Step S01. Multi-source data acquisition: Acquire multi-source data from multiple monitoring stations as raw samples. The multi-source data includes PM2.5 concentration data, meteorological data, and geographic static features. The meteorological data includes humidity. Step S02. Causal Enhancement Graph Structure Construction: Calculate the transfer entropy between each monitoring station based on the PM2.5 concentration data of each monitoring station and use it as the corresponding causal strength between each monitoring station. Construct causal enhancement fusion weights based on the spatial weights between each monitoring station and the causal strengths. The spatial weights between each monitoring station are calculated based on the spatial distance between each monitoring station. Step S03. Prediction Model Construction: A prediction model is constructed based on a deep network with an encoder-decoder architecture. In the encoder-decoder architecture, a causal-guided spatial attention layer and a physically adaptive temporal attention unit are integrated to dynamically capture spatiotemporal dependencies. In the causal-guided spatial attention layer, the causal-enhanced fusion weights are fused into the unnormalized attention scores corresponding to the original attention coefficients, and Softmax normalization is performed on the fused unnormalized attention scores to obtain attention weights. The physically adaptive temporal attention unit uses a physical attenuation gate to correct the historical hidden state. The input of the prediction model is the original sample, and the output is the predicted value of PM2.5 concentration. Step S04. Counterfactual sample generation: The acquired humidity data is perturbed and filtered according to geographic static features to form counterfactual samples. The original samples and the counterfactual samples are combined to form counterfactual sample pairs. A training dataset is constructed based on the counterfactual sample pairs to train the prediction model. Step S05. Intelligent decision control: Input the real-time acquired sample data into the trained prediction model to obtain the predicted PM2.5 concentration value, and output the corresponding decision command based on the predicted PM2.5 concentration value.
2. The PM2.5 pollution prediction method based on causal enhanced spatiotemporal attention mechanism according to claim 1, characterized in that, The meteorological data also includes any one or more continuous variables such as temperature, wind speed, and air pressure. The geographic static features include latitude and longitude coordinates and altitude. The multi-source data also includes land feature vectors and / or time feature vectors. The land feature vectors are obtained by compressing and fusing the semantic information of land use types within a specified range around the corresponding monitoring station. The time feature vectors are obtained by performing a sine / cosine transformation on the timestamp t.
3. The PM2.5 pollution prediction method based on causal enhanced spatiotemporal attention mechanism according to claim 1, characterized in that, Step S01 also includes standardizing and aligning the PM2.5 concentration data with the meteorological feature vector. The steps include: If the meteorological data comes from a monitoring dataset, the PM2.5 concentration data will be matched with the meteorological data at the same time after the acquired meteorological data is time-converted. If the meteorological data comes from meteorological stations, the Euclidean distance between each PM2.5 monitoring station and all meteorological stations is calculated; the meteorological station with the smallest Euclidean distance is selected as the matching source, and a mapping relationship between PM2.5 concentration data and meteorological data is established.
4. The PM2.5 pollution prediction method based on causal enhanced spatiotemporal attention mechanism according to claim 1, characterized in that, Step S01 further includes obtaining the dependency curve between humidity and SHAP value, and determining the effect onset threshold and adaptive physical inflection point based on the dependency curve between humidity and SHAP value, wherein the effect onset threshold... The humidity value corresponding to the transition from the linear stationary region to the gradient enhancement region of the dependency curve, and the adaptive physical inflection point. The humidity value corresponding to the change from positive to negative of the derivative of the dependency curve; based on the effect onset threshold. and the adaptive physical inflection point Construct a dynamic mapping function, the dynamic mapping function The expression is: In the formula, This is the moisture absorption growth gain coefficient. This is the wet settlement attenuation coefficient. This corresponds to the linear stationary region. This corresponds to the gradient enhancement region. This corresponds to the gradient inversion region.
5. The PM2.5 pollution prediction method based on causal enhanced spatiotemporal attention mechanism according to claim 1, characterized in that, Step S02 includes: The transfer entropy between each monitoring station is calculated according to the following formula and used as the corresponding causal strength between each monitoring station: in, This represents a historical state sequence with a time length of k, where i and j represent the monitoring station numbers, respectively. Causality strength Normalized causality strength is obtained after normalization. ; Based on spatial weight and the normalized causal strength The causal reinforcement fusion weights are obtained: ,in For causal enhancement coefficients, spatial weights For Haversine distance The calculation yielded: ,in, This is a preset value for the characteristic scale used to characterize the decay of spatial correlation.
6. The PM2.5 pollution prediction method based on causal enhanced spatiotemporal attention mechanism according to any one of claims 1 to 5, characterized in that, In step S03, the expression for calculating the attention weights in the causal-guided spatial attention layer is: in, Indicates monitoring stations With monitoring stations Attention weights between them Indicates monitoring stations With monitoring stations Attention coefficient between them , It is a linear activation function. Let be the learnable weight vector of a single-layer feedforward neural network, where || denotes the vector concatenation operation. T Indicates transpose. The weight matrix is a linear transformation matrix. Monitoring stations With monitoring stations The feature set, Represents a node The set of neighboring nodes, For monitoring sites With monitoring stations The causal enhancement fusion weights between them.
7. The PM2.5 pollution prediction method based on causal enhanced spatiotemporal attention mechanism according to any one of claims 1 to 5, characterized in that, In step S03, a physical decay gate is used in the physically adaptive temporal attention unit. Correcting the hidden history status Among them, physical attenuation gate The calculation expression is: in: Based on the attenuation rate, This is a physical violation mask, assuming the current humidity level is [not specified]. Compared to the previous moment If the mutation exceeds a preset threshold and there is no precipitation record, then =1, otherwise 0; Revised state update formula: In the formula, Candidate state: , Simultaneously, calculate the update gate. To control the fusion ratio of new and old information: in It is the Sigmoid activation function. and These are the corresponding weights and bias parameters.
8. The PM2.5 pollution prediction method based on causal enhanced spatiotemporal attention mechanism according to any one of claims 1 to 5, characterized in that, In step S04, the prediction model is trained based on the counterfactual sample pairs using a hybrid loss function that includes counterfactual gradient consistency and physical monotonicity penalties. The expression for the hybrid loss function is as follows: in, Indicates the prediction error. The counterfactual consistency loss is used to constrain the model's sensitivity to humidity so that it approximates the physical reality. and For balance coefficient, It is the upper limit of the maximum allowed physical gradient. This represents the prediction gradient calculated based on the predicted values corresponding to the original samples and counterfactual samples, used to characterize the response gradient of the model's predicted values to changes in humidity; This represents the predicted PM2.5 concentration corresponding to the counterfactual sample. This represents the predicted PM2.5 concentration corresponding to the original sample. This represents the humidity values in the counterfactual sample; This indicates the humidity value in the original sample. This represents a physical monotonicity penalty. This indicates the precipitation code; if precipitation is recorded at the current time, then... Otherwise, it is 1.
9. The PM2.5 pollution prediction method based on causal enhanced spatiotemporal attention mechanism according to any one of claims 1 to 5, characterized in that, Step S05 further includes calculating the real-time sensitivity of the predicted PM2.5 concentration to humidity, and outputting a corresponding decision instruction based on the predicted PM2.5 concentration and the real-time sensitivity. The output of the corresponding decision instruction based on the predicted PM2.5 concentration and the real-time sensitivity includes: If the predicted PM2.5 concentration is less than the preset concentration threshold, it is determined to be in a normal state, and a normal monitoring and control command is sent. If the predicted PM2.5 concentration is greater than the preset concentration threshold and the real-time sensitivity is less than the preset first sensitivity threshold, then it is determined that the current pollution is dominated by emission sources, and a control command requiring emission reduction is sent. If the predicted PM2.5 concentration is greater than the preset concentration threshold, and the real-time sensitivity is between the first preset sensitivity threshold and the second preset sensitivity threshold, then it is determined that the current pollution is due to the combined effect of meteorological conditions and emission sources, and a corresponding control command to adjust the emission source is sent, wherein the first preset sensitivity threshold is less than the second preset sensitivity threshold. If the predicted PM2.5 concentration is greater than the preset concentration threshold, and the real-time sensitivity is greater than the second preset sensitivity threshold, then it is determined that the current atmosphere is in a period of explosive hygroscopic growth, and a hygroscopic warning command is sent.
10. An electronic device comprising a processor and a memory, the memory being used to store a computer program, characterized in that, The processor is used to execute the computer program to perform the method as described in any one of claims 1 to 9.