Air pollutant concentration forecasting method, device and storage medium

Through the graph neural network-based method, the temporal and spatial dynamic characteristics of air pollutants are integrated and the neural network model is constructed, which solves the problem of low forecast accuracy in the existing technology and achieves more efficient forecasting of air pollutant concentration.

CN112766549BActive Publication Date: 2024-12-24TSINGHUA UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110017772.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-01-07
Publication Date
2024-12-24
Estimated Expiration
2041-01-07

AI Technical Summary

Technical Problem

The existing air pollutant concentration forecasting methods cannot effectively integrate the time and space dynamic characteristics of air pollutants, resulting in low generalization ability and forecast accuracy.

Method used

Using a graph neural network-based method, the spatial distribution and pollutant concentration data of air quality monitoring stations in the target area are integrated to predict air pollutant concentration by constructing an adjacency matrix and deep learning algorithm of graph structure.

Benefits of technology

It improves the accuracy and efficiency of air pollutant concentration forecasting, enhances the generalization ability of the model, and facilitates practical application.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112766549B_ABST
    Figure CN112766549B_ABST
Patent Text Reader

Abstract

A method, device and storage medium for forecasting air pollutant concentration, the method comprising: constructing a training set, a validation set and a test set according to a data set; the data set is obtained by collecting pollutant concentration data and meteorological data within a predetermined time length in a target area; constructing an adjacency matrix A of a graph structure according to the spatial distribution of monitoring sites in the target area; establishing a neural network model F(x; Θ|A), where x is input data of the neural network model, including the pollutant concentration data and meteorological data within a set time period, training the neural network model using data from the training set, adjusting parameters Θ of the neural network model using data from the validation set and data from the test set, and obtaining a revised neural network model; and forecasting air pollutant concentration using the revised neural network model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This article relates to but is not limited to air pollutant concentration forecasting technology, and in particular to an air pollutant concentration forecasting method, device and storage medium. Background Art

[0002] The method of monitoring through air quality monitoring stations is the most commonly used method for air quality perception and air pollution observation. It has the characteristics of high measurement accuracy and good stability. However, the spatial distribution of monitoring stations in my country is too sparse, making it difficult to provide effective and accurate data for analysis and research. Therefore, in view of the current status of data acquisition, it is very important to adopt a reasonable data analysis method in order to effectively analyze air pollution particles.

[0003] Among some technologies, data modeling methods for air pollutant concentrations mainly include theory-based methods and statistics-based methods. These methods can predict the air pollutant concentrations at the current or future moment based on historical air pollutant concentration monitoring data. However, none of them can integrate and utilize the temporal and spatial dynamic characteristics of air pollutants, and their generalization ability and prediction accuracy are average. Summary of the invention

[0004] The following is a summary of the subject matter described in detail herein. This summary is not intended to limit the scope of the claims.

[0005] The embodiment of the present application provides a method for predicting air pollutant concentrations, which can improve generalization ability and prediction accuracy.

[0006] The present application provides a method for predicting air pollutant concentration, including:

[0007] Constructing a training set, a validation set and a test set according to a data set; the data set is obtained by collecting pollutant concentration data and meteorological data within a predetermined time period in a target area;

[0008] Constructing an adjacency matrix A of a graph structure according to the spatial distribution of monitoring sites in the target area;

[0009] Establishing a neural network model F(x; Θ|A), where x is the input data of the neural network model, including the pollutant concentration data and meteorological data within a set time period, training the neural network model using the data of the training set, adjusting the parameter Θ of the neural network model using the data of the validation set and the data of the test set, and obtaining a modified neural network model;

[0010] The modified neural network model is used to predict the concentration of air pollutants.

[0011] An embodiment of the present application also provides an air pollutant concentration forecasting device, including a memory and a processor, wherein the memory is used to store a program for forecasting air pollutant concentrations; the processor is used to read the program for forecasting air pollutant concentrations and execute the air pollutant concentration forecasting method as described above.

[0012] The embodiment of the present application also provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are used to execute the air pollutant concentration forecasting method as described above.

[0013] The embodiment of the present application adopts an air pollutant concentration forecasting method based on a graph neural network, which integrates and utilizes the temporal and spatial dynamic characteristics of air pollutants. It can not only more effectively capture the changes in air pollutant concentrations in a larger area, but also improve the efficiency and accuracy of the prediction. At the same time, it has a high generalization ability and is convenient for practical application.

[0014] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or be understood by implementing the present application. Other advantages of the present application can be realized and obtained by the schemes described in the description and the drawings.

[0015] Other aspects will be apparent upon reading and understanding the drawings and detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The accompanying drawings are used to provide an understanding of the technical solution of the present application and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the technical solution of the present application and do not constitute a limitation on the technical solution of the present application.

