Air pollution risk prediction and early warning method based on multi-task learning
By adopting a multi-task learning model in air pollution risk prediction and early warning, combined with multi-objective optimization and improved multi-head attention mechanism, the problem of traditional methods being difficult to deal with the dynamic changes of multiple air pollutants is solved, and high-precision and high-efficiency air pollution risk prediction and early warning are achieved.
Patent Information
- Application Number
- CN202510009006.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-03
- Publication Date
- 2025-04-15
- Estimated Expiration
- 2045-01-03
AI Technical Summary
The existing technology is difficult to deal with the dynamic changes in space-time and space of multiple air pollutants at the same time, resulting in insufficient accuracy and timeliness of air pollution risk prediction and early warning, and it is difficult for traditional methods to provide customized and accurate risk assessment reports.
Using air pollution risk prediction and early warning methods based on multi-task learning, combined with multi-objective optimization, comparative learning and improved multi-head attention mechanisms, an efficient prediction and early warning model that can dynamically capture the spatial and temporal characteristics of multiple pollutants is designed, and a comprehensive risk assessment method that combines dynamic early warning rules and time-space is introduced.
It significantly improves the accuracy and efficiency of air pollution concentration prediction and risk warning, can handle the concentration prediction tasks of multiple pollutants at the same time, captures the complex correlation and spatial and temporal dynamic characteristics between pollutants, and improves the timeliness and accuracy of early warnings.
Smart Images

