Air quality prediction method and system based on meta-pattern mining
By using a meta-pattern mining method, self-supervised learning and spatiotemporal cue generation technology, the spatiotemporal heterogeneity problem in air quality prediction is solved, efficient and accurate air quality prediction is achieved, and the adaptability and prediction accuracy of the model are enhanced.
Patent Information
- Application Number
- CN202510686208.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-27
- Publication Date
- 2025-09-05
AI Technical Summary
Existing air quality prediction methods have difficulty in effectively capturing local differences and dynamic changes when dealing with scenes with high spatiotemporal heterogeneity, resulting in decreased prediction performance.
A meta-pattern mining-based method is adopted to mine meta-patterns by constructing self-supervised learning tasks. Graph convolutional networks and temporal convolutional networks are combined to generate spatiotemporal cues, capture spatiotemporal heterogeneity, and guide the modeling process through spatiotemporal cues to overcome the interference of spatiotemporal heterogeneity.
It achieves accurate and robust air quality prediction, enhances the model's adaptability to complex scenarios, can dynamically capture spatiotemporal dependencies, and improves prediction accuracy and robustness.
Smart Images

Figure CN120596830A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of spatiotemporal data mining, and in particular to an air quality prediction method and system based on meta-pattern mining. Background Art
[0002] To improve the urban environment, timely air quality control tailored to different air quality levels and conditions is an effective means. Therefore, providing accurate air quality monitoring and forecasting is a crucial step. For air quality influenced by multiple complex factors, providing more accurate air quality forecasts through spatiotemporal predictions can facilitate more effective measures to improve urban air quality. Existing forecasting methods typically average large datasets, which may demonstrate good predictive capabilities at a macro level. However, because they ignore spatiotemporal heterogeneity, they struggle to effectively capture local variations and dynamic changes in spatiotemporal patterns, resulting in significantly reduced forecasting performance in highly heterogeneous spatiotemporal scenarios. For example, due to factors such as geographic location, population density, and weather variations, air quality in urban centers and suburbs can differ significantly, reflecting spatial heterogeneity. Similarly, air quality in the same region can exhibit distinct patterns under different weather conditions, reflecting temporal heterogeneity.
[0003] Therefore, existing spatiotemporal prediction methods still find it difficult to efficiently and comprehensively capture and utilize spatiotemporal heterogeneity in air quality prediction.
[0004] There is a need in the art for an improved air quality prediction method that can provide efficient, accurate and comprehensive spatiotemporal prediction of complex air quality with high spatiotemporal heterogeneity in environmental monitoring and prediction applications. Summary of the Invention
[0005] In view of the above problems, the present invention provides an air quality prediction method and system based on meta-pattern mining, which captures spatiotemporal heterogeneity through flexible spatiotemporal cue generation, constructs an offline self-supervised learning task to mine meta-patterns to enhance spatiotemporal cues, and finally uses spatiotemporal cues to efficiently guide the spatiotemporal modeling process, thereby overcoming the interference of spatiotemporal heterogeneity and achieving accurate and robust air quality prediction.
[0006] An air quality prediction method based on meta-pattern mining according to one embodiment of the present invention is used to provide spatiotemporal prediction of air quality, comprising the following steps:
[0007] Step S1: collect historical spatiotemporal data within the spatial area to be predicted and perform standardization processing to obtain a standard data set including historical spatiotemporal series. The collected historical spatiotemporal data includes PM2.5 concentration data.
[0008] Step S2: Construct a prediction model based on meta-pattern mining and prompt guidance. This prediction model is a unified framework with an encoder and a decoder. It encodes historical spatiotemporal sequences through graph convolutional networks and temporal convolutional networks to capture spatial and temporal dependencies, captures spatiotemporal heterogeneity by generating spatiotemporal prompts, and guides the spatiotemporal modeling process together with the offline mined meta-patterns to overcome the interference of spatiotemporal heterogeneity.
[0009] Step S3, using the standard data set obtained in step S1 to train the constructed prediction model based on meta-pattern mining and prompt guidance to obtain a trained prediction model;
[0010] Step S4: Apply the trained prediction model to the prediction of future spatiotemporal data to obtain spatiotemporal prediction results for air quality, and use the spatiotemporal prediction results to plan air quality solutions.
[0011] Optionally, in step S1, the collected historical spatiotemporal data in the spatial area to be predicted is standardized, and the processing process is as follows:
[0012] The spatial area to be predicted is divided into N sub-areas, and the historical spatiotemporal data of each time period in each sub-area are counted; the historical spatiotemporal data of each time period in each sub-area are input into a three-dimensional array in the format of B*T*N to obtain a standard data set including historical spatiotemporal sequences, where B represents the data batch, T represents the length of the time series, and N represents the total number of spatial nodes. Each data point in the standard data set represents the PM2.5 concentration data of a spatial node in a certain data batch at a time step.
[0013] Optionally, step S2 specifically includes the following steps:
[0014] Step S2.1, building the backbone network of the prediction model;
[0015] Step S2.2: construct a self-supervised meta-pattern mining module, which mines discriminative meta-patterns in the feature space through self-supervised learning and stores them as a meta-pattern library. This is used to retrieve local trend information by inputting historical spatiotemporal sequences into the meta-pattern library.
[0016] Step S2.3: construct a spatiotemporal cue generation module to generate specific cue vectors in time and space to capture spatiotemporal heterogeneity and obtain fused spatiotemporal cues;
[0017] In step S2.4, a spatiotemporal cue guidance module is constructed to perform feature splicing on the meta-pattern and the fused spatiotemporal cue to obtain enhanced spatiotemporal cue. After inputting the cue into the encoder of the prediction model, the encoded spatiotemporal representation is cue-guided to overcome the interference of heterogeneity on spatiotemporal modeling.
[0018] Optionally, step S2.2 specifically includes the following steps:
[0019] Step S2.2.1: Divide the historical spatiotemporal sequence in the standard dataset into several prediction segments and randomly shuffle them as the original data. Then, map the original data from the data space to the feature space to obtain the mapped feature vector:
[0020]
[0021] Where H represents the mapped eigenvector and d h is the feature dimension of the hidden layer, N is the total number of spatial nodes, and MLP1 is the historical spatiotemporal sequence segment X t-P+1:t The feature mapping network of MLP2 is the future spatiotemporal sequence fragment Feature mapping network;
[0022] Step S2.2.2, based on the soft clustering process in the feature space, the meta-patterns in the historical prediction fragments are mined, and K randomly initialized trainable parameters are used as prototypes to establish the meta-pattern library C = {c1,…,c j …,c K}, and as the cluster center, the probability of assigning the feature vector to the prototype is obtained:
[0023]
[0024] p i =[p i,1 ,p i,2 ,…,p i,K ]
[0025] Among them, p i Represents the probability vector of assigning the i-th feature vector to each prototype, p i,k represents the probability of assigning the i-th eigenvector to the k-th prototype, exp(·) represents the natural exponential function, sim(·) is the cosine similarity measure, and c k represents the kth prototype, k represents the prototype index and k=1,…K, γ is the temperature parameter used to control the smoothness of the distribution, h i represents the i-th sample in the mapped feature vector H, where i represents the index of the feature vector sample and i=1,…N, c r Represents the r-th prototype in the meta-pattern library, r is the prototype index and r=1,…K, the feature dimension of the cluster center C is the same as the feature dimension of the mapped feature vector H, both are Represents a domain;
[0026] Step S2.2.3, constructing the sample pair selection part includes selecting positive and negative sample pairs from the mapped feature vector H based on dynamic spatial similarity, as follows:
[0027]
[0028] Where B represents the batch size selected from the mapped feature vector H, b represents the sample index in the selected feature vector batch and b = 1, ... B, H b represents the bth sample in the selected feature vector batch, Represents the positive sample index corresponding to the i-th sample of the feature vector, A ij represents the similarity between the i-th sample and the j-th sample in the feature vector, τ represents the threshold for selecting positive samples, Rand(·) represents random selection from the set, argmax j A ij Indicates the sample index j that is most similar to sample i in the obtained average sample similarity matrix, A is the average sample similarity matrix in the currently selected feature vector batch, and the average sample similarity matrix in the currently selected feature vector batch is normalized by translation. After diagonal masking diag(A)=-∞, sample selection is performed;
[0029] Step S2.2.4, the meta-pattern library construction part includes calculating the multi-classification cross entropy based on the sample-to-prototype assignment probability of the obtained feature vector and the sample-to-prototype assignment probability of the selected positive sample pairs:
[0030]
[0031] in, represents the probability of assignment between the positive sample of the i-th sample of the feature vector and the k-th prototype, L ce represents the cross entropy loss;
[0032] Using the multi-class cross entropy as the optimization target, the self-supervisory signal required for the self-supervised learning task is constructed;
[0033] Step S2.2.5, constructing the feature enhancement part, includes adding random masks and Gaussian noise to the positive and negative sample pairs selected from the mapped feature vectors:
[0034]
[0035] in, represents the enhanced eigenvector, ⊙ is the Hadamard product operation, M is the random mask matrix, ε is Gaussian noise, A sample h representing a feature vector i Positive and negative samples;
[0036] Step S2.2.6, constructing the feature enhancement portion, further includes employing a contrastive learning strategy based on the positive and negative sample pairs selected from the mapped feature vectors to bring the positive sample pairs closer together and push the negative sample pairs further apart in the feature space. The contrastive learning strategy is as follows:
[0037]
[0038] Among them, L ctr represents the contrastive learning loss, Represents the cosine similarity of the positive sample pair of the i-th sample of the feature vector, Represents the cosine similarity of the negative sample pair of the i-th sample of the feature vector;
[0039] Step S2.2.7, constructing the prototype regularization part includes adding a uniform regularization term to encourage the samples to be evenly distributed among the prototypes based on the probability of assigning the samples to the prototypes of the feature vector:
[0040]
[0041] Among them, L uni represents uniform regularization loss, 1 K represents a vector of all ones of length K, and KL(·) represents the KL divergence;
[0042] Step S2.2.8, constructing the prototype regularization part also includes adding a distance regularization term:
[0043]
[0044] Among them, L dist represents the distance regularization loss, c r′ represents the r′th prototype in the meta-pattern library, where r′ is the prototype index and r′=1,…K;
[0045] In step S2.2.9, the following optimization objectives are constructed to establish a self-supervised meta-pattern mining module:
[0046] L ssl =L ce +L ctr +λ reg (L uni +L dist )
[0047] Among them, L ssl represents the total loss of the self-supervised meta-pattern mining module, λ reg is the coefficient of the regularization term.
[0048] Optionally, step S2.3 specifically includes the following steps:
[0049] Step S2.3.1, build the spatial hint generation part, randomly initialize a trainable spatial node embedding for each spatial node in the standard dataset obtained in step S1 To capture spatial heterogeneity, the trainable spatial node embeddings are spatial cues;
[0050] Step S2.3.2: Construct the temporal cue generation part, which captures temporal heterogeneity by combining prior embedding and memory network to generate multi-scale temporal cues. T represents the total length of the time step;
[0051] Step S2.3.3, combine the generated time hint E t With space prompt E s , perform dimension expansion and summation to obtain the fused spatiotemporal prompt:
[0052]
[0053] Among them, E st Indicates fused spatiotemporal cues and 1 N Represents a vector of all 1s of length N, 1 T Represents a vector of all 1s of length T.
[0054] Optionally, step S2.3.2 specifically includes the following steps:
[0055] First, the multi-scale time prior knowledge is mapped from discrete to continuous feature space to obtain the mapped time prior knowledge:
[0056] e m =Embedding(t m )
[0057] Among them, e m represents the embedding vector of the mth time prior knowledge, Embedding(·) represents the embedding operation, t m represents the value of the mth time prior knowledge, m represents the number of the time prior knowledge, and m = 1, 2, ..., M, where M is the total number of selected time prior knowledge; the multi-scale time prior knowledge includes month, date, time step, week, whether it is a weekday, and whether it is a holiday;
[0058] Then, based on the mapped temporal prior knowledge, the feature fusion network adaptively learns the importance of different prior knowledge and obtains a multi-scale temporal fusion representation as a temporal cue:
[0059] E t =concat(e1,e2,…e m ,…,e M )W t+b t
[0060] Among them, E t It is a multi-scale temporal fusion representation and Y represents the total length of the time step, concat(·) represents the concatenation process, and W t is the weight of the feature fusion network and d m represents the embedding dimension of the mth time prior knowledge, b t is the bias of the feature fusion network and
[0061] Optionally, step S2.4 specifically includes the following steps:
[0062] Step S2.4.1: Input the historical spatiotemporal sequence into the meta-pattern library, perform meta-pattern query and fusion, and obtain the fused meta-pattern;
[0063] Step S2.4.2, combining the fused spatiotemporal cue and the fused meta-pattern to enhance the spatiotemporal cue and obtain enhanced spatiotemporal cue;
[0064] In step S2.4.3, the enhanced spatiotemporal cues are input into the encoder of the prediction model based on meta-pattern mining and cue guidance, and spatiotemporal cue guidance is performed to obtain the spatiotemporal representation after spatiotemporal cue guidance.
[0065] Optionally, step S2.4.1 specifically includes the following steps:
[0066] First, perform feature segmentation and linear mapping on each meta-pattern in the meta-pattern library C obtained by self-supervised meta-pattern mining to obtain meta-pattern groups corresponding to historical windows and future windows respectively:
[0067] C k =C[:,:d h ]W k ; C v =C[:,d h :]W v
[0068] Among them, C k represents the meta-pattern group corresponding to the history window, C v Denotes the meta-pattern group corresponding to the future window, W k is the learnable mapping weight corresponding to the historical window meta-pattern group, W v are learnable mapping weights corresponding to the set of future window meta-patterns, and
[0069] Next, perform pattern retrieval on the input historical spatiotemporal sequence to obtain the matching degree between the historical spatiotemporal sequence and each meta-pattern:
[0070]
[0071] Among them, FC P (·) represents the feature mapping layer of the historical spatiotemporal sequence, α represents the matching degree between the historical spatiotemporal sequence and each meta-pattern, and represents the transposed matrix of the meta-pattern group corresponding to the historical window, and softmax(·) represents the normalized exponential function;
[0072] Next, the meta-patterns are weightedly fused to extract the meta-pattern that is most relevant to the input sequence:
[0073] E p =FC(α·C v )
[0074] Among them, E p represents a fused meta-pattern and FC(·) represents a fully connected layer.
[0075] Optionally, step S2.4.2 specifically includes combining the fused spatiotemporal cue and the fused meta-pattern to enhance the spatiotemporal cue to obtain an enhanced spatiotemporal cue:
[0076] E c =concat(E p ,E st )
[0077] Among them, E c represents the enhanced spatiotemporal cues, and concat(·) represents the feature concatenation operation;
[0078] Step S2.4.3 specifically includes inputting the enhanced spatiotemporal cues into the encoder of the prediction model based on meta-pattern mining and cue guidance, performing spatiotemporal cue guidance, and obtaining the spatiotemporal representation after spatiotemporal cue guidance:
[0079] Z′=Z⊙E c
[0080] Where Z is the spatiotemporal representation before the spatiotemporal cue guidance, and Z′ is the spatiotemporal representation after the spatiotemporal cue guidance;
[0081] The obtained spatiotemporal representation guided by the spatiotemporal cues is processed by the decoder to obtain and output the predicted value of the future spatiotemporal sequence.
[0082] According to another embodiment of the present invention, an air quality prediction system based on meta-pattern mining is provided, comprising:
[0083] A data collection and processing module is used to collect historical spatiotemporal data in the spatial area to be predicted, perform standardization processing on the spatial area to be predicted, and obtain a standard data set including historical spatiotemporal sequences;
[0084] A prediction model based on meta-pattern mining and cue guidance captures temporal and spatial heterogeneity by generating multi-scale temporal cues and semantic spatial cues, and integrates temporal and spatial cues through spatiotemporal interaction modeling to obtain comprehensive spatiotemporal cues, thereby guiding the spatiotemporal modeling process to overcome the interference of spatiotemporal heterogeneity.
[0085] The training module uses a standard data set to train the prediction model;
[0086] Among them, meta-pattern mining and prompt-guided prediction models include:
[0087] The encoder and decoder capture spatiotemporal dependencies and generate spatiotemporal representations layer by layer through stacked graph convolutional networks and temporal convolutional networks;
[0088] The self-supervised meta-pattern mining module mines discriminative meta-patterns in the feature space through self-supervised learning and stores them in a meta-pattern library. It then retrieves historical spatiotemporal sequences from the meta-pattern library to obtain local trend information to supplement spatiotemporal cues.
[0089] The spatiotemporal cue generation module generates specific cue vectors in time and space to capture spatiotemporal heterogeneity and obtain fused spatiotemporal cues.
[0090] The spatiotemporal cue guidance module performs feature splicing on the meta-pattern and the generated spatiotemporal cue to obtain enhanced spatiotemporal cue. After inputting it into the encoder, it performs cue guidance on the encoded spatiotemporal representation to overcome the interference of heterogeneity on spatiotemporal modeling.
[0091] Compared with the prior art, the air quality prediction method and system based on meta-pattern mining provided by the present invention have at least the following beneficial effects.
[0092] 1) Capture spatiotemporal heterogeneity through flexible spatiotemporal cue generation, construct an offline self-supervised learning task to mine meta-patterns in historical data, supplement spatiotemporal cue with specific local trend information, and ultimately use spatiotemporal cue to efficiently guide the spatiotemporal modeling process, thereby overcoming the interference of spatiotemporal heterogeneity and achieving accurate and robust air quality prediction.
[0093] 2) By constructing a self-supervised meta-pattern mining module, typical pollution patterns of PM2.5 are extracted to enhance the model's adaptability to complex scenarios.
[0094] 3) Construct a spatiotemporal cue generation module. The temporal cue generation component combines pollution cycle priors (e.g., morning and evening peak emissions, seasonal heating) to strengthen the representation of key periods through a memory network. The spatial cue generation component adaptively learns monitoring site embeddings to reflect geographic relevance (e.g., the transmission impact of upstream pollution sources on downstream sites). The spatiotemporal fusion generates integrated spatiotemporal cues, dynamically weighting temporal and spatial cues (e.g., spatial dependence is enhanced during calm winds, while temporal trends dominate during strong winds).
[0095] 4) Through the spatiotemporal cue guidance module, the local trends retrieved from the meta-pattern library are spliced with spatiotemporal cues to guide the model to distinguish heterogeneous spatiotemporal scenarios and focus on key spatiotemporal dimensions. BRIEF DESCRIPTION OF THE DRAWINGS
[0096] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments. By referring to the drawings, the features and advantages of the present invention can be more clearly understood. The drawings are schematic and should not be understood as limiting the present invention in any way. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0097] Figure 1 3 is a schematic diagram of an air quality prediction method based on meta-pattern mining according to an embodiment of the present invention.
[0098] Figure 2 3 is a schematic block diagram of an air quality prediction system based on meta-pattern mining provided according to an embodiment of the present invention.
[0099] Figure 3 A portion of historical spatiotemporal data within a spatial area to be predicted obtained in an embodiment of the air quality prediction method based on meta-pattern mining provided in accordance with an embodiment of the present invention is shown.
[0100] Figure 4 A schematic diagram showing a comparison between PM2.5 predicted values and true values obtained by applying an example of an air quality prediction method based on meta-pattern mining provided according to an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0101] In order to more clearly understand the above-mentioned objects, features and advantages of the present invention, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present invention and the features therein can be combined with each other without conflict.
[0102] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Therefore, the scope of protection of the present invention is not limited to the specific embodiments disclosed below.
[0103] The following describes in detail an air quality prediction method and system based on meta-pattern mining according to an embodiment of the present invention with reference to the accompanying drawings.
[0104] like Figure 1 As shown, an air quality prediction method based on meta-pattern mining is provided according to an embodiment of the present invention, which is used to provide spatiotemporal prediction of air quality, including first collecting spatiotemporal data in the spatial area to be predicted, and constructing a standard data set based on this; then constructing a prediction model based on meta-pattern mining and prompt guidance, the prediction model including a self-supervised meta-pattern mining module, a spatiotemporal prompt generation module and a spatiotemporal prompt guidance module; using a standard data set to complete the training of the prediction model; finally, applying the trained prediction model to the prediction of future spatiotemporal data.
[0105] According to an embodiment of the present invention, an air quality prediction method based on meta-pattern mining is provided, which is used to provide spatiotemporal prediction of air quality and includes the following steps.
[0106] Step S1: Collect historical spatiotemporal data within the spatial region to be predicted, perform standardization on the historical spatiotemporal data, and obtain a standard dataset comprising historical spatiotemporal sequences. As needed, the historical spatiotemporal data may include one of the following: PM2.5 concentration data, pollutant monitoring values, industrial emissions, traffic exhaust emission monitoring values, and meteorological monitoring data such as temperature, humidity, wind speed, wind direction, and precipitation. The collected data is standardized as follows: Divide the spatial region to be predicted into N subregions, and compile historical spatiotemporal data for each time period within each subregion; Input the historical spatiotemporal data for each time period within each subregion into a three-dimensional array in the format of B*T*N to obtain a standard dataset comprising historical spatiotemporal sequences, where B represents the data batch, T represents the time series length, and N represents the total number of spatial nodes. Each data point in the standard dataset represents one of the following: PM2.5 concentration data, pollutant monitoring values, industrial emissions, and traffic exhaust emission monitoring values for a spatial node within a data batch at a time step.
[0107] Step S2: Construct a prediction model based on meta-pattern mining and prompt guidance. This prediction model includes a self-supervised meta-pattern mining module, a spatiotemporal prompt generation module, and a spatiotemporal prompt guidance module. This prediction model is a unified framework with an encoder and decoder. It encodes historical spatiotemporal sequences through a graph convolutional network and a temporal convolutional network to capture spatial and temporal dependencies, captures spatiotemporal heterogeneity by generating spatiotemporal prompts, and jointly guides the spatiotemporal modeling process with offline mined meta-patterns to overcome the interference of spatiotemporal heterogeneity.
[0108] The prediction model based on meta-pattern mining and prompt guidance is as follows:
[0109]
[0110] in, is a prediction model based on meta-pattern mining and prompt guidance, θ represents all trainable parameters in the prediction model, X t-P+1:t Represents the historical space-time sequence fragment from t-P+1 to time t, that is, the historical space-time sequence, represents the future space-time sequence fragment from t+1 to t+Q, that is, the future space-time sequence, Represents the historical real time and space sequence, Represents the future prediction spatiotemporal sequence, t represents the time step, P represents the historical window size, and Q represents the future window size.
[0111] Step S2 specifically includes the following steps.
[0112] Step S2.1: Build the backbone network of the prediction model. The encoder and decoder capture spatiotemporal dependencies and generate spatiotemporal representations through stacked graph convolutional networks and temporal convolutional networks. Taking layer l as an example, the graph convolution operation and temporal convolution operation are defined as:
[0113]
[0114] Among them, Z (l) is the l-th layer of spatiotemporal representation. When l = 0, it is the spatiotemporal sequence input. is the hidden representation obtained by graph convolution, W (l) is the mapping weight, σ(·) is the GELU activation function, Conv1D2(·) and Conv1D1(·) are two layers of one-dimensional convolution operations, A adp is the adaptive adjacency matrix.
[0115] Adaptive adjacency matrix by trainable spatial node embedding To build:
[0116]
[0117] Step S2.2: Construct a self-supervised meta-pattern mining module, mine meta-patterns with discriminative capabilities in feature space through self-supervised learning and store them as a meta-pattern library, and then use the historical spatiotemporal sequence X t-P+1:t Enter the meta-pattern library for retrieval to obtain local trend information to supplement the spatiotemporal cues. Meta-patterns are discriminative latent feature patterns that can capture the local trends and dynamic changes implicit in spatiotemporal data. They provide fine-grained local trend information to the prediction model, thereby compensating for the lack of global context information and enhancing the model's ability to model complex dependencies.
[0118] Specifically, the self-supervised meta-pattern mining module includes a sample pair selection part, a feature enhancement part, a meta-pattern library construction part, and a prototype regularization part. The sample pair selection part selects positive and negative samples by calculating a dynamic similarity matrix to construct a self-supervisory signal and enhance contrastive learning. The feature enhancement part enhances the robustness of the prototype by adding masks and Gaussian noise, and uses contrastive learning to enhance the representation ability of the prototype. The meta-pattern library construction part calculates the probability of assigning samples to trainable prototypes and uses cross-entropy to optimize the prototypes to construct the meta-pattern library. The prototype regularization part uses a uniform regularization term to prevent the distribution from being too unbalanced and causing the model to crash, and uses a distance regularization term to improve the discriminability of the prototype.
[0119] This step S2.2 specifically includes the following steps.
[0120] Step S2.2.1: Divide the historical spatiotemporal sequence in the standard dataset into several prediction segments and randomly shuffle them as the original data. Then, map the original data from the data space to the feature space to obtain the mapped feature vector:
[0121]
[0122] Where H represents the mapped eigenvector and d h is the feature dimension of the hidden layer, N is the total number of spatial nodes, and MLP1 is the historical spatiotemporal sequence segment X t-P+1:t The feature mapping network of MLP2 is the future spatiotemporal sequence fragment The feature mapping network of the data space is used to map the historical spatiotemporal sequence. Mapping from the data space to the feature space can enhance the expressive power of the historical spatiotemporal sequence. The above prediction segment is the splicing of the historical window and the future window as the original data.
[0123] Step S2.2.2, based on the soft clustering process in the feature space, the meta-patterns in the historical prediction fragments are mined, and K randomly initialized trainable parameters are used as prototypes to establish the meta-pattern library C = {c1,…,c j …,c K} and used as the cluster center. The characteristic dimension of the cluster center C is the same as the characteristic dimension of the mapped feature vector H, both of which are represents the domain, where j is the prototype index and j=1,…K, Represents the domain. Get the probability of assigning the mapped feature vector to the prototype:
[0124]
[0125] p i =[p i,1 ,p i,2 ,…,p i,K ]
[0126] Among them, p i Represents the probability vector of assigning the i-th sample of the feature vector to each prototype, p i,k represents the probability of assigning the i-th sample of the feature vector to the k-th prototype, exp(·) represents the natural exponential function, sim(·) is the cosine similarity measure, and c k represents the k-th prototype in the meta-pattern library, k represents the prototype index and k=1,…K, γ is the temperature parameter used to control the smoothness of the distribution, h i represents the i-th sample in the mapped feature vector, i represents the feature vector index and i=1,…N, c r represents the r-th prototype, r is the prototype index and r=1,…K, K is the total number of prototypes.
[0127] The above prototypes can be time series in feature space.
[0128] Step S2.2.3, constructing the sample pair selection part includes selecting positive and negative sample pairs from the mapped feature vector H based on dynamic spatial similarity, as follows:
[0129]
[0130] Where B represents the batch size selected from the mapped feature vector H, b represents the sample index in the selected feature vector batch and b = 1, ... B, H b represents the bth sample in the selected feature vector batch, Represents the positive sample index corresponding to the i-th sample of the feature vector, A ij Represents the similarity between the i-th sample and the j-th sample of the feature vector, τ represents the positive sample selection threshold, A is the average sample similarity matrix in the currently selected feature vector batch, and the average sample similarity matrix in the currently selected feature vector batch is normalized by translation. After diagonal masking diag(A) = -∞, sample selection is performed. The selection of negative samples changes the threshold to 1-τ to select samples with low similarity. Rand(·) represents random selection from the set, argmax(·) is the nearest neighbor function, and argmax j A ij Represents the item A in the average sample similarity matrix obtained ij The jth sample corresponding to the maximum value of , that is, the sample index j that is most similar to sample i in the obtained average sample similarity matrix.
[0131] Compared to calculating the correlation of all samples, this approach is more effective at capturing local dynamic relationships and is more efficient. Random selection helps capture diverse semantic relationships. Limiting the random range using the threshold τ effectively avoids noise caused by excessive randomness, while the nearest neighbor function argmax(·) ensures training stability in imbalanced data (e.g., when samples with high similarity are sparse). This sample pair selection, based on a dynamic similarity matrix, allows for the identification of positive and negative PM2.5 pollution events, such as consecutive hazy days versus clean days.
[0132] Step S2.2.4, the meta-pattern library construction part includes calculating the multi-classification cross entropy based on the sample-to-prototype assignment probability of the obtained feature vector and using the positive sample pair-to-prototype assignment probability of the selected sample as the optimization target to construct the self-supervisory signal required for the self-supervised learning task:
[0133]
[0134] in, represents the probability of assignment between the positive sample of the i-th sample of the feature vector and the k-th prototype, L ce represents the cross entropy loss.
[0135] Through the above-mentioned meta-pattern library, it is possible to store typical pollution pattern prototypes, such as the spatiotemporal characteristics of high-concentration PM2.5 of the "winter coal-burning type", and support rapid retrieval and matching.
[0136] Step S2.2.5, constructing the feature enhancement part, includes adding random masks and Gaussian noise to the positive and negative sample pairs selected from the mapped feature vector to enhance the robustness of the prototype, thereby reducing its over-reliance on certain specific features. Random masks and Gaussian noise are added to the positive and negative sample pairs selected from the mapped feature vector H as follows:
[0137]
[0138] in, represents the enhanced eigenvector, ⊙ is the Hadamard product operation, i.e., element-by-element product, M is the random mask matrix, ε is Gaussian noise, and h± A sample h representing a feature vector i positive and negative samples.
[0139] For any sample h of the eigenvector i , for its positive and negative samples The feature vector of the sample h is enhanced without i Perform feature enhancement itself.
[0140] Step S2.2.6, constructing the feature enhancement part, also includes applying a contrastive learning strategy to the positive and negative sample pairs selected from the mapped feature vectors, bringing the positive sample pairs closer together and pushing the negative sample pairs further away in the feature space, thereby enhancing the representation ability of the prototype and improving the robustness of the clustering process. The contrastive learning strategy is as follows:
[0141]
[0142] Among them, L ctr represents the contrastive learning loss, represents the cosine similarity of the positive sample pair of the i-th sample, Represents the cosine similarity of the negative sample pair of the i-th sample.
[0143] Based on the above feature enhancement part, the missing monitoring data is simulated by masking noise to improve the robustness of the meta-pattern to sensor failures.
[0144] Step S2.2.7, construct the prototype regularization part, in order to prevent the distribution of samples to prototypes from being too unbalanced, which may lead to the model L ctr Collapse, based on the probability of assigning samples to prototypes based on the feature vector, adding a uniform regularization term to encourage samples to be evenly distributed among prototypes:
[0145]
[0146] Among them, L uni represents uniform regularization loss, 1 K represents a vector of all 1s of length K, and KL(·) represents the KL divergence, which is used to measure the difference between two probability distributions. i represents the i-th sample h i The probability vector of assigning θ to each prototype.
[0147] Step S2.2.8, constructing the prototype regularization part also includes adding a distance regularization term to improve the distinguishability and representation ability of the prototype:
[0148]
[0149] Among them, L dist represents the distance regularization loss, c r′Represents the r′th prototype in the meta-pattern library, where r′ is the prototype index and r′=1,…K.
[0150] Through the above-mentioned prototype regularization part, the meta-pattern library is prevented from being biased towards high-frequency events (such as common mild pollution) and is balanced against rare extreme events (such as extreme smog).
[0151] Step S2.2.9, construct the following optimization objectives and establish a self-supervised meta-pattern mining module for performing self-supervised meta-pattern mining:
[0152] L ssl =L ce +L ctr +λ reg (L uni +L dist )
[0153] Among them, L ssl represents the total loss of the self-supervised meta-pattern mining module, λ reg is the coefficient of the regularization term.
[0154] Through the above-mentioned self-supervised meta-pattern mining module, the typical pollution patterns of PM2.5 can be extracted, and the adaptability of the model to complex scenarios can be enhanced.
[0155] Step S2.3 constructs a spatiotemporal cue generation module, generating specific cue vectors in both time and space to capture spatiotemporal heterogeneity and obtain fused spatiotemporal cues. In terms of time, prior knowledge of time, such as weeks and time periods, is mapped from discrete to continuous. A temporal cue vector is generated through a feature fusion network, enabling the prediction model to perceive the differences between different temporal contexts. In terms of space, an adaptive spatial node embedding is initialized for each spatial node, serving as a spatial cue vector, enabling the prediction model to perceive the differences between different spatial contexts.
[0156] Step S2.3.1, build the spatial cue generation part, randomly initialize a trainable spatial node embedding for each spatial position in the standard dataset obtained in step S1 To capture spatial heterogeneity, the trainable spatial node embeddings serve as spatial cues.
[0157] By constructing the spatial prompt generation part above, adaptive learning monitoring site embedding is performed to reflect geographical correlation (such as the transmission impact of upstream pollution sources on downstream sites).
[0158] In step S2.3.2, the temporal cue generation part is constructed to capture temporal heterogeneity by combining prior embedding with memory network to generate multi-scale temporal cues.
[0159] First, the multi-scale time prior knowledge is mapped from discrete to continuous feature space to obtain the mapped time prior knowledge:
[0160] e m =Embedding(t m )
[0161] Among them, e m represents the embedding vector of the mth time prior knowledge, Embedding(·) represents the embedding operation, t m represents the value of the mth temporal prior knowledge, where m represents the temporal prior knowledge number and m = 1, 2, …, M, where M is the total number of selected temporal prior knowledge. This multi-scale temporal prior knowledge can include information such as the month, day, time step, weekday, whether it is a weekday, and whether it is a holiday, obtained from a standard calendar.
[0162] Then, based on the mapped temporal prior knowledge, the feature fusion network adaptively learns the importance of different prior knowledge and obtains a multi-scale temporal fusion representation as a temporal cue:
[0163] E t =concat(e1,e2,…e m ,…,e M )W t +b t
[0164] Among them, E t It is a multi-scale temporal fusion representation and W t is the weight of the feature fusion network and b t is the bias of the feature fusion network and T represents the total length of the time step, d m represents the embedding dimension of the mth time prior knowledge, d h denotes the feature dimension of the multi-scale temporal fusion representation, and concat(·) denotes concatenation. The feature dimension of the multi-scale temporal fusion representation can be equal to the feature dimension of the hidden layer.
[0165] By the multi-scale temporal fusion representation E t , i.e., the generated multi-scale temporal cues capture temporal heterogeneity.
[0166] Furthermore, unlike spatiotemporal series, temporal priors are known before prediction. Therefore, when performing spatiotemporal predictions, corresponding time cues are generated for both historical and future windows, comprehensively guiding the spatiotemporal modeling process. By constructing the temporal cue generation component above, combined with priors about pollution cycles (such as morning and evening peak emissions and seasonal heating), the memory network strengthens the representation of key periods.
[0167] Step S2.3.3, combined with the time prompt E generated above t With space prompt E s , expand and sum its dimensions to obtain the fused spatiotemporal prompt:
[0168]
[0169] Among them, E st Indicates fused spatiotemporal cues and It captures comprehensive spatial and temporal heterogeneity;1 N Represents a vector of all 1s of length N, 1 T Represents a vector of all 1s of length T.
[0170] The above-mentioned fused spatiotemporal cues are obtained through spatiotemporal fusion, and the time and space cues are dynamically weighted. For example, in air measurements, spatial dependence is enhanced in calm winds, while the time trend dominates in strong winds.
[0171] In step S2.4, a spatiotemporal cue guidance module is constructed to perform feature splicing on the meta-pattern and the generated spatiotemporal cue to obtain enhanced spatiotemporal cue, and input the module into a prediction model based on meta-pattern mining and cue guidance to perform cue guidance on the encoded spatiotemporal representation to overcome the interference of heterogeneity on spatiotemporal modeling.
[0172] Specifically, the spatiotemporal cue guidance module guides the spatiotemporal modeling process by combining the spatiotemporal cues generated previously with the mined meta-patterns, thereby overcoming the interference of spatiotemporal heterogeneity, improving prediction accuracy and robustness, and making the model more adaptable to dynamic and complex spatiotemporal changes. Step S2.4 specifically includes the following steps.
[0173] Step S2.4.1: Input the historical spatiotemporal sequence into the meta-pattern library, perform meta-pattern query and fusion, and obtain the fused meta-pattern. The historical spatiotemporal sequence is used as the historical window.
[0174] Specifically, feature segmentation and linear mapping are performed on each meta-pattern in the meta-pattern library C obtained by self-supervised meta-pattern mining to obtain meta-pattern groups corresponding to historical windows and future windows, respectively, as shown in the following formula:
[0175] C k =C[:,:d h ]W k ; C v =C[:,d h :]W v
[0176] Among them, W k is the learnable mapping weight corresponding to the historical window meta-pattern group, W vare learnable mapping weights corresponding to the set of future window meta-patterns, and C k represents the meta-pattern group corresponding to the historical window, C represents the meta-pattern library, that is, the overall meta-pattern group, and C v Represents the meta-pattern group corresponding to the future window.
[0177] Then, the input historical spatiotemporal sequence is subjected to pattern retrieval to obtain the matching degree between the historical spatiotemporal sequence and each meta-pattern. As follows:
[0178]
[0179] Among them, FC P (·) represents the feature mapping layer of the historical spatiotemporal sequence, α represents the matching degree between the historical spatiotemporal sequence and each meta-pattern, χ represents the historical real spatiotemporal sequence, represents the transposed matrix of the meta-pattern group corresponding to the history window, and softmax(·) represents the normalized exponential function.
[0180] Based on this, the meta-patterns are weightedly fused and the meta-pattern most relevant to the input sequence is extracted as the fused meta-pattern:
[0181] E p =FC(α·C v )
[0182] Among them, FC(·) represents the fully connected layer, E p represents a fused meta-pattern and This fused meta-pattern supplements spatiotemporal cues with specific local trend information.
[0183] Step S2.4.2: Combine the fused spatiotemporal cues with the fused meta-patterns to enhance the spatiotemporal cues and obtain enhanced spatiotemporal cues:
[0184] E c =concat(E p ,E st )
[0185] Among them, concat(·) represents the feature concatenation operation, Ec c Indicates enhanced spatiotemporal cues.
[0186] The above method obtains enhanced spatiotemporal cues by feature splicing meta-patterns with spatiotemporal cues, aiming to comprehensively guide the spatiotemporal modeling process and thus overcome the interference of heterogeneity.
[0187] In step S2.4.3, the enhanced spatiotemporal cues are input into the encoder of the prediction model based on meta-pattern mining and cue guidance, and spatiotemporal cue guidance is performed to obtain the spatiotemporal representation after spatiotemporal cue guidance:
[0188] Z′=Z⊙E c
[0189] Where Z is the spatiotemporal representation before the spatiotemporal cue guidance, Z′ is the spatiotemporal representation after the spatiotemporal cue guidance, and ⊙ represents the Hadamard product operation.
[0190] The obtained spatiotemporal representation guided by the spatiotemporal cues is processed by the decoder to obtain and output the predicted value of the future spatiotemporal sequence.
[0191] By constructing the spatiotemporal cue guidance module as described above, the local trends retrieved from the meta-pattern library are spliced with the spatiotemporal cues to guide the model to distinguish heterogeneous spatiotemporal scenarios and focus on key spatiotemporal dimensions.
[0192] Step S3: Using the obtained standard data set including the historical spatiotemporal series, the constructed prediction model based on meta-pattern mining and prompt guidance is trained to obtain a trained prediction model.
[0193] First, the total loss L of the self-supervised meta-pattern mining module is optimized ssl , in order to mine discriminative meta-patterns in historical data in the feature space and store them in the meta-pattern library. The parameters are then frozen to avoid interference when optimizing other parts in the subsequent stage. The mean absolute error (MAE) is then used as the prediction loss to optimize the prediction model, as shown in the following formula:
[0194]
[0195] Among them, L mae represents the prediction loss, n represents the number of spatial nodes and n=1,2…N, q represents the time step in the prediction window, Q represents the future window size, represents the predicted value of the future space-time series, Represents the true value of the future space-time series.
[0196] In step S4, the trained prediction model is applied to future spatiotemporal data to obtain spatiotemporal prediction results for air quality. These spatiotemporal prediction results can be used in areas such as air quality analysis processes for further air quality analysis and early warning, as well as planning of air quality solutions.
[0197] The following describes a spatiotemporal prediction system based on meta-pattern mining according to another embodiment of the present invention with reference to the accompanying drawings.
[0198] like Figure 2As shown, a spatiotemporal prediction system based on meta-pattern mining provided according to another embodiment of the present invention includes: a data collection and processing module, which is used to collect historical spatiotemporal data in the spatial area to be predicted, standardize the historical spatiotemporal data, and obtain a standard data set including historical spatiotemporal sequences; a prediction model based on meta-pattern mining and prompt guidance, which captures temporal and spatial heterogeneity by generating multi-scale temporal prompts and semantic spatial prompts respectively, and obtains comprehensive spatiotemporal prompts by fusing temporal and spatial prompts through spatiotemporal interaction modeling, thereby guiding the spatiotemporal modeling process to overcome the interference of spatiotemporal heterogeneity; a training module, which uses a standard data set to train the prediction model.
[0199] The meta-pattern mining and prompt-guided prediction model may include: an encoder and a decoder, which capture spatiotemporal dependencies and generate spatiotemporal representations layer by layer through stacked graph convolutional networks and temporal convolutional networks, thereby performing spatiotemporal predictions; a self-supervised meta-pattern mining module, which mines meta-patterns with discriminative capabilities in feature space through self-supervised learning and stores them as a meta-pattern library, and then retrieves local trend information by inputting historical spatiotemporal sequences into the meta-pattern library to supplement spatiotemporal prompts; a spatiotemporal prompt generation module, which generates specific prompt vectors in time and space to capture spatiotemporal heterogeneity and obtain fused spatiotemporal prompts; a spatiotemporal prompt guidance module, which performs feature splicing on the meta-pattern and the generated spatiotemporal prompts to obtain enhanced spatiotemporal prompts, and after inputting them into the encoder, performs prompt guidance on the encoded spatiotemporal representations to overcome the interference of heterogeneity on spatiotemporal modeling.
[0200] The self-supervised meta-pattern mining module may include: a sample pair selection part, which selects positive and negative samples by calculating the dynamic similarity matrix for constructing self-supervisory signals and contrastive learning enhancement; a feature enhancement part, which enhances the robustness of the prototype by adding masks and Gaussian noise, and uses contrastive learning to enhance the representation ability of the prototype; a meta-pattern library construction part, which calculates the probability of assigning samples to trainable prototypes, and uses cross-entropy to optimize the prototype to construct the meta-pattern library; a prototype regularization part, which uses a uniform regularization term to prevent the distribution from being too unbalanced and causing the model to collapse, and uses a distance regularization term to improve the distinguishability of the prototype.
[0201] The spatiotemporal cue generation module may include: a temporal cue generation part, which captures temporal heterogeneity by combining prior embeddings and memory networks, and generates temporal cues through embedding queries; a spatial cue generation part, which randomly initializes a trainable spatial node embedding for each spatial position to capture spatial heterogeneity; and a spatiotemporal cue fusion part, which combines the generated temporal cues and spatial cues, performs dimensionality expansion and summation on them, and obtains fused spatiotemporal cues.
[0202] Example 1
[0203] For ease of understanding, the air quality prediction method based on meta-pattern mining of the present invention is described in more detail below by taking the air quality prediction in a city as an example.
[0204] In step S1, statistical data from urban air quality monitoring is collected by air quality monitoring equipment and sensors at N spatial locations over a period of time. This air quality data is then standardized, with the air quality (PM2.5 concentration) at each spatial location and time period calculated as a standard dataset containing historical spatiotemporal sequences. The standard dataset is a three-dimensional array of size B × T × N, where B is the number of batches, T is the length of the time series, and N is the number of spatial locations.
[0205] Step S2: construct a prediction model based on meta-pattern mining and prompt guidance (STMP2G).
[0206] Step S3: training the prediction model using the standard data set obtained in step S1 to obtain a trained prediction model.
[0207] Step S4: input the historical spatiotemporal data of the spatial region to be predicted into the trained prediction model, and output the future spatiotemporal data of each region.
[0208] In this Example 1, the Beijing air quality data set is used to train the prediction model. The PM2.5 concentration statistics from May 1, 2014 to April 30, 2015 are intercepted, covering a total of 274 spatial locations with a time interval of 1 hour. The data set is divided into a training set (70%), a validation set (10%), and a test set (20%) in the time dimension. The training set is used to train the model, the validation set is used to save the optimal model, and the test set is used to test the model performance. In this example, the historical 96-hour PM2.5 concentration is used to predict the PM2.5 concentration in the next 96 hours. See Figure 3 , shows part of the PM2.5 concentration statistics of multiple spatial locations within the collected time period. In order to avoid being too lengthy, Figure 3 Only PM2.5 concentration data collected at 13 time points (i.e., from midnight to midnight on May 1, 2014) at six spatial locations (i.e., spatial location 1 to spatial location 6) are shown for illustration. The collected PM2.5 concentration statistics serve as the historical spatiotemporal data within the spatial area to be predicted in step S1.
[0209] The constructed deep learning model was trained using the partitioned training set. The data was Z-score normalized, and all parameters in the prediction model based on meta-pattern mining and hint guidance were randomly initialized.
[0210] Training was performed on an Intel(R) Xeon(R) Processors CPU and an NVIDIA Tesla V100S GPU on a Linux operating system using the PyTorch framework, with the batch size set to 64 and the initial learning rate set to 0.001.
[0211] Using AdamW as the optimizer, the deep learning model was trained for 200 cycles on the complete data training set. The model was validated using the loss function in each training cycle, and the optimal model was saved based on the loss function value. The Early Stopping strategy was used during training. When the loss function value did not decrease for 20 consecutive cycles, the training was terminated early. Figure 4 As shown in FIG, a comparison curve of the PM2.5 concentration prediction value obtained in this embodiment and the actual value is shown. As can be seen from the figure, the prediction value of this embodiment has a better fitting effect on the actual value, and the prediction effect is good.
[0212] The prediction results of the above embodiment were compared with those of the prior art. PM2.5 concentration prediction was performed on the same dataset. The comparative results are shown in Table 1. The prediction results were evaluated using mean absolute error (MAE), root mean square error (RMSE), and mean absolute percentage error (MAPE). Lower errors indicate better prediction results. Example 1 was compared with nine prior art prediction methods.
[0213] The first is STGCN, which integrates graph convolution and gated temporal convolution via spatiotemporal convolution blocks to capture spatiotemporal dependencies.
[0214] The second is GraphWaveNet, which proposes an adaptive adjacency matrix to capture the hidden spatial dependencies in the data and captures the temporal dependencies through stacked dilated one-dimensional convolutions.
[0215] The third is AGCRN, which captures node-specific patterns through node-adaptive parameter learning, captures potential spatial dependencies with unified node embeddings, and automatically captures spatiotemporal correlations in combination with recurrent networks.
[0216] The fourth is DMSTGCN, which extends the existing graph convolution to dynamic graph convolution by constructing an adaptive spatial adjacency matrix with a day-cycle to model the changing spatial correlation.
[0217] The fifth is STSSL, which adaptively enhances spatiotemporal flow graph data at the data level and topological structure level, and captures spatiotemporal heterogeneity through auxiliary self-supervised learning tasks.
[0218] The sixth is MegaCRN, which captures spatiotemporal heterogeneity through spatiotemporal meta-graph learning and combines graph convolution and recurrent networks on the meta-graph to capture spatiotemporal correlation.
[0219] The seventh is TESTAM, which selects a specific spatial modeling method for each node through a hybrid expert model and combines it with a time-enhanced attention model to capture spatiotemporal dependencies.
[0220] The eighth is TGCRN, which learns a time-varying graph structure that can perceive periodicity and trends, and combines it with a gated recurrent unit to jointly capture dynamic spatiotemporal dependencies.
[0221] The ninth is HimNet, which implicitly captures spatiotemporal heterogeneity through spatiotemporal embedding and learns spatiotemporal specific parameters from a meta-parameter pool.
[0222] The comparison results in Table 1 clearly show that the air quality prediction method based on meta-pattern mining in Example 1 outperforms the nine existing prediction methods. In the table below, the units of MAE and RMSE are the same as the original data units, i.e., micrograms per cubic meter.
[0223] Table 1 Comparison of PM2.5 concentration prediction results for Beijing dataset
[0224] Comparison plan <![CDATA[MAE(μg / m 3 )]]> <![CDATA[RMSE(μg / m 3 )]]> MAPE (%) STGCN 12.615 19.8722 32.9993 GraphWaveNet 12.9254 20.1974 35.328 AGCRN 13.1515 20.0765 38.4106 DMSTGCN 13.3816 20.6932 37.5283 STSSL 12.5545 19.6164 34.4903 MegaCRN 12.528 19.5352 35.7253 TESTAM 14.1526 21.7387 38.6702 TGCRN 13.8408 21.4599 41.2108 HimNet 12.7136 19.9273 35.9345 Example 1 12.1016 19.0377 31.195
[0225] Furthermore, several ablation experiments were conducted to demonstrate the effectiveness of the prediction method of the present invention. The experimental results are shown in Table 2.
[0226] Example 1 was compared with four post-ablation models.
[0227] (1) basemodel: The spatiotemporal cue guidance module is deleted, representing the base model that only captures spatiotemporal dependencies but cannot capture spatiotemporal heterogeneity.
[0228] (2) w / o Et: The time prompt generation module was deleted.
[0229] (3) w / o Es: The spatial hint generation module was deleted.
[0230] (4) w / o Ep: The self-supervised meta-pattern mining module was removed.
[0231] Table 2 Comparison of ablation experiment results on Beijing dataset
[0232] Comparison plan <![CDATA[MAE(μg / m 3 )]]> <![CDATA[RMSE(μg / m 3 )]]> MAPE (%) basemodel 14.2917 21.8661 43.6437 w / o Et 12.2419 19.4523 32.7956 w / o Es 12.3147 19.2891 32.4178 w / o Ep 12.3926 19.4762 32.4741 STMP2G (Example 1) 12.1016 19.0377 31.195
[0233] It can be seen from the experimental results in Table 2 that the prediction effect obtained by applying the prediction method of Example 1 of the present invention is better than the effects of the four post-ablation models.
[0234] All of the above optional technical solutions can be combined in any way to form optional embodiments of the present application, and will not be described in detail here.
[0235] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0236] The above description is only a preferred specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by any technician familiar with this technical field within the technical scope disclosed by the present invention should be covered by the scope of protection of the present invention.
Claims
1. An air quality prediction method based on meta-pattern mining is used to provide spatiotemporal prediction of air quality, characterized in that: The following steps are involved: Step S1: collect historical spatiotemporal data within the spatial area to be predicted and perform standardization processing to obtain a standard data set including historical spatiotemporal series. The collected historical spatiotemporal data includes PM2.5 concentration data. Step S2: Construct a prediction model based on meta-pattern mining and prompt guidance. This prediction model is a unified framework with an encoder and a decoder. It encodes historical spatiotemporal sequences through graph convolutional networks and temporal convolutional networks to capture spatial and temporal dependencies, captures spatiotemporal heterogeneity by generating spatiotemporal prompts, and guides the spatiotemporal modeling process together with the offline mined meta-patterns to overcome the interference of spatiotemporal heterogeneity. Step S3, using the standard data set obtained in step S1 to train the constructed prediction model based on meta-pattern mining and prompt guidance to obtain a trained prediction model; Step S4: Apply the trained prediction model to the prediction of future spatiotemporal data to obtain spatiotemporal prediction results for air quality, and use the spatiotemporal prediction results to plan air quality solutions.
2. The air quality prediction method based on meta-pattern mining according to claim 1 is characterized in that: In step S1, the collected historical spatiotemporal data in the spatial area to be predicted are standardized. The processing process is as follows: The spatial area to be predicted is divided into N sub-areas, and the historical spatiotemporal data of each time period in each sub-area are counted; the historical spatiotemporal data of each time period in each sub-area are input into a three-dimensional array in the format of B*T*N to obtain a standard data set including historical spatiotemporal sequences, where B represents the data batch, T represents the length of the time series, and N represents the total number of spatial nodes. Each data point in the standard data set represents the PM2.5 concentration data of a spatial node in a certain data batch at a time step.
3. The air quality prediction method based on meta-pattern mining according to claim 1, characterized in that: Step S2 specifically includes the following steps: Step S2.1, building the backbone network of the prediction model; Step S2.2: construct a self-supervised meta-pattern mining module, which mines discriminative meta-patterns in the feature space through self-supervised learning and stores them as a meta-pattern library. This is used to retrieve local trend information by inputting historical spatiotemporal sequences into the meta-pattern library. Step S2.3: construct a spatiotemporal cue generation module to generate specific cue vectors in time and space to capture spatiotemporal heterogeneity and obtain fused spatiotemporal cues; In step S2.4, a spatiotemporal cue guidance module is constructed to perform feature splicing on the meta-pattern and the fused spatiotemporal cue to obtain enhanced spatiotemporal cue. After inputting the cue into the encoder of the prediction model, the encoded spatiotemporal representation is cue-guided to overcome the interference of heterogeneity on spatiotemporal modeling.
4. The air quality prediction method based on meta-pattern mining according to claim 3 is characterized in that: Step S2.2 specifically includes the following steps: Step S2.2.1: Divide the historical spatiotemporal sequence in the standard dataset into several prediction segments and randomly shuffle them as the original data. Then, map the original data from the data space to the feature space to obtain the mapped feature vector: Where H represents the mapped eigenvector and d h is the feature dimension of the hidden layer, N is the total number of spatial nodes, and MLP1 is the historical spatiotemporal sequence segment X t-P+1:t The feature mapping network of MLP2 is the future spatiotemporal sequence fragment Feature mapping network; Step S2.2.2, based on the soft clustering process in the feature space, the meta-patterns in the historical prediction fragments are mined, and K randomly initialized trainable parameters are used as prototypes to establish the meta-pattern library C = {c1,…,c j …,c K }, and as the cluster center, the probability of assigning the feature vector to the prototype is obtained: p i =[p i,1 ,p i,2 ,…,p i,K ] Among them, p i Represents the probability vector of assigning the i-th feature vector to each prototype, p i,k represents the probability of assigning the i-th eigenvector to the k-th prototype, exp(·) represents the natural exponential function, sim(·) is the cosine similarity measure, and c k represents the kth prototype, k represents the prototype index and k=1,…K, γ is the temperature parameter used to control the smoothness of the distribution, h i represents the i-th sample in the mapped feature vector H, where i represents the index of the feature vector sample and i=1,…N, c r Represents the r-th prototype in the meta-pattern library, r is the prototype index and r=1,…K, the feature dimension of the cluster center C is the same as the feature dimension of the mapped feature vector H, both are Represents a domain; Step S2.2.3, constructing the sample pair selection part includes selecting positive and negative sample pairs from the mapped feature vector H based on dynamic spatial similarity, as follows: Where B represents the batch size selected from the mapped feature vector H, b represents the sample index in the selected feature vector batch and b = 1, ... B, H b represents the bth sample in the selected feature vector batch, j i + Represents the positive sample index corresponding to the i-th sample of the feature vector, A ij represents the similarity between the i-th sample and the j-th sample in the feature vector, τ represents the threshold for selecting positive samples, Rand(·) represents random selection from the set, argmax j A ij Indicates the sample index j that is most similar to sample i in the obtained average sample similarity matrix, A is the average sample similarity matrix in the currently selected feature vector batch, and the average sample similarity matrix in the currently selected feature vector batch is normalized by translation. After diagonal masking diag(A)=-∞, sample selection is performed; Step S2.2.4, the meta-pattern library construction part includes calculating the multi-classification cross entropy based on the sample-to-prototype assignment probability of the obtained feature vector and the sample-to-prototype assignment probability of the selected positive sample pairs: in, represents the probability of assignment between the positive sample of the i-th sample of the feature vector and the k-th prototype, L ce represents the cross entropy loss; Using the multi-class cross entropy as the optimization target, the self-supervisory signal required for the self-supervised learning task is constructed; Step S2.2.5, constructing the feature enhancement part, includes adding random masks and Gaussian noise to the positive and negative sample pairs selected from the mapped feature vectors: in, represents the enhanced eigenvector, ⊙ is the Hadamard product operation, M is the random mask matrix, ε is Gaussian noise, A sample h representing a feature vector i Positive and negative samples; Step S2.2.6, constructing the feature enhancement portion, further includes employing a contrastive learning strategy based on the positive and negative sample pairs selected from the mapped feature vectors to bring the positive sample pairs closer together and push the negative sample pairs further apart in the feature space. The contrastive learning strategy is as follows: Among them, L ctr represents the contrastive learning loss, Represents the cosine similarity of the positive sample pair of the i-th sample of the feature vector, Represents the cosine similarity of the negative sample pair of the i-th sample of the feature vector; Step S2.2.7, constructing the prototype regularization part includes adding a uniform regularization term to encourage the samples to be evenly distributed among the prototypes based on the probability of assigning the samples to the prototypes of the feature vector: Among them, L uni represents uniform regularization loss, 1 K represents a vector of all ones of length K, and KL(·) represents the KL divergence; Step S2.2.8, constructing the prototype regularization part also includes adding a distance regularization term: Among them, L dist represents the distance regularization loss, c r′ represents the r′th prototype in the meta-pattern library, where r′ is the prototype index and r′=1,…K; In step S2.2.9, the following optimization objectives are constructed to establish a self-supervised meta-pattern mining module: L ssl =L ce +L ctr +λ reg (L uni +L dist ) Among them, L ssl represents the total loss of the self-supervised meta-pattern mining module, λ reg is the coefficient of the regularization term.
5. The air quality prediction method based on meta-pattern mining according to claim 4 is characterized in that: Step S2.3 specifically includes the following steps: Step S2.3.1, build the spatial hint generation part, randomly initialize a trainable spatial node embedding for each spatial node in the standard dataset obtained in step S1 To capture spatial heterogeneity, the trainable spatial node embeddings are spatial cues; Step S2.3.2: Construct the temporal cue generation part, which captures temporal heterogeneity by combining prior embedding and memory network to generate multi-scale temporal cues. T represents the total length of the time step; Step S2.3.3, combine the generated time hint E t With space prompt E d , perform dimension expansion and summation to obtain the fused spatiotemporal prompt: Among them, E st Indicates fused spatiotemporal cues and 1 N Represents a vector of all 1s of length N, 1 T Represents a vector of all 1s of length T.
6. The air quality prediction method based on meta-pattern mining according to claim 5, characterized in that: Step S2.3.2 specifically includes the following steps: First, the multi-scale time prior knowledge is mapped from discrete to continuous feature space to obtain the mapped time prior knowledge: e m =Embedding(t m ) Among them, e m represents the embedding vector of the mth time prior knowledge, Embedding(·) represents the embedding operation, t m represents the value of the mth time prior knowledge, m represents the number of the time prior knowledge, and m = 1, 2, ..., M, where M is the total number of selected time prior knowledge; the multi-scale time prior knowledge includes month, date, time step, week, whether it is a weekday, and whether it is a holiday; Then, based on the mapped temporal prior knowledge, the feature fusion network adaptively learns the importance of different prior knowledge and obtains a multi-scale temporal fusion representation as a temporal cue: AND t =concat(e1,e2,…e m ,…,and M )W t +b t Among them, E t It is a multi-scale temporal fusion representation and T represents the total length of the time step, concat(·) represents the concatenation process, and W t is the weight of the feature fusion network and d m represents the embedding dimension of the mth time prior knowledge, b t is the bias of the feature fusion network and 7. The air quality prediction method based on meta-pattern mining according to claim 6, characterized in that: Step S2.4 specifically includes the following steps: Step S2.4.1: Input the historical spatiotemporal sequence into the meta-pattern library, perform meta-pattern query and fusion, and obtain the fused meta-pattern; Step S2.4.2, combining the fused spatiotemporal cue and the fused meta-pattern to enhance the spatiotemporal cue and obtain enhanced spatiotemporal cue; In step S2.4.3, the enhanced spatiotemporal cues are input into the encoder of the prediction model based on meta-pattern mining and cue guidance, and spatiotemporal cue guidance is performed to obtain the spatiotemporal representation after spatiotemporal cue guidance.
8. The air quality prediction method based on meta-pattern mining according to claim 7 is characterized in that: Step S2.4.1 specifically includes the following steps: First, perform feature segmentation and linear mapping on each meta-pattern in the meta-pattern library C obtained by self-supervised meta-pattern mining to obtain meta-pattern groups corresponding to historical windows and future windows respectively: C k =C[:,:d h ]W k ;C v =C[:,d h :]W v Among them, C k represents the meta-pattern group corresponding to the history window, C v Denotes the meta-pattern group corresponding to the future window, W k is the learnable mapping weight corresponding to the historical window meta-pattern group, W v are learnable mapping weights corresponding to the set of future window meta-patterns, and Next, perform pattern retrieval on the input historical spatiotemporal sequence to obtain the matching degree between the historical spatiotemporal sequence and each meta-pattern: Among them, FC P (·) represents the feature mapping layer of the historical spatiotemporal sequence, α represents the matching degree between the historical spatiotemporal sequence and each meta-pattern, and represents the transposed matrix of the meta-pattern group corresponding to the historical window, and softmax(·) represents the normalized exponential function; Next, the meta-patterns are weightedly fused to extract the meta-pattern that is most relevant to the input sequence: E p =FC(α·C v ) Among them, E p represents a fused meta-pattern and FC(·) represents a fully connected layer.
9. The air quality prediction method based on meta-pattern mining according to claim 8, characterized in that: Step S2.4.2 specifically includes combining the fused spatiotemporal cue with the fused meta-pattern to enhance the spatiotemporal cue to obtain enhanced spatiotemporal cue: AND c =concat(E p ,AND st ) Among them, E c represents the enhanced spatiotemporal cues, and concat(·) represents the feature concatenation operation; Step S2.4.3 specifically includes inputting the enhanced spatiotemporal cues into the encoder of the prediction model based on meta-pattern mining and cue guidance, performing spatiotemporal cue guidance, and obtaining the spatiotemporal representation after spatiotemporal cue guidance: Z′=Z⊙E c Where Z is the spatiotemporal representation before the spatiotemporal cue guidance, and Z′ is the spatiotemporal representation after the spatiotemporal cue guidance; The obtained spatiotemporal representation guided by the spatiotemporal cues is processed by the decoder to obtain and output the predicted value of the future spatiotemporal sequence.
10. A system for executing the air quality prediction method based on meta-pattern mining according to any one of claims 1 to 9, characterized in that: include: A data collection and processing module is used to collect historical spatiotemporal data in the spatial area to be predicted, perform standardization processing on the spatial area to be predicted, and obtain a standard data set including historical spatiotemporal sequences; A prediction model based on meta-pattern mining and cue guidance captures temporal and spatial heterogeneity by generating multi-scale temporal cues and semantic spatial cues, and integrates temporal and spatial cues through spatiotemporal interaction modeling to obtain comprehensive spatiotemporal cues, thereby guiding the spatiotemporal modeling process to overcome the interference of spatiotemporal heterogeneity. The training module uses a standard data set to train the prediction model; Among them, meta-pattern mining and prompt-guided prediction models include: The encoder and decoder capture spatiotemporal dependencies and generate spatiotemporal representations layer by layer through stacked graph convolutional networks and temporal convolutional networks; The self-supervised meta-pattern mining module mines discriminative meta-patterns in the feature space through self-supervised learning and stores them in a meta-pattern library. It then retrieves historical spatiotemporal sequences from the meta-pattern library to obtain local trend information to supplement spatiotemporal cues. The spatiotemporal cue generation module generates specific cue vectors in time and space to capture spatiotemporal heterogeneity and obtain fused spatiotemporal cues. The spatiotemporal cue guidance module performs feature splicing on the meta-pattern and the generated spatiotemporal cue to obtain enhanced spatiotemporal cue. After inputting it into the encoder, it performs cue guidance on the encoded spatiotemporal representation to overcome the interference of heterogeneity on spatiotemporal modeling.
Citation Information
Cited By
Distributed drift adaptive time series prediction model generation method
CN121030346A
Drain outlet monitoring method and system based on unmanned aerial vehicle
CN121392674A