[0017] Figure 1 This is a flow chart of the method for predicting air pollutant concentration in an embodiment of the present application;

[0018] Figure 2 A schematic diagram of a neural network model in an embodiment of the present application;

[0019] Figure 3 Schematic diagram of an air pollutant concentration forecasting device in an embodiment of the present application;

[0020] Figure 4 This is a schematic diagram of an air pollutant concentration forecasting device in another implementation form of an embodiment of the present application. DETAILED DESCRIPTION

[0021] The present application describes multiple embodiments, but the description is exemplary rather than restrictive, and it is obvious to those skilled in the art that there may be more embodiments and implementations within the scope of the embodiments described in the present application. Although many possible feature combinations are shown in the drawings and discussed in the specific embodiments, many other combinations of the disclosed features are also possible. Unless specifically limited, any feature or element of any embodiment may be used in combination with any other feature or element in any other embodiment, or may replace any other feature or element in any other embodiment.

[0022] The present application includes and contemplates combinations of features and elements known to those of ordinary skill in the art. The embodiments, features and elements disclosed in the present application may also be combined with any conventional features or elements to form a unique invention scheme defined by the claims. Any features or elements of any embodiment may also be combined with features or elements from other invention schemes to form another unique invention scheme defined by the claims. Therefore, it should be understood that any feature shown and / or discussed in the present application may be implemented individually or in any appropriate combination. Therefore, except for the limitations made according to the attached claims and their equivalents, the embodiments are not subject to other restrictions. In addition, various modifications and changes may be made within the scope of protection of the attached claims.

[0023] In addition, when describing representative embodiments, the specification may have presented the method and / or process as a specific sequence of steps. However, to the extent that the method or process does not rely on the specific order of the steps described herein, the method or process should not be limited to the steps of the specific order described. As will be understood by those of ordinary skill in the art, other sequences of steps are also possible. Therefore, the specific sequence of the steps set forth in the specification should not be interpreted as a limitation to the claims. In addition, the claims for the method and / or process should not be limited to the steps of performing them in the order written, and those skilled in the art can easily understand that these sequences can be changed and still remain within the spirit and scope of the embodiments of the present application.

[0024] As mentioned in the background technology, some data modeling methods for air pollutant concentrations mainly include theoretical-based methods and statistical-based methods. The inventors of this application have keenly discovered in practice that these methods have the following problems:

[0025] Theory-based methods, also known as numerical forecasting, are one of the commonly used techniques for modern weather forecasting. This type of method is generally based on the theory of atmospheric dynamics, simulating the reaction and diffusion of air pollutant particles in the atmosphere, and using numerical calculations to simulate the concentration of air pollutants. This type of method can better give the movement of the atmosphere and has a better explanation of meteorological phenomena. However, due to the extremely strong nonlinear and time-varying characteristics of meteorological system changes, modeling based on atmospheric dynamics theory is not effective for dynamic modeling of rapid changes in a short period of time. In practice, it is often necessary to use multiple systems for joint forecasting to enhance the accuracy and stability of the forecast.

[0026] Forecasting algorithms based on statistical methods, such as the integrated moving average autoregressive model (ARIMA), support vector machine regression (SVR) and deep neural network, can be used in various scenarios. Since statistical methods abandon complex mechanism modeling, they are fast, simple and require little computation, and are suitable for analyzing short-term trend changes.

[0027] However, the above methods are unable to integrate and utilize the temporal and spatial dynamic characteristics of air pollutants, and their generalization capabilities are weak, resulting in low forecast accuracy.

[0028] like Figure 1 As shown, the embodiment of the present application provides a method for predicting air pollutant concentration, comprising:

[0029] S100: constructing a training set, a validation set and a test set according to a data set; the data set is obtained by collecting pollutant concentration data and meteorological data within a predetermined time period in a target area;

[0030] S101: constructing an adjacency matrix A of a graph structure according to the spatial distribution of monitoring sites in the target area;

[0031] S102: Establish a neural network model F(x; Θ|A), where x is the input data of the neural network model, including pollutant concentration data and meteorological data within a set time period, train the neural network model using the data of the training set, and adjust the parameters Θ of the neural network model using the data of the validation set and the data of the test set to obtain a modified neural network model;

[0032] S103: Use the modified neural network model to predict air pollutant concentrations.

[0033] When executing step S100, any target area can be selected according to needs, such as selecting by province, city, county, etc., or only a certain area can be selected, not limited to a certain administrative boundary, and the embodiment of the present application does not limit this.