Figure CN119831104A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of air pollution prediction and early warning, and in particular to an air pollution risk prediction and early warning method based on multi-task learning. Background Art
[0002] With the acceleration of urbanization and the continuous improvement of industrialization, air pollution has become increasingly serious, causing extensive impacts on human health and the ecological environment. Air pollution not only affects the health of the respiratory and cardiovascular systems, but also has a profound negative impact on agricultural production and climate change. Therefore, how to accurately predict the concentration of air pollutants and provide effective risk warnings has become an important research topic in the current field of environmental science and public safety.
[0003] Traditional air pollution prediction methods are mainly based on statistical models and physical models. Statistical models, such as time series analysis models and regression models, use historical monitoring data to make trend predictions. These methods perform well when the data is relatively stable, but they are not capable of dealing with complex spatiotemporal correlations and interactions between pollutants. Physical models rely on the principles of atmospheric chemistry and meteorological dynamics to make predictions by simulating the transmission and transformation processes of pollutants. Such models require precise initial conditions and a large amount of computing resources, and have poor adaptability to multi-source data. The real-time and accuracy of the predictions are difficult to meet actual needs.
[0004] In recent years, with the rapid development of artificial intelligence technology, air pollution prediction methods based on machine learning and deep learning have gradually emerged. These methods can use large-scale multi-source data to mine potential laws and combine nonlinear modeling capabilities to achieve high-precision predictions. However, existing models based on single-task learning usually only focus on a specific pollutant or a single task, and fail to fully utilize the correlation between pollutants and the characteristics of spatiotemporal dynamic changes. This single-task prediction method is prone to low data utilization, model calculation redundancy, and bottlenecks in prediction accuracy. In addition, single-task models are difficult to handle multiple task targets at the same time and cannot effectively support regional-level comprehensive air quality risk assessment and early warning.
[0005] Although existing models based on multi-task learning have solved the above problems to a certain extent, they also have significant limitations. On the one hand, the shared feature extraction capability of multi-task learning models is limited, and it is difficult to accurately capture the complex spatiotemporal dynamic relationships of multiple pollutants when processing high-dimensional heterogeneous data. On the other hand, feature extraction in existing methods usually adopts a standard attention mechanism and fails to optimize for air pollution scenarios. For example, the deep correlation between time series and spatial features is not fully considered. In addition, traditional multi-task learning methods often adopt a single loss optimization objective, lack dynamic weight adjustment for inter-task collaboration and effective optimization of feature discriminability, which leads to poor performance of the model in complex multi-task scenarios.
[0006] In the field of air pollution risk assessment and early warning, existing technologies mainly rely on fixed risk assessment standards and simple rules to trigger early warnings. This method cannot dynamically adapt to the temporal and spatial changes and regional differences in pollutant concentrations, and it is difficult to provide customized, accurate risk assessment reports and early warning information for different regions. In addition, existing visualization methods are mostly presented in the form of static charts, which fail to dynamically display the evolution of pollution risks in the time and space dimensions, and are difficult to meet the actual needs of decision support.
[0007] Therefore, how to provide an air pollution risk prediction and early warning method based on multi-task learning is an urgent problem that technicians in this field need to solve. Summary of the invention
[0008] One purpose of the present invention is to propose an air pollution risk prediction and early warning method based on multi-task learning. The present invention innovatively combines multi-objective optimization, contrastive learning and an improved multi-head attention mechanism to design an efficient prediction and early warning model that can dynamically capture the spatiotemporal characteristics of multiple pollutants. By introducing dynamic early warning rules and a comprehensive risk assessment method combining time and space, the accuracy of air pollution prediction and the timeliness of early warning are improved.
[0009] An air pollution risk prediction and early warning method based on multi-task learning according to an embodiment of the present invention comprises the following steps:
[0010] S1. Collect multi-source air pollution monitoring data, including pollutant concentration data, meteorological data and geographic space data, and pre-process the multi-source air pollution monitoring data to generate pre-processed data;
[0011] S2. Build a multi-task learning model, input the preprocessed data into the multi-task learning model, generate a shared feature matrix through the shared feature extraction layer of the multi-task learning model based on the improved multi-head attention mechanism, and input the shared feature matrix into the task-specific prediction layer of the multi-task learning model to generate preliminary prediction results;
[0012] S3. Define a multi-objective optimization function for the multi-task learning model, construct a contrastive learning loss function based on the gradient of the shared feature matrix, and optimize the parameters of the shared feature extraction layer and the task-specific prediction layer by combining the multi-objective optimization function and the contrastive learning loss function.
[0013] S4, applying the optimized shared feature extraction layer and task-specific prediction layer parameters to the multi-task learning model, optimizing the preliminary prediction results, and generating optimized prediction results, wherein the optimized prediction results include the concentration and spatiotemporal variation trend of the pollutants;
[0014] S5. Map the predicted pollutant concentrations with the preset risk assessment standards to generate risk levels for different regions and at different times. Calculate the dynamic risk level based on the time series of the optimized prediction results. Calculate the spatial risk distribution of the predicted concentration results of pollutants in different geographical locations. Generate a risk assessment report by integrating the risk information in time and space dimensions.
[0015] S6. Design trigger conditions according to risk levels, define joint warning rules, trigger warnings through dynamic threshold judgments, and generate warning information.
[0016] Optionally, the S2 specifically includes:
[0017] S21, constructing a multi-task learning model, wherein the multi-task learning model includes a shared feature extraction layer and a task-specific prediction layer, wherein the shared feature extraction layer extracts the spatiotemporal characteristics of pollutants, and the task-specific prediction layer predicts the concentrations and spatiotemporal variation trends of multiple pollutants respectively;
[0018] S22. The generated preprocessed data X is input into the multi-task learning model, and a multi-scale convolution operation is performed on the preprocessed data X to capture the local relationship of the spatiotemporal characteristics of the pollutants, and the convolution results of different scales are spliced to generate a convolution feature matrix. The multi-scale convolution operation uses convolution kernel sizes of 3×3, 5×5 and 7×7:
[0019]
[0020]
[0021] in, Represents the convolution results of different scales, represents the weight matrix of the kth convolution kernel, represents the bias vector, σ represents the ReLU activation function, F conv Represents the convolution feature matrix, Concat represents the concatenation operation, and * represents the convolution operation;
[0022] S23, convolution feature matrix F conv Add time embedding information to generate the time-enhanced feature matrix F time :
[0023]
[0024] Among them, F time [i,j] represents the time-enhanced feature matrix, t i represents the timestamp corresponding to sample i, j represents the feature dimension index, and d represents the total feature dimension;
[0025] S24, time-enhanced feature matrix F timeApply the improved multi-head attention mechanism to deeply integrate time series and spatial correlation information. On the basis of the standard multi-head attention mechanism, add the time weight matrix to adjust the features and calculate the query, key and value matrices:
[0026] Q=W q ·(F time +δ q ),K=W k ·(F time +δ k ),V=W v ·(F time +δ v );
[0027] Where Q, K, and V represent query, key, and value matrices, respectively, and W q , W k and W v Trainable weight matrices representing queries, keys, and values, δ q , δ k and δ v Indicates dynamic adjustment of offset;
[0028] S25, introduce time decay factor and spatial weight:
[0029]
[0030]
[0031] Among them, Attention(Q,K,V) represents the multi-head attention mechanism formula, ⊙ represents element-by-element multiplication, d k represents the dimension of the key vector, W s represents the spatial weight, b s represents bias, T represents transpose, α t represents the time decay factor, exp represents the natural exponential function, t i and t q represents the timestamp corresponding to samples i and q, λ represents the time decay coefficient, and softmax represents normalization;
[0032] S26. Add a hierarchical fusion module after the output of the multi-head attention mechanism to combine features of different time scales and generate a shared feature matrix:
[0033] F shared =β·Attention(Q,K,V) + (1-β)·F time ;
[0034] β=sigmoid(W β ·F time +bβ );
[0035] Among them, F shared represents the shared feature matrix, W β and b β represents the fusion weight matrix and bias, sigmoid represents the activation function, and β represents the weight of the fusion operation;
[0036] S27, share the feature matrix F shared Enter the task-specific prediction layer to generate preliminary prediction results for each task:
[0037]
[0038] g t =sigmoid(W g ·z t +b g );
[0039] in, represents the preliminary prediction result, W t and b t represents the task-specific convolutional weight matrix and bias vector, g t represents the gating factor, W g and b g Represents the gating weight matrix and bias vector.
[0040] Optionally, the S3 specifically includes:
[0041] S31. Define a multi-objective optimization function of a multi-task learning model, wherein the multi-objective optimization function guides the joint optimization of a shared feature extraction layer and a task-specific prediction layer, and the optimization objectives of the multi-objective optimization function include minimizing the loss of each task and maximizing the synergy between tasks:
[0042]
[0043] in, represents the multi-objective optimization function, represents the loss function of task t, which is the cross entropy loss function, γ t represents the task weight, represents the regularization coefficient, and Represent the shared feature matrices of task i and task j respectively, represents the second norm, T represents the total number of tasks;
[0044] S32. Dynamically adjust task weight γ using changes in task loss function t :
[0045]
[0046] Where, exp represents the natural exponential function;
[0047] S33. Calculate the gradient of the shared feature extraction layer and generate task-specific positive and negative sample features:
[0048]
[0049]
[0050] in, represents the positive sample feature, Represents the negative sample feature, L i represents the loss function of task i, L j represents the loss function of task j, ∈ represents the step size;
[0051] S34. Construct a contrastive learning loss function to further optimize the distinguishability and synergy of features between tasks:
[0052]
[0053] in, represents the contrastive learning loss function, sim represents the cosine similarity, F i Represents the features extracted by the shared feature extraction layer;
[0054] S35. Combine the contrastive learning loss function and the multi-objective optimization function to optimize the shared feature extraction layer parameters and the task-specific prediction layer parameters:
[0055]
[0056]
[0057]
[0058] in, represents the total loss function, λ contrast represents the weight of the contrastive learning loss function, θ s represents the shared feature extraction layer parameters, θ t represents the task-specific prediction layer parameters, and η represents the learning rate, which is used to control the step size of parameter update.
[0059] Optionally, the S5 specifically includes:
[0060] S51. Map pollutant concentrations to risk levels according to preset risk assessment standards;
[0061] S52. Calculate the corresponding risk level using the predicted pollutant concentration:
[0062]
[0063] Where R(y) represents the risk level, y represents the predicted pollutant concentration, k represents the index of the risk level, K represents the number of risk levels, and C k Indicates the risk level cut-off point;
[0064] S53. Calculate the overall risk level of the region according to the risk level of each task and normalize it;
[0065] S54, calculating the dynamic risk level based on the time series of the optimized prediction results, and calculating the spatial risk distribution of the pollutant concentration prediction results at different geographical locations;
[0066] S55. Integrate the risk information of all tasks in time and space dimensions to generate a risk assessment report, which includes the risk level of each pollutant, the regional comprehensive risk level, the time series risk change trend and the risk level spatial distribution map.
[0067] Optionally, the S6 specifically includes:
[0068] S61. Set the corresponding warning threshold for the risk level:
[0069]
[0070] Among them, T k represents the warning threshold of risk level k, k represents the index of risk level, K represents the number of risk levels, C min and C max Respectively represent the minimum and maximum values of pollutant concentration;
[0071] S62. Setting dynamic warning rules, wherein the dynamic warning rules include multi-dimensional triggering conditions of time, space and pollutant concentration:
[0072]
[0073]
[0074] Among them, N t represents the time step, Indicates the risk level, (x j ,y j ) represents the regional grid, Indicates the risk level of the regional grid, T time and T space Respectively represent the warning thresholds of the risk level in the time dimension and the risk level in the space dimension;
[0075] S63. Design trigger conditions of time, space and pollutant concentration in a composite way and define joint warning rules:
[0076] E alert =I(R overall >T overall and R time >T time and R space >T space );
[0077] Among them, E alert represents the joint warning value, I(·) represents the indicator function, and when the condition is met, E alert is 1, otherwise it is 0, R overall , R time and R space They represent the overall risk level, time dimension risk level and space dimension risk level respectively, T overall Indicates the warning threshold of the overall risk level, and means "and";
[0078] S64. When the joint warning value is 1, generate warning information, which includes warning type, involved area, warning time and pollutants.
[0079] The beneficial effects of the present invention are:
[0080] First, by introducing a multi-task learning model, the present invention significantly improves the accuracy and efficiency of air pollution concentration prediction and risk warning. Compared with the traditional single-task learning model, the present invention can simultaneously handle the concentration prediction tasks of multiple pollutants and capture the complex correlations and spatiotemporal dynamic characteristics between pollutants. This collaborative modeling approach not only improves data utilization, but also avoids the problems of data redundancy and waste of computing resources in single-task models.
[0081] Secondly, the present invention deeply integrates time series information and spatial features through the improvement of the multi-head attention mechanism, making the model perform better when processing multi-source heterogeneous data. The introduction of the time decay factor and the spatial weight matrix enables the attention mechanism to adaptively adjust the feature weights according to the spatiotemporal dynamic changes of pollutants, ensuring that the extracted features are more spatiotemporally relevant and have more predictive value. In addition, the design of the hierarchical fusion module enables the model to integrate features of different time scales, improves the expressive power of the shared feature extraction layer, and lays the foundation for the accurate prediction of pollutant concentrations and risk levels.
[0082] In addition, during the optimization process, the present invention combines multi-objective optimization and contrastive learning techniques to not only minimize the independent losses of each task, but also optimize the synergy and feature differentiation between tasks through specific positive and negative sample construction. The mechanism of dynamically adjusting task weights ensures a reasonable distribution of attention to each task at different stages, thereby improving the overall optimization effect of the model. This multi-objective optimization method makes up for the problem of insufficient collaboration between tasks in traditional methods, making the prediction results more robust and reliable in complex scenarios.
[0083] Finally, in terms of air pollution risk assessment and early warning, the present invention proposes dynamic early warning rules and a joint early warning mechanism, which automatically adjusts the early warning thresholds and trigger conditions according to changes in pollutant concentrations in different regions and time periods. Compared with the traditional early warning method based on fixed rules, the dynamic early warning mechanism of the present invention is more flexible and can identify high-risk pollution areas and time periods, thereby improving the timeliness and accuracy of risk early warnings. BRIEF DESCRIPTION OF THE DRAWINGS
[0084] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:
[0085] Figure 1 A flowchart of an air pollution risk prediction and early warning method based on multi-task learning proposed by the present invention;
[0086] Figure 2 This is a workflow diagram of an improved multi-head attention mechanism for an air pollution risk prediction and early warning method based on multi-task learning proposed in the present invention. DETAILED DESCRIPTION
[0087] The present invention will now be described in further detail with reference to the accompanying drawings. These drawings are simplified schematic diagrams, which only illustrate the basic structure of the present invention in a schematic manner, and therefore only show the components related to the present invention.
[0088] refer to Figure 1 and Figure 2 , an air pollution risk prediction and early warning method based on multi-task learning, comprising the following steps:
[0089] S1. Collect multi-source air pollution monitoring data, including pollutant concentration data, meteorological data and geographic space data, and pre-process the multi-source air pollution monitoring data to generate pre-processed data;
[0090] S2. Build a multi-task learning model, input the preprocessed data into the multi-task learning model, generate a shared feature matrix through the shared feature extraction layer of the multi-task learning model based on the improved multi-head attention mechanism, and input the shared feature matrix into the task-specific prediction layer of the multi-task learning model to generate preliminary prediction results;
[0091] S3. Define a multi-objective optimization function for the multi-task learning model, construct a contrastive learning loss function based on the gradient of the shared feature matrix, and optimize the parameters of the shared feature extraction layer and the task-specific prediction layer by combining the multi-objective optimization function and the contrastive learning loss function.
[0092] S4, applying the optimized shared feature extraction layer and task-specific prediction layer parameters to the multi-task learning model, optimizing the preliminary prediction results, and generating optimized prediction results, wherein the optimized prediction results include the concentration and spatiotemporal variation trend of the pollutants;
[0093] S5. Map the predicted pollutant concentrations with the preset risk assessment standards to generate risk levels for different regions and at different times. Calculate the dynamic risk level based on the time series of the optimized prediction results. Calculate the spatial risk distribution of the predicted concentration results of pollutants in different geographical locations. Generate a risk assessment report by integrating the risk information in time and space dimensions.
[0094] S6. Design trigger conditions according to risk levels, define joint warning rules, trigger warnings through dynamic threshold judgments, and generate warning information.
[0095] In this implementation, S2 specifically includes:
[0096] S21, constructing a multi-task learning model, wherein the multi-task learning model includes a shared feature extraction layer and a task-specific prediction layer, wherein the shared feature extraction layer extracts the spatiotemporal characteristics of pollutants, and the task-specific prediction layer predicts the concentrations and spatiotemporal variation trends of multiple pollutants respectively;
[0097] S22. The generated preprocessed data X is input into the multi-task learning model, and a multi-scale convolution operation is performed on the preprocessed data X to capture the local relationship of the spatiotemporal characteristics of the pollutants, and the convolution results of different scales are spliced to generate a convolution feature matrix. The multi-scale convolution operation uses convolution kernel sizes of 3×3, 5×5 and 7×7:
[0098]
[0099]
[0100] in, Represents the convolution results of different scales, represents the weight matrix of the kth convolution kernel, represents the bias vector, σ represents the ReLU activation function, F conv Represents the convolution feature matrix, Concat represents the concatenation operation, and * represents the convolution operation;
[0101] S23, convolution feature matrix F conv Add time embedding information to generate the time-enhanced feature matrix F time :
[0102]
[0103] Among them, F time [i,j] represents the time-enhanced feature matrix, t i represents the timestamp corresponding to sample i, j represents the feature dimension index, and d represents the total feature dimension;
[0104] S24, time-enhanced feature matrix F time Apply the improved multi-head attention mechanism to deeply integrate time series and spatial correlation information. On the basis of the standard multi-head attention mechanism, add the time weight matrix to adjust the features and calculate the query, key and value matrices:
[0105] Q=W q ·(F time +δ q ),K=W k ·(F time +δ k ),V=W v ·(F time +δ v );
[0106] Where Q, K, and V represent query, key, and value matrices, respectively, and W q , W k and W v Trainable weight matrices representing queries, keys, and values, δ q , δ k and δ v Indicates dynamic adjustment of offset;
[0107] S25, introduce time decay factor and spatial weight:
[0108]
[0109]
[0110] Among them, Attention(Q,K,V) represents the multi-head attention mechanism formula, ⊙ represents element-by-element multiplication, d k represents the dimension of the key vector, W s represents the spatial weight, b srepresents bias, T represents transpose, α t represents the time decay factor, exp represents the natural exponential function, t i and t q represents the timestamp corresponding to samples i and q, λ represents the time decay coefficient, and softmax represents normalization;
[0111] S26. Add a hierarchical fusion module after the output of the multi-head attention mechanism to combine features of different time scales and generate a shared feature matrix:
[0112] F shared =β·Attention(Q,K,V) + (1-β)·F time ;
[0113] β=sigmoid(W β ·F time +b β );
[0114] Among them, F shared represents the shared feature matrix, W β and b β represents the fusion weight matrix and bias, sigmoid represents the activation function, and β represents the weight of the fusion operation;
[0115] S27, share the feature matrix F shared Enter the task-specific prediction layer to generate preliminary prediction results for each task:
[0116]
[0117] g t =sigmoid(W g ·z t +b g );
[0118] in, represents the preliminary prediction result, W t and b t represents the task-specific convolutional weight matrix and bias vector, g t represents the gating factor, W g and b g Represents the gating weight matrix and bias vector.
[0119] In this implementation, S3 specifically includes:
[0120] S31. Define a multi-objective optimization function of a multi-task learning model, wherein the multi-objective optimization function guides the joint optimization of a shared feature extraction layer and a task-specific prediction layer, and the optimization objectives of the multi-objective optimization function include minimizing the loss of each task and maximizing the synergy between tasks:
[0121]
[0122] in, represents the multi-objective optimization function, represents the loss function of task t, which is the cross entropy loss function, γ t represents the task weight, represents the regularization coefficient, and Represent the shared feature matrices of task i and task j respectively, represents the second norm, T represents the total number of tasks;
[0123] S32. Dynamically adjust task weight γ using changes in task loss function t :
[0124]
[0125] Where, exp represents the natural exponential function;
[0126] S33. Calculate the gradient of the shared feature extraction layer and generate task-specific positive and negative sample features:
[0127]
[0128]
[0129] in, represents the positive sample feature, Represents the negative sample feature, L i represents the loss function of task i, L j represents the loss function of task j, ∈ represents the step size;
[0130] S34. Construct a contrastive learning loss function to further optimize the distinguishability and synergy of features between tasks:
[0131]
[0132] in, represents the contrastive learning loss function, sim represents the cosine similarity, F i Represents the features extracted by the shared feature extraction layer;
[0133] S35. Combine the contrastive learning loss function and the multi-objective optimization function to optimize the shared feature extraction layer parameters and the task-specific prediction layer parameters:
[0134]
[0135]
[0136]
[0137] in, represents the total loss function, λ contrast represents the weight of the contrastive learning loss function, θ s represents the shared feature extraction layer parameters, θ t represents the task-specific prediction layer parameters, and η represents the learning rate, which is used to control the step size of parameter update.
[0138] In this implementation manner, S5 specifically includes:
[0139] S51. Map pollutant concentrations to risk levels according to preset risk assessment standards;
[0140] S52. Calculate the corresponding risk level using the predicted pollutant concentration:
[0141]
[0142] Where R(y) represents the risk level, y represents the predicted pollutant concentration, k represents the index of the risk level, K represents the number of risk levels, and C k Indicates the risk level cut-off point;
[0143] S53. Calculate the overall risk level of the region according to the risk level of each task and normalize it;
[0144] S54, calculating the dynamic risk level based on the time series of the optimized prediction results, and calculating the spatial risk distribution of the pollutant concentration prediction results at different geographical locations;
[0145] S55. Integrate the risk information of all tasks in time and space dimensions to generate a risk assessment report, which includes the risk level of each pollutant, the regional comprehensive risk level, the time series risk change trend and the risk level spatial distribution map.
[0146] In this implementation manner, S6 specifically includes:
[0147] S61. Set the corresponding warning threshold for the risk level:
[0148]
[0149] Among them, Tk represents the warning threshold of risk level k, k represents the index of risk level, K represents the number of risk levels, C min and C max Respectively represent the minimum and maximum values of pollutant concentration;
[0150] S62. Setting dynamic warning rules, wherein the dynamic warning rules include multi-dimensional triggering conditions of time, space and pollutant concentration:
[0151]
[0152]
[0153] Among them, N t represents the time step, Indicates the risk level, (x j ,y j ) represents the regional grid, Indicates the risk level of the regional grid, T time and T space Respectively represent the warning thresholds of the risk level in the time dimension and the risk level in the space dimension;
[0154] S63. Design trigger conditions of time, space and pollutant concentration in a composite way and define joint warning rules:
[0155] E alert =I(R overall >T overall and R time >T time and R space >T space );
[0156] Among them, E alert represents the joint warning value, I(·) represents the indicator function, and when the condition is met, E alert is 1, otherwise it is 0, R overall , R time and R space They represent the overall risk level, time dimension risk level and space dimension risk level respectively, T overall Indicates the warning threshold of the overall risk level, and means "and";
[0157] S64. When the joint warning value is 1, generate warning information, which includes warning type, involved area, warning time and pollutants.
[0158] Embodiment 1:
[0159] In the embodiments of the present invention, the air pollution prediction and early warning of a certain city is used as a research scenario to demonstrate the application effect based on the multi-task learning model. The city is a typical industrialized city, which is affected by PM2.5, PM10, NO2, and SO2 pollutants all year round. At the same time, it is accompanied by complex meteorological conditions and geographic spatial characteristics, and the prediction of air quality risks faces great challenges. The performance of traditional single-task learning models and fixed rule early warning methods in this scenario is subject to many limitations, and it is impossible to achieve high-precision, multi-dimensional pollution risk prediction and early warning.
[0160] The city's air quality monitoring data comes from 50 monitoring stations across the city, including pollutant concentration data (PM2.5, PM10, NO2, SO2), meteorological data (temperature, humidity, wind speed, precipitation) and geospatial data (station latitude and longitude, elevation, etc.) from January to December 2023. The monitoring data is collected once an hour, and a total of 438,000 records are obtained. After data cleaning, 426,780 valid records are retained.
[0161] In the present invention, the above data are first cleaned and preprocessed, including processing missing values, outliers, and unifying time steps and spatial resolutions. After preprocessing, the data is input into a multi-task learning model. The model extracts the spatiotemporal characteristics of multiple pollutants through a shared feature extraction layer, and uses a task-specific prediction layer to generate concentration prediction values of PM2.5, PM10, NO2, and SO2, respectively. The model adopts an improved multi-head attention mechanism, and deeply integrates time series and spatial features through the introduction of time decay factors and spatial weight matrices. At the same time, combined with the contrast learning loss function and the multi-objective optimization function, the task weights are dynamically adjusted to improve the prediction accuracy and synergy of the model. According to the predicted pollutant concentration and the risk assessment standard, the risk level of each site is generated. On this basis, the overall risk level of the region is calculated, and a risk assessment report is generated in combination with the time series and spatial distribution information. In addition, the dynamic warning rules are used to trigger the warning, and the warning information includes the type of pollutant, the area involved, and the warning duration.
[0162] Table 1 Experimental data comparison table
[0163] index Traditional methods Method of the present invention Improvement (%) Mean absolute error (PM2.5) 9.45 6.72 28.89 Mean absolute error (PM10) 12.31 8.59 30.22 <![CDATA[Mean Absolute Error (NO2)]]> 6.83 4.97 27.21 <![CDATA[Mean Absolute Error (SO2)]]> 4.27 3.15 26.22 Average warning lead time (hours) 2.5 5.3 112.00 Early warning accuracy (%) 78.6 93.2 18.60 Risk assessment generation time (seconds / time) 8.2 3.6 56.10 Dynamic visualization generation time (seconds / time) 15.7 6.8 56.69 Risk reporting coverage (%) 82.3 98.1 19.23
[0164] It can be seen from the experimental data comparison table that the present invention has shown significant advantages over traditional methods in multiple core indicators of air pollution risk prediction and early warning. First, in terms of prediction accuracy, the mean absolute error of the present invention for four pollutants, PM2.5, PM10, NO2 and SO2, was reduced by 28.89%, 30.22%, 27.21% and 26.22%, respectively, improving the accuracy of the model in predicting multi-pollutant concentrations. This improvement is due to the multi-task learning design of the present invention in the shared feature extraction layer, and the ability to deeply fuse spatiotemporal features by improving the multi-head attention mechanism.
[0165] In terms of early warning response performance, the dynamic early warning rules of the present invention increase the average early warning lead time from 2.5 hours of the traditional method to 5.3 hours, an increase of 112%. This result shows that the present invention can identify high-risk areas earlier and provide more timely early warning information to relevant departments. In addition, the early warning accuracy rate increased from 78.6% of the traditional method to 93.2%, an increase of 18.6 percentage points, which fully demonstrates the reliability and effectiveness of the present invention in risk identification.
[0166] The efficiency of risk assessment has also been significantly improved. The time it takes to generate a complete risk assessment report has been shortened from 8.2 seconds in the traditional method to 3.6 seconds, an efficiency improvement of 56.1%. The time for dynamic visualization generation has also been significantly reduced, from 15.7 seconds to 6.8 seconds, an improvement of 56.69%. This efficiency improvement is due to the efficient multi-task learning model and contrastive learning optimization method in the present invention, which makes fuller use of computing resources.
[0167] In terms of risk reporting coverage, the present invention can cover 98.1% of the area, which is 19.23% higher than the 82.3% of the traditional method. This improvement is due to the enhanced risk analysis capabilities of the present invention in time and space dimensions, especially the innovations in dynamic warning rule design and multi-source data fusion. Overall, the present invention not only significantly surpasses traditional methods in prediction accuracy and warning response speed, but also shows excellent performance in risk assessment and dynamic visualization generation efficiency. These advantages fully reflect the technical value and practical significance of the present invention in solving key problems in air pollution prediction and warning.
[0168] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical scheme and inventive concept of the present invention within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.
Claims
1. An air pollution risk prediction and early warning method based on multi-task learning, characterized in that: The steps include: S1. Collect multi-source air pollution monitoring data, including pollutant concentration data, meteorological data and geographic space data, and pre-process the multi-source air pollution monitoring data to generate pre-processed data; S2. Build a multi-task learning model, input the preprocessed data into the multi-task learning model, generate a shared feature matrix through the shared feature extraction layer of the multi-task learning model based on the improved multi-head attention mechanism, and input the shared feature matrix into the task-specific prediction layer of the multi-task learning model to generate preliminary prediction results; S3. Define a multi-objective optimization function for the multi-task learning model, construct a contrastive learning loss function based on the gradient of the shared feature matrix, and optimize the parameters of the shared feature extraction layer and the task-specific prediction layer by combining the multi-objective optimization function and the contrastive learning loss function. S4, applying the optimized shared feature extraction layer and task-specific prediction layer parameters to the multi-task learning model, optimizing the preliminary prediction results, and generating optimized prediction results, wherein the optimized prediction results include the concentration and spatiotemporal variation trend of the pollutants; S5. Map the predicted pollutant concentrations with the preset risk assessment standards to generate risk levels for different regions and at different times. Calculate the dynamic risk level based on the time series of the optimized prediction results. Calculate the spatial risk distribution of the predicted concentration results of pollutants in different geographical locations. Generate a risk assessment report by integrating the risk information in time and space dimensions. S6. Design trigger conditions according to risk levels, define joint warning rules, trigger warnings through dynamic threshold judgments, and generate warning information.
2. The air pollution risk prediction and early warning method based on multi-task learning according to claim 1 is characterized in that: The S2 specifically includes: S21, constructing a multi-task learning model, wherein the multi-task learning model includes a shared feature extraction layer and a task-specific prediction layer, wherein the shared feature extraction layer extracts the spatiotemporal characteristics of pollutants, and the task-specific prediction layer predicts the concentrations and spatiotemporal variation trends of multiple pollutants respectively; S22. The generated preprocessed data X is input into the multi-task learning model, and a multi-scale convolution operation is performed on the preprocessed data X to capture the local relationship of the spatiotemporal characteristics of the pollutants, and the convolution results of different scales are spliced to generate a convolution feature matrix. The multi-scale convolution operation uses convolution kernel sizes of 3×3, 5×5 and 7×7: in, Represents the convolution results of different scales, represents the weight matrix of the kth convolution kernel, represents the bias vector, σ represents the ReLU activation function, F conv represents the convolution feature matrix, Concat represents the concatenation operation, and * represents the convolution operation; S23, convolution feature matrix F conv Add time embedding information to generate the time-enhanced feature matrix F time : Among them, F time [i,j] represents the time-enhanced feature matrix, t i represents the timestamp corresponding to sample i, j represents the feature dimension index, and d represents the total feature dimension; S24, time-enhanced feature matrix F time Apply the improved multi-head attention mechanism to deeply integrate time series and spatial correlation information. On the basis of the standard multi-head attention mechanism, add the time weight matrix to adjust the features and calculate the query, key and value matrices: Q=W q ·(F time +δ q ),K=W k ·(F time +δ k ),V=W v ·(F time +δ v ); Where Q, K, and V represent query, key, and value matrices, respectively, and W q , W k and W v Trainable weight matrices representing queries, keys, and values, δ q ,δ k and δ v Indicates dynamic adjustment of offset; S25, introduce time decay factor and spatial weight: Among them, Attention(Q,K,V) represents the multi-head attention mechanism formula, ⊙ represents element-by-element multiplication, d k represents the dimension of the key vector, W s represents the spatial weight, b s represents bias, T represents transpose, α t represents the time decay factor, exp represents the natural exponential function, t i and t q represents the timestamp corresponding to samples i and q, λ represents the time decay coefficient, and softmax represents normalization; S26. Add a hierarchical fusion module after the output of the multi-head attention mechanism to combine features of different time scales and generate a shared feature matrix: F shared =β·Attention(Q,K,V)+(1-β)·F time ; β=sigmoid(W β ·F time +b β ); Among them, F shared represents the shared feature matrix, W β and b β represents the fusion weight matrix and bias, sigmoid represents the activation function, and β represents the weight of the fusion operation; S27, share the feature matrix F shared Enter the task-specific prediction layer to generate preliminary prediction results for each task: g t =sigmoid(W g ·z t +b g ); in, represents the preliminary prediction result, W t and b t represents the task-specific convolutional weight matrix and bias vector, g t represents the gating factor, W g and b g Represents the gating weight matrix and bias vector.
3. The air pollution risk prediction and early warning method based on multi-task learning according to claim 1 is characterized in that: The S3 specifically includes: S31. Define a multi-objective optimization function of a multi-task learning model, wherein the multi-objective optimization function guides the joint optimization of a shared feature extraction layer and a task-specific prediction layer, and the optimization objectives of the multi-objective optimization function include minimizing the loss of each task and maximizing the synergy between tasks: in, represents the multi-objective optimization function, represents the loss function of task t, which is the cross entropy loss function, γ t represents the task weight, represents the regularization coefficient, and Represent the shared feature matrices of task i and task j respectively, represents the second norm, T represents the total number of tasks; S32. Dynamically adjust task weight γ using changes in task loss function t : Where, exp represents the natural exponential function; S33. Calculate the gradient of the shared feature extraction layer and generate task-specific positive and negative sample features: in, represents the positive sample feature, Represents the negative sample feature, L i represents the loss function of task i, L j represents the loss function of task j, ∈ represents the step size; S34. Construct a contrastive learning loss function to further optimize the distinguishability and synergy of features between tasks: in, represents the contrastive learning loss function, sim represents the cosine similarity, F i Represents the features extracted by the shared feature extraction layer; S35. Combine the contrastive learning loss function and the multi-objective optimization function to optimize the shared feature extraction layer parameters and the task-specific prediction layer parameters: in, represents the total loss function, λ contrast represents the weight of the contrastive learning loss function, θ s represents the shared feature extraction layer parameters, θ t represents the task-specific prediction layer parameters, and η represents the learning rate, which is used to control the step size of parameter update.
4. The air pollution risk prediction and early warning method based on multi-task learning according to claim 1 is characterized in that: The S5 specifically includes: S51. Map pollutant concentrations to risk levels according to preset risk assessment standards; S52. Calculate the corresponding risk level using the predicted pollutant concentration: Where R(y) represents the risk level, y represents the predicted pollutant concentration, k represents the index of the risk level, K represents the number of risk levels, and C k Indicates the risk level cut-off point; S53. Calculate the overall risk level of the region according to the risk level of each task and normalize it; S54, calculating the dynamic risk level based on the time series of the optimized prediction results, and calculating the spatial risk distribution of the pollutant concentration prediction results at different geographical locations; S55. Integrate the risk information of all tasks in time and space dimensions to generate a risk assessment report, which includes the risk level of each pollutant, the regional comprehensive risk level, the time series risk change trend and the risk level spatial distribution map.
5. The air pollution risk prediction and early warning method based on multi-task learning according to claim 1 is characterized in that: The S6 specifically includes: S61. Set the corresponding warning threshold for the risk level: Among them, T k represents the warning threshold of risk level k, k represents the index of risk level, K represents the number of risk levels, C min and C max Respectively represent the minimum and maximum values of pollutant concentration; S62. Setting dynamic warning rules, wherein the dynamic warning rules include multi-dimensional triggering conditions of time, space and pollutant concentration: Among them, N t represents the time step, Indicates the risk level, (x j ,y j ) represents the regional grid, Indicates the risk level of the regional grid, T time and T space Respectively represent the warning thresholds of the risk level in the time dimension and the risk level in the space dimension; S63. Design trigger conditions of time, space and pollutant concentration in a composite way and define joint warning rules: E alert =I(R overall >T overall and R time >T time and R space >T space ); Among them, E alert represents the joint warning value, I(·) represents the indicator function, and when the condition is met, E alert is 1, otherwise it is 0, R overall , R time and R space They represent the overall risk level, time dimension risk level and space dimension risk level respectively, T overall Indicates the warning threshold of the overall risk level, and means "and"; S64. When the joint warning value is 1, generate warning information, which includes warning type, involved area, warning time and pollutants.
Citation Information
Patent Citations
Time-space domain correlation prediction method for air pollutant concentration
CN109492822A
Atmospheric pollutant concentration prediction method based on multi-task learning
CN113159099A
Air quality prediction method based on traffic jam index and multi-source data fusion
CN117494034A
Air quality prediction method for mining space-time attention mechanism based on multiple relations
CN119204352A
Method for predicting air quality index (AQI) based on a fusion model
US11816556B1
Cited By
Surrounding rock stability prediction method based on mixed space-time self-attention mechanism
CN120234694A
Ecological environment prediction system and method
CN120611311A
Digital transaction risk intelligent early warning method and system based on deep learning
CN120806965A
Sequence data modeling method and system
CN120874904A
Deep space task evaluation method and device based on data fusion and multi-task attention
CN121094059A