Weather prediction method and device based on improved graph convolutional neural network, and medium

Through the improved graph convolution neural network, combined with BiLSTM, GCN and Transformer models, the shortcomings of existing weather prediction models in terms of data information utilization, training time, prediction accuracy, generalization ability and interpretability are solved, and more efficient and accurate weather prediction is achieved.

CN119781081APending Publication Date: 2025-04-08SHANGHAI MARITIME UNIVERSITY
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411566183.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-05
Publication Date
2025-04-08

AI Technical Summary

Technical Problem

The existing weather forecasting models have shortcomings in data information utilization, training time, prediction accuracy, generalization ability and interpretability, resulting in poor prediction results.

Method used

Using an improved graph convolution neural network, combined with BiLSTM, GCN and Transformer models, weather time characteristics are extracted through BiLSTM, GCN analyzes spatial structure information, and predicts and classifies through Transformer, comprehensively utilizes time and spatial characteristics.

Benefits of technology

It improves the accuracy and efficiency of weather forecasts, enhances the generalization ability of the model, and improves the interpretability of the prediction results through self-attention mechanism.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119781081A_ABST
    Figure CN119781081A_ABST
Patent Text Reader

Abstract

The invention relates to a weather prediction method and device based on an improved graph convolutional neural network, and a medium, and the method is characterized in that the improved graph convolutional neural network comprises a BiLSTM model, a GCN model, and a Transform model, which are connected in sequence; the method comprises the following steps: collecting historical weather data time sequence information of a plurality of regions to construct a time characteristic matrix, and inputting the time characteristic matrix into a BiLSTM model to obtain the time characteristic matrix; analyzing space structure information of the weather data to obtain three relationships among characterization regions, namely the same longitude, the same latitude and the bordering position, and constructing a corresponding adjacent matrix; inputting the adjacent matrix and the time characteristic matrix into a GCN model to respectively obtain new characteristic matrixes containing time-space relations corresponding to the three relations, and adding the three new characteristic matrixes to obtain a characteristic matrix X containing all the time-space relations; and inputting the feature matrix X into a Transform model, and outputting a weather prediction result of the prediction day. Compared with the prior art, the method has the advantages of accurate prediction result, rapidness and the like.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of machine learning technology, and in particular to a weather forecasting method, device and medium based on an improved graph convolutional neural network. Background Art

[0002] With the rapid development of computer technology, wireless communication and the Internet, every aspect of life is inseparable from the influence of artificial intelligence. Artificial intelligence, especially machine learning, has greatly improved the accuracy and efficiency of data processing in all walks of life.

[0003] Although deep learning models have made significant progress in weather forecasting, existing single models and hybrid models still have some problems that limit their further development. These problems mainly include:

[0004] 1. Insufficient utilization of data information:

[0005] Limitations of a single model: Traditional machine learning models such as SVM and decision trees can only focus on the single feature of temperature, ignoring the relationship between other meteorological elements and temperature. Deep learning models such as LSTM and GRU can learn a variety of meteorological features related to temperature, such as rainfall, but still have the problem of insufficient information utilization.

[0006] Limitations of feature selection methods: Traditional feature selection methods such as information gain and chi-square test are difficult to effectively screen out features that are closely related to temperature prediction from a large amount of meteorological data, resulting in limited model performance.

[0007] 2. Slow training time:

[0008] Complex model structure: Deep learning models often have complex structures and require a large amount of training data and computing resources, resulting in long training times.

[0009] Hyperparameter Tuning: Deep learning models have numerous hyperparameters that need to be tuned through trial and error, further increasing training time.

[0010] 3. Low prediction accuracy:

[0011] Data non-stationarity: Meteorological data has obvious non-stationarity. Traditional statistical models are difficult to effectively handle such changes, resulting in low prediction accuracy.

[0012] Data sparsity: Meteorological data often contain a large number of missing values. Traditional filling methods such as mean filling and median filling will lead to a decrease in prediction accuracy.

[0013] 4. Weak generalization ability:

[0014] Changes in data distribution: The distribution of meteorological data may change with time, location and other factors, resulting in a decrease in the generalization ability of the model.

[0015] Model overfitting: Deep learning models are prone to overfitting, which causes the model to perform well on the training data but poorly on the test data.

[0016] 5. Difficult to explain:

[0017] Model black box characteristics: Deep learning models are often viewed as black boxes, and it is difficult to explain the reasons behind their prediction results, which limits the scope of application of the models.