[0034] After selecting the target area, collect the pollutant concentration data and meteorological data of the target area within a predetermined time length. The "predetermined time length" can be set according to actual needs, such as a time length of more than 3 months. The time resolution of the data can be set as needed, such as 1 hour. Air pollutant concentration data can include PM10, PM2.5, O3, SO2, NO x The concentration data and meteorological data may include temperature, humidity, wind speed, wind direction, atmospheric pressure, etc. The missing values ​​of the pollutant concentration data and meteorological data collected within a predetermined length of time can be supplemented by calculating using a linear interpolation model, that is, the linear average of multiple data points in the time period before and after the missing part is used to fill in the values ​​of the missing data points in time, and the data set is obtained after sorting. After obtaining the data set, the data set can be used to construct a training set, a validation set, and a test set to train and adjust the neural network model.

[0035] The spatial distribution of monitoring sites in the target area in step S101 refers to the spatial distribution of air quality monitoring stations arranged in the target area.

[0036] After determining the target area, you can first collect and organize the data set, or you can first construct the adjacency matrix A of the graph structure. The execution order of these two steps can be selected as needed.

[0037] In step S102, the input data x of the neural network model F(x; Θ|A) may include pollutant concentration data and meteorological data within a set time period. The user may set the length of the "set time period" as needed. The neural network model may predict pollutant concentration data within a future period of time (the length of the future time period may also be set by the user) based on the analysis of the pollutant concentration data and meteorological data within the set time period. The parameter Θ of the neural network model may be optimized based on the gradient, such as by using the adaptive momentum algorithm Adam. This algorithm enables the process of optimizing the model parameters to converge faster, and helps to reach the optimal solution with fewer steps. The embodiment of the present application does not limit the method for optimizing the parameter Θ of the neural network model.

[0038] Using the validation data X in the validation set val and the test data X in the test set test The model parameters Θ obtained through training are further modified, that is, the parameters Θ are adjusted according to the performance of the neural network model on the validation data set to improve the prediction accuracy of the neural network model and obtain better generalization performance.

[0039] The embodiment of the present application is based on a graph neural network and uses a deep learning algorithm to predict the concentration of air pollutants. By constructing the spatial distribution of air quality monitoring stations arranged in the target area into an adjacency matrix of a graph structure, the spatial changes in the concentration of air pollutants in the modeling area are modeled using a graph neural network. It is possible to more effectively capture the changes in the concentration of air pollutants in a larger area. In addition, by combining the pollutant concentration data and meteorological data within a predetermined length of time in the target area for modeling and analysis, the temporal and spatial dynamic characteristics of air pollutants are effectively integrated and utilized, the prediction accuracy is improved, and a strong generalization ability is obtained.

[0040] In an exemplary embodiment, constructing a training set, a validation set, and a test set according to a data set includes:

[0041] Reading pollutant concentration data and meteorological data from the data set, wherein the pollutant concentration data includes values ​​of various pollutant concentrations, and the meteorological data includes values ​​of various meteorological conditions;

[0042] According to the input time length t required for forecast in , output time length t out , after sliding window slicing operation on the data set in the time dimension, multiple data segments are obtained, the length of each of the multiple data segments in the time dimension is t, and the characteristic dimensions of the multiple data segments are the values ​​of various meteorological conditions and the values ​​of various pollutant concentrations, where t = t in +t out ;

[0043] Construct training sets, validation sets, and test sets based on the multiple data segments obtained.

[0044] In the above step S103, the modified neural network model is used to predict the concentration of air pollutants, which can be a neural network model for the input time length t in Analyze the data in and predict the output time length t accordingly out Therefore, the data in the data set is divided into multiple data segments in advance, and the length of each data segment in the time dimension is t=t in +t out , and construct training sets, validation sets, and test sets based on the multiple data fragments obtained, which can facilitate the training and parameter adjustment of the neural network model.

[0045] Input time length t in and output time length t out You can set it as needed, such as setting t in is 72 hours, t out The time period is 24 hours, which is not limited in the present embodiment of the present application.

[0046] When constructing a training set, a validation set, and a test set, you can select from multiple data fragments as needed, or you can divide them according to a certain ratio, such as: you can divide all data fragments of the data set into 70%, 10%, and 20% ratios in terms of quantity, and allocate them to the training set, validation set, and test set respectively. The embodiment of the present application does not limit the method of data selection or division when constructing a training set, validation set, and test set.

[0047] Figure 2 This is a schematic diagram of a neural network model in an embodiment of the present application. Figure 2 The air pollutant concentration forecasting method of the embodiment of the present application is described.

[0048] In an exemplary embodiment, training a neural network model using a training set includes:

[0049] The data (x, y) in the training set is sent to the neural network model F(x; Θ|A) in batches for training to obtain the predicted output Calculating the loss function Optimize the model parameters Θ based on the gradient descent algorithm;

