An adaptive directional forecasting method for weather data
Through multiple independent LSTM-BN weather prediction networks and voting mechanisms, combined with adaptive loss function and inherited segmentation training, the accuracy and stability of weather data timing signal prediction are solved, and the prediction ability and long-term prediction effect are improved. .
Patent Information
- Application Number
- CN202010174003.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-03-13
- Publication Date
- 2024-12-24
- Estimated Expiration
- 2040-03-13
AI Technical Summary
The prior art is difficult to effectively predict weather data timing signals with significant time domain continuity, nonlinearity and non-stationary characteristics. Especially when the time interval between the training data and test data of the network increases, the prediction ability decreases and the overfitting phenomenon is serious. .
Multiple independent LSTM-BN weather prediction networks are used to predict the directional weather data separately, and the final result is determined through the voting mechanism, combining the adaptive loss function and inherited segmented training method to improve the time when the network changes drastic weather data direction. predictive ability of points.
It significantly improves the accuracy and stability of weather data directional prediction, can effectively process nonlinear signals with time domain continuity, reduces the complexity of network parameter updates, and realizes long-term effective weather data prediction.
Smart Images

Figure CN111460913B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of weather forecasting and deep learning technology, and in particular relates to an adaptive weather data directional prediction method. Background Art
[0002] As a time series signal, weather data can be roughly divided into two types of prediction models: linear models and nonlinear models. There are many effective prediction methods for linear models, such as the autoregressive model with control terms (CAR), the moving average model (MA), and the autoregressive moving average model (ARMA) in the traditional time series prediction methods. CAR, MA, and ARMA are all linear models in the statistical category, which are suitable for the prediction of weather data time series with seasonal, periodic and other stable characteristics. However, in actual production and life, most of the weather data time series signals involved in people are nonlinear, with nonlinear, non-stationary and even random characteristics. Since linear models cannot fully reflect the complex change characteristics of weather data time series, using existing linear models to predict nonlinear weather data time series signals often does not obtain valuable prediction results.
[0003] In recent years, with the advancement of research on neural networks and deep learning, methods for predicting nonlinear time series signals using BP (back propagation, BP) neural networks or recurrent neural networks (RNN) have been widely studied. Artificial neural networks have shown good learning ability in nonlinear time series signal prediction and do not require the accumulation of prior knowledge, making them more suitable for nonlinear time series signal prediction in practical work.
[0004] Related research shows that RNN, especially the long short-term memory network (LSTM-Net), can solve the gradient vanishing problem and learn the long-term dependencies between time series signals, showing higher prediction performance in the prediction of time series signals with high time dependence.
[0005] However, for highly nonlinear weather data time series signals, it is difficult to obtain a stable prediction result by simply using LSTM-Net for regression or classification prediction, and the overfitting phenomenon is relatively serious. Even when predicting weather data time series signals with a low degree of nonlinearity, the directional prediction results of the network are not ideal when the weather data signal changes dramatically, and the prediction results of the network will show a certain degree of "delay" as a whole.
[0006] At the same time, although LSTM-Net can learn long-term dependencies between time series signals, in the prediction of nonlinear time series signals with significant time persistence, such as weather data, as the time interval between the training data set and the test data set continues to increase, the network's prediction ability will show a downward trend.
[0007] In summary, for weather data time series signals with significant temporal continuity, nonlinearity and non-stationary characteristics, it is necessary to propose an adaptive directional prediction method for weather data to improve the performance of existing prediction methods. Summary of the invention
[0008] To solve the above problems, the present invention provides an adaptive directional prediction method for weather data, which can significantly improve the prediction accuracy and stability.
[0009] An adaptive weather data directional prediction method comprises the following steps:
[0010] S1: Use s independently trained LSTM-BN weather prediction networks to predict the directionality of weather data respectively, and obtain s independent weather data direction prediction values, where the LSTM-BN weather prediction network includes an LSTM network, a BN layer, an activation layer, and a fully connected layer. The directionality includes rising and falling, and s is an odd number greater than or equal to 3; the weather data is any one of temperature, humidity, wind force, wind speed, air pressure, rainfall, snowfall, PM2.5 concentration, dew point temperature, visibility, and ultraviolet intensity;
[0011] S2: Voting is performed on s independent weather data directional prediction values, and the weather data directional prediction value with the majority of votes is the final prediction result of the weather data.
[0012] Furthermore, the training method of the LSTM-BN weather prediction network for predicting the directionality of weather data is:
[0013] S101: Calculate the original change rate data R corresponding to the original weather data X according to the following formula:
[0014]
[0015] Among them, X t represents the weather data for day t in X, X t-1 represents the weather data of day t-1; R t is an element in the original change rate data R, representing the change rate of the weather data on the tth day relative to the weather data on the t-1th day;
[0016] S102: performing data segmentation on the original rate of change data R to obtain a weather data sub-training set and a weather data sub-testing set with temporal continuity;
[0017] S103: labeling two labels for each weather data change rate training sample in the weather data sub-training set, wherein the two labels are respectively the change rate and change direction of the weather data at the next moment corresponding to each weather data change rate training sample;
[0018] S104: Initializing network parameters of s LSTM-BN weather prediction networks respectively, wherein the network parameters include weight parameters and bias value parameters, and each LSTM-BN weather prediction network is respectively recorded as Net_1, ..., Net_s;
[0019] S105: Use the weather data sub-training set X_Train_1 to independently train each LSTM-BN weather prediction network to obtain s LSTM-BN weather prediction networks with the same network structure but different network parameters, and record them as Net_1_1, ..., Net_s_1 respectively;
[0020] S106: according to the labels of the weather data change rate training samples in the weather data sub-training set X_Train_1, an adaptive Ada_loss_function loss function is used to calculate the loss values loss_1_1,…,loss_s_1 corresponding to the networks Net_1_1,…,Net_s_1;
[0021] S107: According to the loss values loss_1_1,…,loss_s_1, the network parameters of each LSTM-BN weather prediction network are updated respectively using the learning algorithm in deep learning, and at the same time, the weather data direction prediction value corresponding to each LSTM-BN weather prediction network after this update is obtained according to the weather data sub-test set X_Test_1;
[0022] S108: Determine whether the accuracy of the weather data direction prediction value corresponding to each LSTM-BN weather prediction network after the update reaches a predetermined threshold. If not, proceed to step S109; if reached, end the training and obtain the LSTM-BN weather prediction network corresponding to the weather data sub-training set X_Train_1;
[0023] S109: Repeat steps S106 to S108 until the accuracy of the network in classifying the training set reaches a predetermined threshold.
[0024] Furthermore, the calculation formula of the loss value of Net_1_1 is as follows:
[0025]
[0026] Wherein, C is the number of categories corresponding to the directionality of the weather data, C=2; F(Y_Train_R_1) represents the preset function transformation of the change rate of the weather data at the next moment corresponding to the first weather data sub-training set; Y_Train_U_1 is the change direction of the weather data at the next moment corresponding to the first weather data sub-training set, (log_softmax(Pre_1_1)) i It is expressed as:
[0027]
[0028] Among them, Pre_1_1 is the weather data direction prediction value corresponding to the network Net_1_1, (Pre_1_1) i is the i-th number in Pre_1_1.
[0029] Further, the original change rate data R is segmented to obtain more than two weather data sub-training sets and weather data sub-testing sets with temporal continuity. Except for the first weather data sub-training set X_Train_1 and the first weather data sub-testing set X_Test_1, the remaining weather data sub-training sets and weather data sub-testing sets continue to be trained, wherein the training specifically includes the following steps:
[0030] S110: Using the second weather data sub-training set X_Train_2, the LSTM-BN weather prediction network is trained on the basis of inheriting the network parameters of Net_1_1, ..., Net_s_1, and s LSTM-BN weather prediction networks with the same network structure but different network parameters are obtained again, and they are recorded as Net_1_2, ..., Net_s_2 respectively;
[0031] S111: After adding a penalty term related to the network parameters of the networks Net_1_1, ..., Net_s_1 in the adaptive Ada_loss_function loss function, the loss values loss_1_2, ..., loss_s_2 corresponding to the networks Net_1_2, ..., Net_s_2 are calculated according to the labels of the training samples of the weather data change rates in the second weather data sub-training set X_Train_2;
[0032] S112: According to the loss values loss_1_2,…,loss_s_2, the network parameters of each LSTM-BN weather prediction network are updated respectively using the learning algorithm in deep learning, and at the same time, the weather data direction prediction value corresponding to each LSTM-BN weather prediction network after this update is obtained according to the second weather data sub-test set X_Test_2;
[0033] S113: Determine whether the accuracy of the weather data direction prediction value corresponding to each LSTM-BN weather forecast network after the update reaches a predetermined threshold. If not, proceed to step S114; if reached, end the training and obtain the network corresponding to the second weather data sub-training set X_Train_2;
[0034] S114: Repeat S111-S113 until the accuracy of the network in classifying the training set reaches a predetermined threshold;
[0035] S115: And so on, repeat steps S110 to S114 to obtain the network corresponding to the remaining weather data sub-training sets.
[0036] Furthermore, when training X_Train_j, the loss value is calculated as follows:
[0037]
[0038] Among them, j = 2,…,s, λ is the set weight factor, θ z Represents the weight parameters of network Net_1_j to be trained when training network Net_1_j; Represents the network weight parameters of network Net_1_j-1, during the training of network Net_1_j is a fixed value, C is the number of categories corresponding to the directionality of weather data, and C=2, F(Y_Train_R_j) represents the function transformation of the rate of change of weather data at the next moment corresponding to the jth weather data sub-training set; Y_Train_U_j is the direction of change of weather data at the next moment corresponding to the first weather data sub-training set, (log_softmax(Pre_1_j)) i It is expressed as:
[0039]
[0040] Among them, Pre_1_j is the predicted value corresponding to the network Net_1_j, (Pre_1_j) i is the i-th number in Pre_1_j.
[0041] Further, the original rate of change data R in step S101 is subjected to data preprocessing to obtain the rate of change data after the preprocessing operation. Then, the rate of change data Perform data segmentation and then perform subsequent steps.
[0042] Beneficial effects:
[0043] 1. The present invention provides an adaptive weather data directional prediction method, which adopts an LSTM network combined with a BN layer and a fully connected layer. The method is applicable to both linear signal models and nonlinear signal models, and is particularly applicable to weather data with significant temporal continuity. The method can effectively improve the network's prediction ability for time points with drastic changes in direction. In addition, the present invention also adopts a method in which multiple independently trained LSTM-BN weather prediction networks are used to independently predict the directionality of weather data, and then a plurality of prediction results are voted on, which significantly improves the accuracy and stability of weather data directional prediction.
[0044] 2. The present invention provides an adaptive directional prediction method for weather data. After obtaining the initial LSTM-BN weather prediction network, an inherited segmented training method is used to obtain the LSTM-BN weather prediction network corresponding to the remaining weather data sub-training set. Without completely repeating the network training process, the network parameters can be updated for the weather data test sets of different time periods, thereby achieving long-term effective prediction of weather data. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 A flow chart of an adaptive weather data directional prediction method provided by the present invention;
[0046] Figure 2 A schematic diagram of the LSTM-BN weather forecast network structure provided by the present invention;
[0047] Figure 3 A schematic diagram of a training method for an adaptive LSTM-BN weather prediction network provided by the present invention;
[0048] Figure 4 A schematic diagram of the adaptive weather data directional prediction method provided by the present invention;
[0049] Figure 5 A schematic diagram of the present invention for training a network using an inherited segmented training method to achieve long-term prediction. DETAILED DESCRIPTION
[0050] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
[0051] like Figure 1 As shown, an adaptive weather data directional prediction method comprises the following steps:
[0052] S1: Use s independently trained LSTM-BN weather prediction networks to predict the directionality of weather data respectively, and obtain s independent weather data direction prediction values, where Figure 2As shown in the figure, the LSTM-BN weather forecast network includes an LSTM network, a BN layer, an activation layer, and a fully connected layer. The directionality includes ascending and descending, and s is an odd number greater than or equal to 3. The weather data is any one of temperature, humidity, wind force, wind speed, air pressure, rainfall, snowfall, PM2.5 concentration, dew point temperature, visibility, and ultraviolet intensity.
[0053] It should be noted that the present invention is based on the LSTM network suitable for processing weather data, adds a BN layer and a fully connected layer, and creates a forward deep classification network LSTM-BN, wherein the forward deep classification network LSTM-BN can be regarded as a classifier, and the input of the classifier is the degree of change of the given weather data after data preprocessing, and the output is the predicted change direction of the input sample at the next moment.
[0054] S2: Voting is performed on s independent weather data direction prediction values, and the weather data direction prediction value with the majority of votes is the final prediction result of the weather data direction.
[0055] It can be seen that the present invention provides a prediction method based on a voting mechanism, which adopts a method of independently training and independently predicting multiple networks, and then voting on the obtained multiple groups of prediction results to obtain the final prediction results, thereby improving the prediction accuracy and stability of the network for the directionality of weather data. For the same time-domain continuous weather data training set X_Train and the same network structure setting, multiple LSTM-BN weather prediction networks are independently trained, which can be recorded as Net_1, ..., Net_s. When the network training is completed and the weather data test set X_Test is predicted, Net_1, ..., Net_s are used to independently obtain multiple groups of weather data directional prediction values Pre_1, ..., Pre_s; all corresponding points in the multiple groups of weather data directional prediction values Pre_1, ..., Pre_s are voted, and the weather data directional prediction value with the majority of votes is the final prediction result Pre_fin of X_Test.
[0056] Furthermore, an adaptive LSTM-BN weather prediction network training method of the present invention can improve the network's prediction ability for time points when the direction of weather data changes dramatically. Assume that the change rate of weather data corresponding to the time-continuous weather data training set X_Train is R_Train, and the change direction is U_Train (increase to 1, decrease to 0). During the network training process, when X_Train completes forward propagation through the network to obtain the weather data direction prediction value Pre (the direction of increase or decrease of the input weather data), the loss value is calculated by multiplying the cross entropy loss value calculated by C_Train and Pre by the value after R_Train is transformed by a certain function, that is, the loss function Ada_loss_function, and the weather data direction prediction accuracy P is calculated by Pre and U_Train; then, the network is iteratively trained by minimizing the loss value using a deep learning algorithm, and the training is stopped when P reaches a predetermined threshold. Figure 3 As shown, the training method of the LSTM-BN weather prediction network for predicting the directionality of weather data specifically includes the following steps:
[0057] S101: Calculate the original change rate data R corresponding to the original weather data X according to the following formula:
[0058]
[0059] Among them, X t Represents the weather data for day t in vector X, X t-1 Represents the weather data for day t-1 in vector X; R t is the element in the vector original change rate data R, representing the change rate of the weather data on the tth day relative to the weather data on the t-1th day, where R t <0 means that the weather data on day t is lower than that on day t-1. t ≥0 means that the weather data value on day t has increased or has not changed relative to the value on day t-1 (equal to 0, indicating that the two are equal);
[0060] It should be noted that the original rate of change data R is subjected to data preprocessing operations, such as normalization, to obtain the rate of change data after the preprocessing operation. Then, the rate of change data Perform data segmentation and then execute subsequent steps; among them, perform data preprocessing on the original change rate data R, which can make the data distribution relatively more concentrated, which is conducive to convergence during network training and avoid overfitting or underfitting.
[0061]
[0062] in, represents the rate of change data after data preprocessing, and h(·) represents the data preprocessing operation used in this experiment.
[0063] S102: Rate of change data Perform data segmentation to obtain two or more weather data sub-training sets and weather data sub-testing sets with temporal continuity, that is, there are some identical samples between two adjacent weather data training sets; wherein the number of weather data sub-training sets and weather data sub-testing sets is the same, both being two or more;
[0064]
[0065]
[0066]
[0067]
[0068] in, represents the jth sample in the i-th weather data sub-training set X_Train_i. The sample is the rate of change data of the original weather data, and the i-th weather data sub-training set has n i training samples, and the corresponding weather data subtest set includes k i samples.
[0069] S103: labeling two labels for each weather data change rate training sample in the weather data sub-training set, wherein the two labels are the change rate R of the weather data at the next moment corresponding to each weather data change rate training sample. t and direction of change;
[0070] It should be noted that the change direction data of the weather data at that moment relative to the previous moment can be calculated by the positive or negative change rate data of each time point in the original change rate data R.
[0071]
[0072] Among them, U t Vector change direction data The elements in which U t =0 means that the weather data on day t is lower than that on day t-1. t =1 means that the value of weather data on day t increases or remains unchanged relative to day t-1.
[0073] S104: Initializing network parameters of s LSTM-BN weather prediction networks respectively, wherein the network parameters include weight parameters and bias value parameters, and each LSTM-BN weather prediction network is respectively recorded as Net_1, ..., Net_s;
[0074] S105: Using the first weather data sub-training set X_Train_1, each LSTM-BN weather prediction network is independently trained to obtain s LSTM-BN weather prediction networks with the same network structure but different network parameters, which are respectively recorded as Net_1_1, ..., Net_s_1;
[0075] It should be noted that the weather data training set samples first pass through a multi-layer LSTM structure, then through a BN layer and an activation layer, and finally through a multi-layer fully connected structure to obtain a network output value with a dimension of 2×1.
[0076] S106: according to the labels of the weather data change rate training samples in the first weather data sub-training set X_Train_1, an adaptive Ada_loss_function loss function is used to calculate the loss values loss_1_1, ..., loss_s_1 corresponding to the networks Net_1_1, ..., Net_s_1;
[0077] For example, the loss value loss_1_1 of network Net_1_1 is calculated as follows:
[0078]
[0079] Among them, C is the number of categories corresponding to the classifier, C = 2, where the classifier is used to determine whether the directionality of the weather data is rising or falling. Therefore, C is also the number of categories corresponding to the directionality, and the categories corresponding to the directionality are rising and falling; F(Y_Train_R_1) represents the function transformation of the rate of change of the weather data at the next moment corresponding to the first weather data sub-training set; Y_Train_U_1 is the direction of change of the weather data at the next moment corresponding to the first weather data sub-training set, (log_softmax(Pre_1_1)) i It is expressed as:
[0080]
[0081] Among them, Pre_1_1 is the weather data direction prediction value corresponding to the network Net_1_1, (Pre_1_1) i is the i-th number in Pre_1_1.
[0082] The loss values of other networks can be calculated in the same way, which will not be described in detail in the present invention.
[0083] S107: According to the loss values loss_1_1, ..., loss_s_1, the network parameters of each LSTM-BN weather prediction network are updated respectively using a learning algorithm in deep learning, such as the Adam algorithm, and at the same time, the weather data direction prediction value corresponding to each LSTM-BN weather prediction network after this update is obtained according to the first weather data direction sub-test set X_Test_1;
[0084] S108: Determine whether the accuracy of the weather data direction prediction value corresponding to each LSTM-BN weather prediction network after the update reaches a predetermined threshold. If not, proceed to step S109; if reached, end the training and obtain the LSTM-BN weather prediction network corresponding to the first weather data sub-training set X_Train_1;
[0085] S109: Repeat steps S106 to S108 until the accuracy of the network in classifying the training set reaches a predetermined threshold.
[0086] It should be noted that after the network training is completed, Net_1_1,…, Net_s_1 are used to independently predict the weather data test set X_Test_1 to obtain the classification results of the categories in which the test set samples are located, that is, the weather data directional prediction values Pre_1_1,…, Pre_s_1; then the data at the same time point in the obtained s groups of weather data directional prediction values Pre_1_1,…, Pre_s_1 are voted, and the category with the majority of votes is the final weather data directional prediction result of X_Test_1, that is, Pre_1.
[0087] It can be seen that according to steps S101 to S109, the LSTM-BN weather prediction network corresponding to the first weather data sub-training set X_Train_1 can be obtained; further, when obtaining the LSTM-BN weather prediction network corresponding to the remaining weather data sub-training sets, the present invention provides an inherited segmented training method, which can update the network parameters for the weather data test sets of different time periods without completely repeating the network training process, thereby effectively predicting the weather data in the long term; that is, when making long-term predictions of weather data, firstly, based on the starting time point, a weather data training set time interval of sufficient length is selected in the past to generate a weather data training set X_Train_1 containing multiple training samples, and after training with X_Train_1 to obtain the network Net_1_1, ..., Net_s_1, only a short time interval K1 is predicted to obtain the weather data directional prediction values Pre_1_1, ..., Pre_s_1, and then a voting operation is performed to obtain the final weather data directional prediction result Pre_fin_1 for the K1 interval; for example, the interval selected from the starting time point is 1-100, and the short time The time interval K1 is 101-120; then, the selected weather data training set time interval is moved forward, and when the information of the K1 interval is just included, the same method is used to divide the new weather data training set X_Train_2. For example, the time interval corresponding to the weather data training set X_Train_2 is 20-120; then, when training X_Train_2, first inherit the network parameters of the existing network Net_1_1, ..., Net_s_1, and based on this, add a loss function that is consistent with the existing Net_1_ 1,…, Net_s_1, and minimize the loss value. Finally, the parameters of the networks Net_1_2,…, Net_s_2 can be obtained. Then, a new short time interval K2, such as 121-140, is predicted and a voting operation is performed to obtain the weather data directional prediction value Pre_fin_2. Repeating the above operation can obtain the weather data directional prediction results for consecutive long time intervals [K1,…,Kp], thus realizing the long-term effective prediction of the direction of weather data changes and reducing the computational complexity of network parameter updates.
[0088] Specifically, a hereditary segmentation training method comprises the following steps:
[0089] S110: Using the second weather data sub-training set X_Train_2, the LSTM-BN weather prediction network is trained on the basis of inheriting the network parameters of Net_1_1, ..., Net_s_1, and s LSTM-BN weather prediction networks with the same network structure but different network parameters are obtained again, and they are recorded as Net_1_2, ..., Net_s_2 respectively;
[0090] S111: After adding a penalty term related to the network parameters of the networks Net_1_1, ..., Net_s_1 to the adaptive Ada_loss_function loss function, the loss values loss_1_2, ..., loss_s_2 corresponding to the networks Net_1_2, ..., Net_s_2 are calculated according to the labels of each sample in the second weather data sub-training set X_Train_2;
[0091] The calculation method of loss value loss_1_2 is:
[0092]
[0093] Among them, λ is a weight factor; θ z Represents the weight parameters of the network to be trained when training Net_1_2; Represents the network weight parameters of Net_1_1, It is a fixed value during the training of Net_1_2, and C represents the category.
[0094] Furthermore, when training X_Train_j, the general calculation method of each loss value is:
[0095]
[0096] Among them, j = 2,…,s, λ is the set weight factor, θ z Represents the weight parameters of network Net_1_j to be trained when training network Net_1_j, and Z is the number of all weights and bias parameters in the network (each layer in the network includes many weights and bias parameters); Represents the network weight parameters of network Net_1_j-1, during the training of network Net_1_j is a fixed value, C is the number of categories corresponding to the classifier, and C = 2, F(Y_Train_R_j) represents the function transformation of the rate of change of the weather data at the next moment corresponding to the jth weather data sub-training set; Y_Train_U_j is the direction of change of the weather data at the next moment corresponding to the first weather data sub-training set, (log_softmax(Pre_1_j)) i It is expressed as:
[0097]
[0098] Among them, Pre_1_j is the weather data direction prediction value corresponding to the network Net_1_j, (Pre_1_j) i is the i-th number in Pre_1_j.
[0099] S112: According to the loss values loss_1_2,…,loss_s_2, the network parameters of each LSTM-BN weather prediction network are updated respectively using the learning algorithm in deep learning, and at the same time, the weather data direction prediction value corresponding to each LSTM-BN weather prediction network after this update is obtained according to the second weather data sub-test set X_Test_2;
[0100] S113: Determine whether the accuracy of the weather data direction prediction value corresponding to each LSTM-BN weather forecast network after the update reaches a predetermined threshold. If not, proceed to step S114; if reached, end the training and obtain the network corresponding to the second weather data sub-training set X_Train_2;
[0101] S114: Repeat S111-S113 until the accuracy of the network in classifying the training set reaches a predetermined threshold;
[0102] S115: And so on, repeat steps S110 to S114 to obtain the network corresponding to the remaining weather data sub-training sets.
[0103] It should be noted that after the network training is completed, Net_1_2,…, Net_s_2 are used to independently predict the weather data test set X_Test_2 to obtain the classification results of the categories in which the test set samples are located, that is, the weather data directional prediction values Pre_1_2,,…, Pre_s_2; then, all the corresponding points in the obtained s groups of weather data directional prediction values Pre_1_2,,…, Pre_s_2 are voted, and the category with the majority of votes is the final weather data directional prediction result of X_Test_2, that is, Pre_2.
[0104] Furthermore, the above steps are repeated continuously to obtain the weather data direction prediction results of X_Test_3,…,X_Test_p, that is, Pre_3,…,Pre_p; then, Pre_1,…,Pre_p are spliced together to achieve long-term efficient and effective prediction of the direction of weather data change, such as Figure 4 , Figure 5 shown.
[0105] Of course, the present invention may have many other embodiments. Without departing from the spirit and essence of the present invention, those skilled in the art may certainly make various corresponding changes and modifications based on the present invention, but these corresponding changes and modifications should all fall within the scope of protection of the claims attached to the present invention.
Claims
1. An adaptive weather data directional prediction method, characterized in that: The following steps are involved: S1: Use s independently trained LSTM-BN weather prediction networks to predict the directionality of weather data respectively, and obtain s independent weather data direction prediction values, where the LSTM-BN weather prediction network includes an LSTM network, a BN layer, an activation layer, and a fully connected layer. The directionality includes rising and falling, and s is an odd number greater than or equal to 3; the weather data is any one of temperature, humidity, wind force, wind speed, air pressure, rainfall, snowfall, PM2.5 concentration, dew point temperature, visibility, and ultraviolet intensity; S2: Voting operation is performed on s independent weather data direction prediction values, and the weather data direction prediction value with the majority vote is the final prediction result of the weather data direction; The training method of the LSTM-BN weather prediction network used to predict the directionality of weather data is: S101: Calculate the original change rate data R corresponding to the original weather data X according to the following formula: Among them, X t represents the weather data for day t in X, X t-1 represents the weather data of day t-1; R t is an element in the original change rate data R, representing the change rate of the weather data on the tth day relative to the weather data on the t-1th day; S102: performing data segmentation on the original rate of change data R to obtain a weather data sub-training set and a weather data sub-testing set with temporal continuity; S103: labeling two labels for each weather data change rate training sample in the weather data sub-training set, wherein the two labels are respectively the change rate and change direction of the weather data at the next moment corresponding to each weather data change rate training sample; S104: Initializing network parameters of s LSTM-BN weather prediction networks respectively, wherein the network parameters include weight parameters and bias value parameters, and each LSTM-BN weather prediction network is respectively recorded as Net_1, ..., Net_s; S105: Use the weather data sub-training set X_Train_1 to independently train each LSTM-BN weather prediction network to obtain s LSTM-BN weather prediction networks with the same network structure but different network parameters, and record them as Net_1_1, ..., Net_s_1 respectively; S106: according to the labels of the weather data change rate training samples in the weather data sub-training set X_Train_1, an adaptive Ada_loss_function loss function is used to calculate the loss values loss_1_1,…,loss_s_1 corresponding to the networks Net_1_1,…,Net_s_1; S107: According to the loss values loss_1_1,…,loss_s_1, the network parameters of each LSTM-BN weather prediction network are updated respectively using the learning algorithm in deep learning, and at the same time, the weather data direction prediction value corresponding to each LSTM-BN weather prediction network after this update is obtained according to the weather data sub-test set X_Test_1; S108: Determine whether the accuracy of the weather data direction prediction value corresponding to each LSTM-BN weather prediction network after the update reaches a predetermined threshold. If not, proceed to step S109; if reached, end the training and obtain the LSTM-BN weather prediction network corresponding to the weather data sub-training set X_Train_1; S109: Repeat steps S106 to S108 until the accuracy of the network in classifying the training set reaches a predetermined threshold; The original rate of change data R is segmented to obtain more than two weather data sub-training sets and weather data sub-testing sets with temporal continuity. Except for the first weather data sub-training set X_Train_1 and the first weather data sub-testing set X_Test_1, the remaining weather data sub-training sets and weather data sub-testing sets continue to be trained, wherein the training specifically includes the following steps: S110: Using the second weather data sub-training set X_Train_2, the LSTM-BN weather prediction network is trained on the basis of inheriting the network parameters of Net_1_1, ..., Net_s_1, and s LSTM-BN weather prediction networks with the same network structure but different network parameters are obtained again, and they are recorded as Net_1_2, ..., Net_s_2 respectively; S111: After adding a penalty term related to the network parameters of the networks Net_1_1, ..., Net_s_1 in the adaptive Ada_loss_function loss function, the loss values loss_1_2, ..., loss_s_2 corresponding to the networks Net_1_2, ..., Net_s_2 are calculated according to the labels of the training samples of the weather data change rates in the second weather data sub-training set X_Train_2; S112: According to the loss values loss_1_2,…,loss_s_2, the network parameters of each LSTM-BN weather prediction network are updated respectively using the learning algorithm in deep learning, and at the same time, the weather data direction prediction value corresponding to each LSTM-BN weather prediction network after this update is obtained according to the second weather data sub-test set X_Test_2; S113: Determine whether the accuracy of the weather data direction prediction value corresponding to each LSTM-BN weather forecast network after the update reaches a predetermined threshold. If not, proceed to step S114; if reached, end the training and obtain the network corresponding to the second weather data sub-training set X_Train_2; S114: Repeat S111-S113 until the accuracy of the network in classifying the training set reaches a predetermined threshold; S115: And so on, repeat steps S110 to S114 to obtain the network corresponding to the remaining weather data sub-training sets.
2. The adaptive weather data directional prediction method according to claim 1, characterized in that: The calculation formula of the loss value of Net_1_1 is as follows: Wherein, C is the number of categories corresponding to the directionality of the weather data, C=2; F(Y_Train_R_1) represents the preset function transformation of the change rate of the weather data at the next moment corresponding to the first weather data sub-training set; Y_Train_U_1 is the change direction of the weather data at the next moment corresponding to the first weather data sub-training set, (log_softmax(Pre_1_1)) i It is expressed as: Among them, Pre_1_1 is the weather data direction prediction value corresponding to the network Net_1_1, (Pre_1_1) i is the i-th number in Pre_1_1.
3. The adaptive weather data directional prediction method according to claim 1, characterized in that: When training X_Train_j, the loss value of the first LSTM-BN weather prediction network is calculated as follows: Where, j = 2,…,p, p is the number of weather data sub-training sets, λ is the set weight factor, θ z Represents the weight parameters of network Net_1_j to be trained when training network Net_1_j, and Z is the number of all weights and bias parameters in the network; Represents the network weight parameters of network Net_1_j-1, during the training of network Net_1_j is a fixed value, C is the number of categories corresponding to the directionality of weather data, and C=2, F(Y_Train_R_j) represents the function transformation of the rate of change of weather data at the next moment corresponding to the jth weather data sub-training set; Y_Train_U_j is the direction of change of weather data at the next moment corresponding to the first weather data sub-training set, (log_softmax(Pre_1_j)) i It is expressed as: Among them, Pre_1_j is the weather data direction prediction value corresponding to the network Net_1_j, (Pre_1_j) i is the i-th number in Pre_1_j.
4. The adaptive weather data directional prediction method according to claim 1, characterized in that: The original rate of change data R in step S101 is subjected to data preprocessing to obtain the rate of change data after preprocessing. Then, the rate of change data Perform data segmentation and then perform subsequent steps.
Citation Information
Patent Citations
Non-invasive load identification algorithm based on hybrid neural network and ensemble learning
CN107122790A
Chinese-medicinal-material identification method based on deep neural networks
CN107958257A
Wireless network flow rate prediction method based on LSTM network
CN108900346A
Vehicle flow predicting method based on integrated LSTM neural network
CN109859469A
Prediction device, electrical appliance, management system, prediction method, and control program
JP2019212131A