[0018] Lack of explainable technology: Currently, explainable technology is not yet mature, and it is difficult to effectively explain the prediction process of deep learning models.

[0019] After searching, Chinese invention patent publication number CN117891007A discloses a weather prediction method based on time-varying graph neural network, including: obtaining weather data of the area to be tested; using a trained prediction model that integrates multiple weather data to process the weather data of the area to be tested, and obtaining the weather prediction results of the area to be tested; the method for determining the trained prediction model that integrates multiple weather data includes: obtaining multiple types of spatiotemporal weather series data of multiple regions; preprocessing multiple types of spatiotemporal weather series data of multiple regions, thereby obtaining multiple regional weather data sets; constructing a static adjacency matrix, a dynamic time-varying adjacency matrix and an external adjacency matrix, building a graph convolution layer, a void causal convolution structure and a fusion layer, thereby establishing a time-varying graph neural network model; through multiple regional weather data sets, static adjacency matrix, dynamic time-varying adjacency matrix and external adjacency matrix, the time-varying graph neural network model is trained to obtain model parameters, and then determine the prediction model that integrates multiple weather data. This existing patent has the problem that the spatial structure of the location borders is not considered, resulting in insufficient prediction accuracy.

[0020] How to achieve efficient and accurate weather forecasting has become a technical problem that needs to be solved. Summary of the invention

[0021] The purpose of the present invention is to overcome the defects of the above-mentioned prior art and provide a weather forecasting method based on an improved graph convolutional neural network.

[0022] The purpose of the present invention can be achieved by the following technical solutions:

[0023] According to one aspect of the present invention, a weather prediction method based on an improved graph convolutional neural network is provided, wherein the improved graph convolutional neural network comprises a BiLSTM model, a GCN model and a Transformer model connected in sequence;

[0024] The method comprises the following steps:

[0025] Collect historical weather data from multiple regions, construct a time feature matrix based on the weather time series information, and input it into the BiLSTM model to obtain the weather time feature matrix H;

[0026] By analyzing the spatial structure information of the collected weather data, we can get three relationships between regions, including the same longitude, the same latitude and the adjacent location. The corresponding adjacency matrices are A a、 A b and A c ;

[0027] The adjacency matrix and the temporal feature matrix are input into the GCN model to obtain the new feature matrix X containing the temporal and spatial relationships corresponding to the three relationships. a , X b and X c , add the three new feature matrices to get the feature matrix X containing all spatiotemporal relationships, where X = X a +X b +X c ;

[0028] The feature matrix X is input into the Transformer model, and the weather forecast result for the forecast day is output, and the classification is performed as rain or no rain.

[0029] Preferably, the time characteristic matrix of the weather is obtained as follows:

[0030] For training on the temperature data of day t+1, the features in the lookback window T are used to capture the time series information, where the lookback window T represents the T days before the forecast date, i.e., the tth date from t-T+1 to t;

[0031] During training, the input features of region i are defined as:

[0032] F i =[f i,t -T+1,...f i,t-1 ,f i,t ]

[0033] Among them, f i,t is the weather characteristic vector of region i T days before the forecast date;

[0034] Next F i is fed into a single BiLSTM model with Dropout to discover the temporal pattern of region i:

[0035] h i,t+1 =D(BiLSTM(F i ))

[0036] After the BiLSTM model, the time feature matrix H is obtained:

[0037] H=[h 1,t+1, ,h 2,t+1 ,h 3,t+1 ...h i,t+1 ...h N,t+1 ]

[0038] Among them, h i,t+1 is the hidden state of the final output, that is, the time feature of region i on the t+1th day; D(.) is the Dropout processing function.

[0039] More preferably, the hidden layer F of the BiLSTM model i The size is 200.

[0040] Preferably, the adjacency matrix represents the relationship between regions. In the matrix, if the relationship represented between two regions is related, the value is 1, otherwise it is 0.

[0041] Preferably, the calculation process of the new feature matrix containing the spatiotemporal relationship includes:

[0042] The adjacency matrix A a Input the GCN model to update the features of each node and get the matrix L a :

[0043]

[0044] in, is the Laplace matrix, is the diagonal matrix, A a is the adjacency matrix, W is the trainable parameter in GCN, ReLU(.) is the activation function, L a is the output of GCN;

[0045] The matrix L a Connect it with the time feature matrix H to get the matrix M a :