[0050] Among them, y is the pollutant concentration data; the neural network model F(x; Θ|A) includes: an input layer, a hidden layer and an output layer, and the hidden layer includes multiple self-attention modules based on graph convolution layers and one-dimensional convolution layers.

[0051] The training set data X can be divided as needed train batches and batches, and convert (x, y)∈X by batch train The data is sent to the neural network model for training. The embodiment of the present application does not limit the way of dividing the training set data.

[0052] In an exemplary embodiment, the neural network model F(x; Θ|A) may include: a linear input layer, a hidden layer and a linear output layer. The linear input layer and the linear output layer can perform linear mapping on the input data of their respective layers. Assuming that the input is x and the output is y, the linear layer can be expressed as y=xw+b, where w and b are linear layer parameters. The linear layer parameters of the linear input layer and the linear output layer can be set as needed, and the embodiments of the present application are not limited to this.

[0053] The hidden layer of the neural network model F(x; Θ|A) can include a stack of two sets of modules based on the self-attention mechanism, such as a temporal self-attention module and a graph node self-attention module. By introducing modules based on the self-attention mechanism, the network's ability to extract features can be effectively improved, data can be used more fully, and the efficiency and accuracy of prediction can be improved. At the same time, the constructed neural network model has a higher generalization ability, which is convenient for practical application and has great practical significance.

[0054] In an exemplary embodiment, according to the spatial distribution of monitoring sites in the target area, an adjacency matrix A of a graph structure is constructed, including:

[0055] The longitude and latitude coordinates of the monitoring stations are read from the data set and converted into relative coordinates in the Cartesian coordinate system. The following adjacency matrix is ​​constructed based on the distances between the monitoring stations:

[0056]

[0057] Among them, A ij is the element in the i-th row and j-th column of the adjacency matrix, d ij represents the distance between monitoring site i and monitoring site j, σ is the standard deviation of the distances between all monitoring sites, and κ is a preset hyperparameter used to ensure the sparsity of the adjacency matrix.

[0058] The preset hyperparameter κ (i.e., Kappa) is used to ensure that there are enough 0s in the adjacency matrix to ensure the sparsity of the graph connection. In the embodiment of the present application, κ is set to 0.1, but the value can be set according to needs, and the embodiment of the present application does not limit this.

[0059] Based on the longitude and latitude coordinates of the air quality monitoring stations, the spatial distribution of the monitoring stations can be obtained, and the air pollutant concentration data can be captured over a wider range. Combined with the air pollutant concentration data of the target area over a period of time, the spatiotemporal variation characteristics of the air pollutant concentration can be jointly modeled, giving the entire model stronger expressive power and higher prediction accuracy.

[0060] In an exemplary embodiment, the input data x of the neural network model F(x; Θ|A) is subjected to z-score normalization in the feature dimension so that the input data x has zero mean and unit standard deviation, that is:

[0061]

[0062] Among them, the superscript (c) represents the c-th feature dimension, represents the input data x that has been z-score standardized on the cth feature dimension, μ represents the average value of the data points, and σ represents the standard deviation of the distances between all monitoring sites. After the input data x is z-score standardized on the feature dimension, the input data x has zero mean and unit standard deviation. At this time, the neural network model F(x; Θ|A) is input for training, which is more conducive to the learning of the neural network model.

[0063] The dimension of the tensor that constitutes the input data x of the neural network model is N×T×G×C, where N represents batch, T represents time, G represents graph node, and C represents feature dimension, and the same applies below.

[0064] In an exemplary embodiment, data is operated in the hidden layer in the following order:

[0065] First, perform a temporal self-attention operation, then perform a one-dimensional convolution operation with gated linear activation in the time dimension, a graph node self-attention operation, a first-order Chebyshev graph convolution operation with residual connection in the graph node dimension, and a one-dimensional convolution operation with residual connection in the time dimension;

[0066] Among them, in the above operations, the operation result data of the previous operation is used as the input data of the next operation.

[0067] The above operation can be performed by the self-attention module in the hidden layer.

[0068] In an exemplary embodiment, the temporal self-attention operation includes:

[0069] When the dimension of the input data x1 of the temporal self-attention operation is N×T×G×C, the input data x1 is passed through two graph convolutional layers respectively. and θ G After the operation, we can get and z2 = θ G (x1|A);

[0070] The features z1 and z2 obtained after the operation are transformed into N×T×GC, and the softmax operation is performed row by row after batch matrix multiplication on the last dimension to obtain the self-attention relationship The dimension of the self-attention relation a1 is N×T×T;

[0071] Then, the self-attention relationship a1 is right-multiplied in batches on the linear mapping of the input data x1, and multiplied by the preset scaling factor γ, and transformed into N×T×G×C, and then added to the input data x1 to obtain the temporal self-attention operation result y1 and output it, that is, y1=x1+γbmm(ψ(x1), a1), where ψ is the linear layer and y1 is the output of the temporal self-attention module. The scaling factor γ is used to ensure that the change in attention is small enough to make the neural network model easier to train. The value of the scaling factor γ can be set to 0.1, but the embodiment of the present application does not limit the setting of the value of the scaling factor γ.

[0072] In an exemplary embodiment, a one-dimensional convolution operation with gated linear activation in the time dimension includes:

[0073] When the dimension of the input data x2 of the one-dimensional convolution operation with gated linear activation in the time dimension is N×L×C1, the gated linear activation performs a convolution operation on the input data x2 in dimension L to obtain an output z with a dimension of N×L×2C2, where L is the length of a single sample, C1 is the feature dimension of the input data x2, and C2 is the dimension of the set output;

[0074] Split z into z3 and z4 according to the feature dimension. The dimensions of z3 and z4 are both N×L×C2. After z3 is activated by the sigmoid function, it is element-wise multiplied by z4 to obtain the operation result y2 and output it, that is, in, represents element-by-element multiplication, and y2 is the output of a one-dimensional convolution module with gated linear activation.

[0075] In an exemplary embodiment, the graph node self-attention operation includes:

[0076] When the dimension of the input data x3 of the graph node self-attention operation is N×T×G×C, the input data x3 is passed through two one-dimensional convolutional layers respectively. and θ T After the operation, we can get and z6 = θ T (x3);

[0077] The features z5 and z6 obtained after the operation are transformed into N×G×TC dimensions, and softmax operations are performed row by row after batch matrix multiplication on the last dimension to obtain the self-attention relationship The dimension of the self-attention relation a2 is N×G×G;

[0078] The self-attention relationship a2 is then right-multiplied on the linear mapping of the input data x3 in batches, and multiplied by the preset scaling factor γ, transformed into N×T×G×C, and then added to the input data x3 to obtain the graph node self-attention operation result y3 and output it, that is, y3=x3+γbmm(ψ(x3), a2), where ψ is a linear layer.

[0079] In an exemplary embodiment, a first-order Chebyshev graph convolution operation with residual connections in the graph node dimension includes:

[0080] For each node, the features of itself and other nodes in the one-hop neighborhood are calculated respectively, and then normalized symmetrically according to the degree matrix, that is,

[0081]

[0082] Among them, θ is a parameter, x4 is the input data for the first-order Chebyshev graph convolution operation with residual connection in the graph node dimension, D is a symmetric matrix, and D ii =∑ j A ij is the degree matrix of the graph;

[0083] After performing the first-order Chebyshev graph convolution operation, the result y4 is obtained and output, y4=x4+LReLU(g θ (x4)), LReLU is a LeakyReLU activation function, and its negative semi-axis slope can be set to 0.1, which is not limited in the present embodiment. y4 is the output of the Chebyshev graph convolution module.

[0084] In an exemplary embodiment, a one-dimensional convolution operation with a residual connection in the time dimension can be performed in a manner known to those skilled in the art, which will not be described in detail here.

[0085] In an exemplary embodiment, the loss function is a smooth one-norm loss function,

[0086] For each predicted value Calculate the error value e i ,

[0087] Among them, s is a hyperparameter that controls the error size. i When <1, the loss function is When e i ≥1, the loss function is l i =e i -0.5, the total loss function is

[0088] Using a smooth one-norm loss function can make the training process of the neural network model more stable and accelerate convergence. You can also use two-norm, one-norm and other loss functions for regression problems. The embodiment of the present application does not limit the choice of loss function.

[0089] Compared with traditional methods and other deep learning-based air pollutant concentration prediction methods, the method of the embodiment of the present application collects air data from multiple air quality monitoring stations in the target area over a long period of time; preprocesses these data to obtain data sets for training, verification and testing; uses the training data to train a deep learning model based on a graph neural network, iteratively calculates and optimizes the loss function, and obtains a model with stronger prediction capabilities. This method jointly models the spatiotemporal variation characteristics of air pollutant concentrations and introduces a self-attention mechanism, which has stronger expression capabilities and effectively reduces the error of air pollutant concentration prediction.

[0090] like Figure 3 As shown, an embodiment of the present application also provides an air pollutant concentration forecasting device, including a memory and a processor, the memory being used to store a program for forecasting air pollutant concentrations; the processor being used to read the program for forecasting air pollutant concentrations and execute the air pollutant concentration forecasting method in any of the above embodiments.