[0046]

[0047] M a The matrix is ​​weighted to obtain a new feature matrix X containing time-space relationships a , where the new feature matrix X a The spatial relationship is that the longitude is the same.

[0048] More preferably, the calculation process of the new feature matrix containing the time-space relationship further includes: using the new feature matrix X a In the same way, the adjacency matrix Ab and A c Input into the GCN model to obtain the corresponding new feature matrix X containing time and space relationships b and X c .

[0049] Preferably, the weather forecast result includes temperature and weather conditions, and the weather conditions are classified into sunny days and rainy days.

[0050] Preferably, the method comprises calculating the temporal feature matrix and the adjacency matrix simultaneously.

[0051] According to another aspect of the present invention, an electronic device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the method described above is implemented when the processor executes the program.

[0052] According to a third aspect of the present invention, there is provided a computer-readable storage medium having a computer program stored thereon, wherein the program implements the method described above when executed by a processor.

[0053] Compared with the prior art, the present invention has the following beneficial effects:

[0054] 1) The present invention obtains the time feature matrix of the weather through the BiLSTM model, analyzes the spatial structure information of the weather to obtain the adjacency matrix corresponding to the three spatial relationships, and then simultaneously inputs the two matrices into the GCN model to obtain the feature matrix X of the spatiotemporal relationship. Finally, the Transformer model is used to output the weather forecast result of the forecast day. The comprehensive application of the three models solves the problem of decreased generalization ability of the model, and the organic combination of spatiotemporal features makes the weather forecast result more accurate.

[0055] 2) The present invention assigns different weights to matrices containing spatiotemporal relationships corresponding to different spatial relationships, so that the prediction can efficiently utilize important information, thereby making the prediction result more accurate.

[0056] 3) The present invention combines the Transformer model, the core of which is the self-attention mechanism, which enables the model to dynamically focus on different important parts when processing input data, and can automatically perform weather analysis and prediction based on spatiotemporal features, and classify whether it will rain.

[0057] 4) The present invention can simultaneously analyze the temporal and spatial relationships of weather data, thereby improving the efficiency of outputting forecast results. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] Figure 1 This is a schematic diagram of the improved graph convolutional neural network structure of the present invention;

[0059] Figure 2It is a schematic diagram of the flow chart of the weather forecasting method in the present invention. DETAILED DESCRIPTION

[0060] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0061] Example 1

[0062] This embodiment relates to a weather forecasting method based on an improved graph convolutional neural network, which combines a Transformer model with a GCN graph neural network model. First, the BiLSTM model is used to process the time series characteristics of regional weather, and then the GCN graph neural network model is used to process the spatial structure characteristics of regional weather. A matrix combining time and space characteristics is constructed, and then the Transformer model is put into the matrix to analyze the feature information and predict the weather conditions.

[0063] The method comprises the following steps, such as Figure 2 As shown:

[0064] Step S1, construct a time feature matrix with the weather time series information, put it into the BiLSTM layer (the hidden layer state size is 200) for encoding and dropout (regularization) to obtain an N*200 time feature matrix H.

[0065] Step S2, analyze the spatial structure information of weather in multiple regions over a period of time, and divide the relationship between regions into three categories, namely Ca (same longitude position relationship), Cb (same latitude position relationship), and Cc (position border relationship). Since weather forecasts are represented by graphs, in order to combine the impact of related weather, we use the GCN network to learn graphs. GCN has proven its ability to effectively obtain structural information in graphs. The input of the GCN model consists of the time feature matrix output by BiLSTM (including the features of each node) and an adjacency matrix (representing the relationship between nodes). The GCN model can update the feature representation of each node according to the adjacency matrix and fuse the features of its neighboring nodes through convolution operations. In practical applications, the degree of influence of each relationship on the node is different. For example, due to the location relationship, the climate and rainfall between the bordering areas are relatively similar. However, there is a correlation between the data of longitude and latitude, and they will not have a greater impact on each other, and the degree of correlation is not as good as that of the bordering areas. Therefore, it is crucial to assign different importance weights to different relationships. The adjacency matrix and feature matrix constructed by the three relationships are respectively input into GCN to obtain a new feature matrix X of N*400. a , X b and X c .

[0066] Step S3, add the three new feature matrices to obtain a feature matrix X containing all spatial and temporal relationships, where X = X a +X b +X c .