[0091] In an exemplary embodiment, Figure 4 As shown, the air pollutant concentration forecasting device provided in the embodiment of the present application may include a receiving module, a preprocessing module, a building module, a learning module and an output module.

[0092] Figure 4 The receiving module of the air pollutant concentration forecasting device is used to receive the user's settings, such as: the selected target area, what types of air pollutant concentration data and meteorological data are needed, the input time length, the output time length, the time resolution of the data, and the data distribution ratio of the training set, the validation set and the test set, the hyperparameters required for the neural network model, etc., which need to be initially set by the user in the above embodiments. The receiving module can provide prepared configuration options for the user to choose (such as displaying configurable options on the panel, which can be selected, filled in or deleted by the user), or the user can directly input them. The user can enter all the setting parameters at one time, or can enter them step by step according to the aforementioned method flow. The embodiment of the present application does not limit the way and form in which the receiving module receives the user's settings.

[0093] After the receiving module receives the user's settings, the data collected by the pre-set multiple sensors are:

[0094] The preprocessing module performs preprocessing operations such as supplementing missing values ​​and slicing on the air pollutant concentration data and meteorological data according to the user's settings, and organizes the data set to obtain the training set, validation set and test set.

[0095] The construction module constructs the adjacency matrix A of the graph structure according to the spatial distribution data of the monitoring sites.

[0096] The learning module establishes a neural network model F(x; Θ|A) according to the data sent by the preprocessing module and the construction module, as well as the user's settings, and performs the training and parameter adjustment process of the neural network model to obtain a revised neural network model; then, according to the user's setting rules (such as input time length, output time length, etc.), the revised neural network model is used to predict the concentration of air pollutants, and the output module outputs the forecast results.

[0097] The air pollutant concentration forecasting device can implement the air pollutant concentration forecasting method in any of the above-mentioned embodiments, and the implementation details are not repeated here.

[0098] An embodiment of the present application also provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are used to execute the air pollutant concentration forecasting method in any of the above embodiments.

[0099] The following example 1 is used to illustrate the method for predicting air pollutant concentration in the embodiment of the present application:

[0100] Example 1

[0101] First, a target city was selected and the air pollutant concentration data of the target city were collected every hour from 0:00 on September 1, 2017 to 23:00 on March 31, 2018, including: PM10, PM2.5, O3, SO2, NO x Etc., and meteorological data, including: temperature, humidity, wind speed, wind direction, atmospheric pressure, etc.; the linear average of the 20 data points before and after the missing data point is used to fill in the missing data points in time to supplement the missing values ​​and organize them into a data set.

[0102] Then according to the input time length t required for forecasting in =72h, output time length t out = 24h, and perform sliding window slicing on the data set in the time dimension so that the length of each data segment is t = t in +t out =96h, and on this basis, the training set, validation set and test set are constructed, with the proportions of 70%, 10% and 20% respectively.

[0103] In addition, the adjacency matrix A of the graph structure is constructed according to the spatial distribution of the 35 monitoring stations in the target city. The method is to convert the longitude and latitude coordinates of each monitoring station into relative coordinates in the Cartesian coordinate system, calculate the pairwise distances between stations, and construct the following adjacency matrix:

[0104]

[0105] Among them, d ij represents the distance between monitoring site i and monitoring site j, σ is the standard deviation of all distances, κ = 0.1 is a hyperparameter to ensure the sparsity of the adjacency matrix, A jj is the element in the i-th row and j-th column of the adjacency matrix.

[0106] Then, a neural network model F(x; Θ|A) is established, which consists of an input linear layer, two self-attention modules and an output linear layer, and the internal feature dimension is 128. The self-attention module first performs a temporal self-attention operation on the input data, and then performs a one-dimensional convolution operation with gated linear activation in the time dimension, a graph node self-attention operation, a first-order Chebyshev graph convolution operation with residual connection in the graph node dimension, and a one-dimensional convolution operation with residual connection in the time dimension.

[0107] For the temporal self-attention module: the dimension of the input data x1 is N×T×G×C, which is calculated through two graph convolution layers respectively. and z2 = θ G (x1|A), where and θ G Represents the graph convolution layer; the transformed features z1 and z2 are transformed into N×T×GC, and the batch matrix multiplication is performed on the last dimension followed by a row-by-row softmax operation to obtain the self-attention relationship The dimension is N×T×T; then this relationship is right-multiplied on the linear mapping of the input data x1 in batches, and multiplied by the scaling factor γ=0.1, and finally transformed into N×T×G×C, and added to the input data x1, that is, y1=x1+γbmm(ψ(x1), a), where ψ is the linear layer, and the module output is obtained.

[0108] For the one-dimensional convolution module with gated linear activation: the dimension of the input data x2 is N×L×C1, where L is the length of a single sample and C1 is the feature dimension of the input data. The gated linear activation performs a convolution operation on the input data x2 on the dimension L, and the output z dimension is N×L×2C2, where C2 is the dimension of the set module output. Split z in half according to the feature dimension into z3, z4, and the dimensions of z3 and z4 are all N×L×C2. After z3 is activated by the sigmoid function, it is element-wise multiplied by z4 to obtain the output of the module. in Represents element-wise multiplication.

[0109] For the graph node self-attention module: the dimension of the input data x3 is N×T×G×C, which is calculated through two one-dimensional convolutional layers respectively. and z6 = θ T (x3), where and θ T Represents a one-dimensional convolutional layer; transform the transformed features z5 and z6 into N×G×TC dimensions, and perform softmax operations on the last dimension after batch matrix multiplication to obtain the self-attention relationship The dimension is N×G×G; then this relationship is right-multiplied on the linear mapping of the input data in batches, and multiplied by the scaling factor γ=0.1, and finally transformed into N×T×G×C, and added to the input data x3, that is, y3=x3+γbmm(ψ(x3), a2), where ψ is the linear layer, and the module output y3 is obtained.

[0110] For the Chebyshev graph convolution module: For each node, calculate the features of itself and other nodes in the one-hop neighborhood, and normalize them symmetrically according to the degree matrix, that is, Among them, θ is a parameter, D is a symmetric matrix, and D ii =∑ j A ij is the degree matrix of the graph, and the output is y4=x4+LReLU(g θ (x4)), LReLU is the LeakyReLU activation function, and its negative semi-axis slope is taken as 0.1.

[0111] The training set data (x, y)∈X train The data is fed into the neural network model in batches for training. The dimension of the input data x is N (batch) × T (time) × G (graph node) × C (feature dimension). Before entering the neural network model, z-score normalization is performed on the feature dimension to make it have zero mean and unit standard deviation, that is:

[0112]

[0113] Among them, the superscript (c) represents the cth feature dimension, μ represents the mean value of the data point, and σ represents the standard deviation of the data point. After the input is calculated as described above, the predicted output is obtained. Calculating the loss function And optimize the parameters Θ of the model based on the gradient.

[0114] During training, the loss function used is a smooth one-norm loss function, for each predicted value calculate Where s is a hyperparameter that controls the error size. i When <1, the loss function When e i When ≥1, the loss function is l i =e i -0.5, the total loss function is

[0115] During the training process, all layers in the network are initialized with a standard deviation of 0.01, and the Adam optimizer is used with a learning rate of 0.01. The training set is trained for 100 rounds, and the mean absolute error (MAE) of the validation set is monitored in each round of training. Training is stopped when the validation set error does not decrease for 10 consecutive rounds, otherwise training is continued; the learning rate is reduced to 0.1 at the 30th, 65th, and 95th rounds; at the same time, L2 regularization with a strength of 0.0005 is applied to the model to prevent overfitting.

[0116] Finally, by verifying the data X val And test data X test Fine-tune the model parameters obtained from the training, that is, input the air pollutant concentration data in the test set into the trained model, further correct the model's hyperparameters according to the performance on the test set, retrain to improve the model accuracy, and use the corrected neural network model as the air pollutant concentration prediction model.

[0117] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In hardware implementations, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all components may be implemented as software executed by a processor, such as a digital signal processor or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those of ordinary skill in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.

Claims