[0067] Step S4, using the Transformer model to analyze and predict the information in the feature matrix X, the prediction results include the temperature on the predicted day and whether it will rain.

[0068] Classify the temperature in various regions as rainy or non-rainy.

[0069] like Figure 1 The figure shows the overall structure diagram of the weather forecast model of the present invention.

[0070] In step S1, we process the weather characteristic information of n regions, of which the most important part is the time series characteristics of the weather. In processing weather data, BiLSTM performs well in processing continuous time series data. The training steps are: For the training step of learning the temperature data of the t+1th day, the features in the lookback window T are used to capture the time series information. The lookback window T represents the T days before the forecast day (t+1 day), that is, the tth date from t-T+1 to t. Then in the training step, the input features of region i are defined as:

[0071] F i =[fi,t -T+1,...f i,t-1 ,f i,t ]

[0072] Among them, f i,t is the weather characteristic matrix of region i in the previous T days.

[0073] It is then fed into a single BiLSTM layer with Dropout (D(.)) to discover the temporal pattern of temperature in region i:

[0074] h i,t+1 =D(BiLSTM(F i ))

[0075] where h i,t+1 is the hidden state of the final output, the hidden layer F of the BilSTM layer i The state size is 200.

[0076] So after the BiLSTM layer, we get the matrix H:

[0077] H=[h 1,t+1, ,h 2,t+1 ,h 3,t+1 ...h i,t+1 ...h N,t+1 ]

[0078] In step S2, the regional relationship can be divided into three categories, Ca (same longitude position relationship), Cb (same latitude position relationship) and Cc (bordering position relationship). An adjacency graph is made based on the relationship between the regions and the classification is performed.

[0079] Taking the same longitude as an example, make an adjacency matrix A of regional relationships based on the adjacency graph. a In this matrix, relevant values ​​are 1 and irrelevant values ​​are 0.

[0080] In the same way, we get the adjacency matrix A corresponding to the same position relationship at latitude. b The adjacency matrix A corresponding to the position border relationship c .

[0081] Then we put this matrix into GCN to update the features of each node and get the matrix L a :

[0082]

[0083] in is the Laplacian matrix, is the diagonal matrix, A a is the adjacency matrix, W is the trainable parameter in GCN, ReLU(.) is the activation function, L ais the output of GCN, and the hidden layer size is 200.

[0084] The processing of the temporal feature matrix and the spatial feature matrix can be performed simultaneously. The two matrices are simultaneously input into GCN for processing to obtain the output matrix L a Details such as Figure 1 shown.

[0085] L a Connect it with the H matrix to get the matrix M a .

[0086]

[0087] In this embodiment, H and L are connected a The matrix dimension of is 400.

[0088] Next is M a The matrix is ​​assigned weights to obtain the matrix X a Repeat the above operation for other adjacency relations to obtain the matrix X b and X c , where X a , X b and X c They are new feature matrices containing spatiotemporal relationships corresponding to Ca (same longitude position relationship), Cb (same latitude position relationship) and Cc (bordering position relationship).

[0089] In step S3, the three matrices are added to obtain the matrix X:

[0090] X=X a +X b +X c .

[0091] In step S4, the matrix X is processed and put into Transformer for analysis and classification to predict the weather conditions within a period of time, including temperature and weather conditions. The weather conditions are classified into sunny days (no rain is uniformly called sunny days) and rainy days (including hail, etc.).

[0092] Example 2

[0093] The electronic device of the present invention includes a central processing unit (CPU), which can perform various appropriate actions and processes according to computer program instructions stored in a read-only memory (ROM) or loaded from a storage unit into a random access memory (RAM). In the RAM, various programs and data required for device operation can also be stored. The CPU, ROM and RAM are connected to each other via a bus. An input / output (I / O) interface is also connected to the bus.

[0094] Multiple components in the device are connected to the I / O interface, including: input units, such as keyboards, mice, etc.; output units, such as various types of displays, speakers, etc.; storage units, such as disks, optical disks, etc.; and communication units, such as network cards, modems, wireless communication transceivers, etc. The communication unit allows the device to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunication networks.

[0095] The processing unit performs the various methods and processes described above, such as methods S1 to S4. For example, in some embodiments, methods S1 to S4 may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit. In some embodiments, part or all of the computer program may be loaded and / or installed on the device via a ROM and / or a communication unit. When the computer program is loaded into the RAM and executed by the CPU, one or more steps of methods S1 to S4 described above may be performed. Alternatively, in other embodiments, the CPU may be configured to execute methods S1 to S4 in any other appropriate manner (e.g., by means of firmware).