1. A method for predicting air pollutant concentration, characterized in that: include: Construct training set, validation set and test set according to the data set; The data set is obtained by collecting pollutant concentration data and meteorological data within a predetermined time period in the target area; According to the spatial distribution of monitoring sites in the target area, an adjacency matrix of the graph structure is constructed. ; Building a neural network model , The input data of the neural network model includes the pollutant concentration data and meteorological data within a set time period, the neural network model is trained using the data of the training set, and the parameters of the neural network model are adjusted using the data of the validation set and the data of the test set. , obtain the modified neural network model; Using the modified neural network model to predict air pollutant concentrations; The step of training the neural network model using the data of the training set includes: The data in the training set The neural network model is fed into batches for training to obtain the predicted output , calculate the loss function , optimize the model parameters based on the gradient descent algorithm ; Wherein, y is the pollutant concentration data; the neural network model includes: an input layer, a hidden layer and an output layer, and the hidden layer includes a plurality of self-attention modules based on a graph convolution layer and a one-dimensional convolution layer; The data is operated in the following order in the hidden layer: First, perform a temporal self-attention operation, then perform a one-dimensional convolution operation with gated linear activation in the time dimension, a graph node self-attention operation, a first-order Chebyshev graph convolution operation with residual connection in the graph node dimension, and a one-dimensional convolution operation with residual connection in the time dimension; Among them, in the above operations, the operation result data of the previous operation is used as the input data of the next operation to perform the operation; The temporal self-attention operation includes: When the input data of the time self-attention operation The dimension is When the input data Through two graph convolutional layers respectively After the operation, we can get and ; Where N represents batch, T represents time, G represents graph node, and C represents feature dimension; The The deformation dimension is , and perform softmax operation on the last dimension after batch matrix multiplication to obtain the self-attention relationship , the self-attention relationship The dimension is ; Then the self-attention relationship Multiply the input data by batch right The linear map is multiplied by the preset scaling factor. After that, it transforms into , and then with the input data Add together to get the time self-attention operation result And output; The one-dimensional convolution operation with gated linear activation in the time dimension includes: When the input data of the one-dimensional convolution operation with gated linear activation in the time dimension The dimension is When the input data In Dimension The result of the convolution operation is activated to get the output , The dimension is ,in, is the length of a single sample, For input data The characteristic dimension of The dimension of the output to be set; Will Split in half according to feature dimension , The dimensions of ,Will After activation by sigmoid function, multiply by element Get the result of the operation And output, ,in, Represents element-wise multiplication; The graph node self-attention operation includes: When the input data of the graph node self-attention operation The dimension is When the input data Through two one-dimensional convolutional layers respectively After the operation, we can get and ; The The deformation dimension is , and perform softmax operation on the last dimension after batch matrix multiplication to obtain the self-attention relationship , the self-attention relationship The dimension is ; Then the self-attention relationship Multiply the input data by batch right The linear map is multiplied by the preset scaling factor. After that, it transforms into , and then with the input data Add together to get the self-attention operation result of the graph node And output; The first-order Chebyshev graph convolution operation with residual connection in the graph node dimension includes: For each node, the features of itself and other nodes in the one-hop neighborhood are calculated respectively, and then normalized symmetrically according to the degree matrix, that is, in, As parameters, is the input data for performing the first-order Chebyshev graph convolution operation with residual connection in the graph node dimension, is a symmetric matrix, is the degree matrix of the graph; After performing a first-order Chebyshev graph convolution operation, we get the result And output, , LReLU is the LeakyReLU activation function.

2. The method for predicting air pollutant concentration according to claim 1, characterized in that: The step of constructing a training set, a validation set, and a test set according to the data set includes: Reading pollutant concentration data and meteorological data from the data set, wherein the pollutant concentration data includes values ​​of various pollutant concentrations, and the meteorological data includes values ​​of various meteorological conditions; Input time length according to forecast requirements , Output time length , after performing a sliding window slicing operation on the data set in the time dimension, a plurality of data segments are obtained, and the lengths of the plurality of data segments in the time dimension are , the characteristic dimensions of the multiple data segments are the values ​​of various meteorological conditions and the values ​​of various pollutant concentrations, wherein, ; A training set, a validation set, and a test set are constructed according to the obtained multiple data segments.

3. The method for predicting air pollutant concentration according to claim 1, characterized in that: The adjacency matrix of the graph structure is constructed according to the spatial distribution of the monitoring sites in the target area. ,include: The longitude and latitude coordinates of the monitoring sites are read from the data set and converted into relative coordinates in a Cartesian coordinate system. The following adjacency matrix is ​​constructed based on the distances between the monitoring sites: in, is the adjacency matrix Line The elements of the column, Indicates monitoring site With monitoring sites The distance between is the standard deviation of the distances between all monitoring sites, is a preset hyperparameter used to ensure the sparsity of the adjacency matrix.

4. The method for predicting air pollutant concentration according to any one of claims 1 to 3, characterized in that: The input data of the neural network model The input data is z-score normalized on the feature dimension so that has zero mean and unit standard deviation, that is Among them, the superscript (c) represents the c-th feature dimension, Represents the input data that has been subjected to the z-score normalization process on the cth feature dimension , represents the average value of the data points, represents the standard deviation of the distances between all monitoring sites; The input data of the neural network model The dimension of the tensor is N T G C.

5. The method for predicting air pollutant concentration according to claim 1, characterized in that: The loss function is a smooth one-norm loss function, For each predicted value , calculate the error value , , in, is a hyperparameter that controls the error size. When , the loss function is ,when When , the loss function is , the total loss function is .

6. An air pollutant concentration forecasting device, comprising a memory and a processor, characterized in that: The memory is used to store a program for forecasting the concentration of air pollutants; the processor is used to read the program for forecasting the concentration of air pollutants and execute the method for forecasting the concentration of air pollutants as described in any one of claims 1-5.

7. A computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are used to execute the method according to any one of claims 1 to 5.