[0096] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0097] The program code for implementing the method of the present invention can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code can be executed entirely on the machine, partially on the machine, partially on the machine as a stand-alone software package and partially on a remote machine, or entirely on a remote machine or server.

[0098] In the context of the present invention, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0099] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.

Claims

1. A weather forecasting method based on an improved graph convolutional neural network, characterized in that: The improved graph convolutional neural network includes a BiLSTM model, a GCN model and a Transformer model connected in sequence; The method comprises the following steps: Collect historical weather data from multiple regions, construct a time feature matrix based on the weather time series information, and input it into the BiLSTM model to obtain the weather time feature matrix H; By analyzing the spatial structure information of the collected weather data, we can get three relationships between regions, including the same longitude, the same latitude and the adjacent location. The corresponding adjacency matrices are A a、 A b and A c ; The adjacency matrix and the temporal feature matrix are input into the GCN model to obtain the new feature matrix X containing the temporal and spatial relationships corresponding to the three relationships. a , X b and X c , add the three new feature matrices to get the feature matrix X containing all spatiotemporal relationships, where X = X a +X b +X c ; The feature matrix X is input into the Transformer model, and the weather forecast result for the forecast day is output, and the classification is performed as rain or no rain.

2. A weather forecasting method based on an improved graph convolutional neural network according to claim 1, characterized in that: The time characteristic matrix of the weather is specifically obtained as follows: For training on the temperature data of day t+1, the features in the lookback window T are used to capture the time series information, where the lookback window T represents the T days before the forecast date, i.e., the tth date from t-T+1 to t; During training, the input features of region i are defined as: F i =[f i,t -T+1,...f i,t-1 ,f i,t ] Among them, f i,t is the weather characteristic vector of region i T days before the forecast date; Next F i is fed into a single BiLSTM model with Dropout to discover the temporal pattern of region i: h i,t+1 =D(BiLSTM(F i )) After the BiLSTM model, the time feature matrix H is obtained: H=[h 1,t+1, ,h 2,t+1 ,h 3,t+1 ...h i,t+1 ...h N,t+1 ] Among them, h i,t+1 is the hidden state of the final output, that is, the time feature of region i on the t+1th day; D(.) is the Dropout processing function.

3. A weather forecasting method based on an improved graph convolutional neural network according to claim 2, characterized in that: The hidden layer F of the BiLSTM model i The size is 200.

4. The weather forecasting method based on an improved graph convolutional neural network according to claim 1, characterized in that: The adjacency matrix represents the relationship between regions. In the matrix, if the relationship between two regions is related, it takes 1, otherwise it takes 0.

5. The weather forecasting method based on an improved graph convolutional neural network according to claim 1, characterized in that: The calculation process of the new feature matrix containing the spatiotemporal relationship includes: The adjacency matrix A a Input the GCN model to update the features of each node and get the matrix L a : in, is the Laplace matrix, is the diagonal matrix, A a is the adjacency matrix, W is the trainable parameter in GCN, ReLU(.) is the activation function, L a is the output of GCN; The matrix L a Connect it with the time feature matrix H to get the matrix M a : M a The matrix is ​​weighted to obtain a new feature matrix X containing time-space relationships a , where the new feature matrix X a The spatial relationship is that the longitude is the same.

6. A weather forecasting method based on an improved graph convolutional neural network according to claim 5, characterized in that: The calculation process of the new feature matrix containing the time-space relationship also includes: using the new feature matrix X a In the same way, the adjacency matrix A b and A c Input into the GCN model to obtain the corresponding new feature matrix X containing time and space relationships b and X c .

7. The weather forecasting method based on an improved graph convolutional neural network according to claim 1, characterized in that: The weather forecast result includes temperature and weather conditions, and the weather conditions are classified into sunny days and rainy days.

8. The weather forecasting method based on an improved graph convolutional neural network according to claim 1, characterized in that: The method includes calculating the temporal feature matrix and the adjacency matrix simultaneously.

9. An electronic device comprising a memory and a processor, wherein a computer program is stored in the memory, wherein: When the processor executes the program, the method according to any one of claims 1 to 8 is implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • Weather prediction method based on time-varying graph neural network

    CN117891007A