Short-term power load forecasting method based on attention mechanism and LSTM

By combining the attention mechanism and LSTM, the maximum mutual information coefficient algorithm is used to establish a neural network model, which solves the problems of difficulty in feature extraction and low accuracy in existing short-term power load forecasting, and achieves higher prediction accuracy and stability.

CN114444660BActive Publication Date: 2024-09-06NANJING ELECTRIC POWER DESIGN & RESEARCH INSTITUTE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210077514.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-24
Publication Date
2024-09-06
Estimated Expiration
2042-01-24

AI Technical Summary

Technical Problem

Existing short-term power load forecasting methods have deficiencies in feature extraction and accuracy, are difficult to effectively reflect nonlinear influencing factors, and have insufficient preprocessing, resulting in problems such as failure to converge and long prediction times in the forecasting process.

Method used

A short-term power load forecasting method based on attention mechanism and LSTM is used to analyze the correlation of historical and meteorological data through the maximum mutual information coefficient algorithm, establish a neural network forecasting model, and perform load forecasting in the online stage.

Benefits of technology

The prediction accuracy and stability are improved, and the root mean square error RMSE is reduced. Compared with the linear fitting and LSTM methods, it is increased by 20.49MW and 5.46MW respectively.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114444660B
    Figure CN114444660B
Patent Text Reader

Abstract

A short-term power load forecasting method based on attention mechanism and LSTM, in the offline stage, based on the maximum mutual information coefficient algorithm, analyzes the correlation between historical load data, meteorological data and load data to be predicted, obtains test set data, and then establishes a load forecasting model based on attention mechanism and LSTM, and uses the test set data to train the load forecasting model to adjust network parameters; in the online stage, the trained load forecasting model is used to predict the power load in the forecast period. The maximum mutual information coefficient is calculated for the power load, and the maximum mutual information coefficient algorithm and attention mechanism are combined to establish a neural network prediction model, which has the advantages of high prediction accuracy and stable prediction effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a technology in the field of power grid intelligent control, specifically a short-term power load forecasting method based on attention mechanism and LSTM. Background Art

[0002] Power load forecasting is an important guarantee for the safe operation and accurate planning of power systems. Short-term power load forecasting can provide a basis for power grid companies to formulate daily production and maintenance plans, and help effectively dispatch and allocate power resources. However, short-term power load forecasting will be affected by external factors such as weather and holidays, and has strong randomness and volatility. With the improvement of industry and residential electricity consumption levels, the power consumption characteristics on the demand side of urban power grids show a diversified development trend. Traditional forecasting methods can no longer meet the operation needs of power grids. These methods generally use linear fitting as the core and use time series method or linear regression method. It is difficult to reflect the nonlinear effects of various influencing factors on the load, and it is also easy to fall into overfitting. In order to overcome this problem, load forecasting based on artificial intelligence technology is the inevitable direction of future power systems.

[0003] The existing short-term power load forecasting technology does not perform perfect preprocessing of raw data and is unable to filter multiple data types in the raw data, resulting in the subsequent forecasting process failing to converge and a long forecasting time. Summary of the invention

[0004] In view of the difficulties in feature extraction in existing power load forecasting and the low accuracy of traditional load forecasting methods, the present invention proposes a short-term power load forecasting method based on attention mechanism and LSTM, calculates the maximum mutual information coefficient for power load, and combines the maximum mutual information coefficient algorithm with the attention mechanism to establish a neural network prediction model, which has the advantages of high prediction accuracy and stable prediction effect.

[0005] The present invention is achieved through the following technical solutions:

[0006] The present invention relates to a short-term electric load forecasting method based on an attention mechanism and LSTM. In an offline stage, the correlation between historical load data, meteorological data and load data to be predicted is analyzed based on a maximum mutual information coefficient algorithm to obtain test set data. Then, a load forecasting model is established based on the attention mechanism and LSTM, and the load forecasting model is trained using the test set data to adjust network parameters. In an online stage, the electric load in a prediction period to be tested is predicted using the trained load forecasting model.

[0007] The maximum mutual information coefficient algorithm is: a maximum information-based non-parametric exploration algorithm used to measure the degree of association between two variables X and Y, that is, the strength of linear or nonlinearity, where mutual information Where: p(d x ,d y ) is the joint probability density distribution function, which is approximately replaced in this algorithm by the following method: Where: a, b are d X ,d Y The number of discretizations in the direction.

[0008] The test set data is obtained in the following way:

[0009] Step 1: Normalize meteorological data and load data to a unified data range; define weekly data and time data as a unified data interval.

[0010] Step 2: Use the maximum mutual information coefficient algorithm to calculate the correlation between the characteristic data and the power load data, perform mutual information calculation on the data sample set and the load data to be predicted, and obtain the correlation between the data.

[0011] Step 3: Select characteristic data for input into the load forecasting model based on the calculated data correlation.

[0012] The load forecasting model includes: an original data processing unit, a neural network modeling and training unit, and an actual load forecasting unit, wherein: the original data processing unit performs data correction and normalization processing according to the original input information, obtains the adjusted input data and divides it into a training set and a test set, the neural network unit establishes a corresponding neural network according to the format of the input data, trains the neural network based on the training set, the actual load forecasting unit inputs the data of the test set, performs load forecasting work in the neural network, denormalizes the output result of the neural network, and obtains the final output load forecasting result.

[0013] In the online stage, the original data of a given normalized time period is input into the load forecasting model, and the result output by the load forecasting model is denormalized to obtain the final forecasting result. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] Figure 1 It is a schematic diagram of the process of the present invention;

[0015] Figure 2 This is a schematic diagram of the LSTM structure of the present invention;

[0016] Figure 3 Schematic diagram of the attention mechanism structure of the present invention;

[0017] Figure 4 This is a schematic diagram of the power load prediction model based on the attention mechanism and LSTM of the present invention;

[0018] Figure 5 Schematic diagram of the original data of the test set of the embodiment (a) and the experimental results (b). DETAILED DESCRIPTION

[0019] like Figure 1 As shown, this embodiment relates to a short-term power load forecasting method based on attention mechanism and LSTM, comprising the following steps:

[0020] Step 1: Process the data based on the maximum mutual information coefficient algorithm, calculate the correlation between the data, and select the highly correlated data;

[0021] Step 1.1: Processing power load data and meteorological data: Dimensionless through normalization, including:

[0022] Step 1.1.1: Normalize meteorological data and load data to a unified data range [1,1] to achieve dimensionless, specifically: Among them: d is the data to be processed, d max is the maximum value of the data, d min is the minimum value of the data.

[0023] Step 1.1.2: Define the weekly data and time data as a unified data interval. In the weekly data sequence, weekends are defined as 0 and weekdays are defined as 1 to distinguish the energy characteristics during weekends. The time data maps 1:00-24:00 to the interval of [0.25,6] to improve the sensitivity of time information.

[0024] Step 1.2: Calculate the mutual information between the characteristic data sample set and the load data to be predicted to obtain the correlation between the data, specifically: Where: d X , d Y are the characteristic data sample set and the load data to be predicted, respectively, p(d x ) and p(d x ) is the probability density distribution function, p(d x ,d y ) is the joint probability density distribution function;

[0025] Step 1.3: Based on the calculated data correlation, select the characteristic data for input into the load forecasting model according to the value of the maximum mutual information coefficient from high to low. Select the loads one, two, three, and seven days before the forecast day as the input information for load forecasting. Select the real-time forecast weather on the forecast day as the input information for load forecasting. Select the day of the week and time data on the forecast day as the input information for load forecasting.

[0026] Step 2: Establish a short-term load prediction model based on the attention mechanism and LSTM and adjust the neural network parameters, including:

[0027] Step 2.1: Create Figure 2 The LSTM neural network shown includes:

[0028] 1) A forget gate that selectively forgets the data sent from the previous node, specifically: f t =σ(W f [h t-1 , x t ]+b f ), where: f t is the parameter passed to the next stage, σ is an activation function, W f is the weight coefficient, b f is the bias, h t-1 is the hidden layer state at the previous moment, x t To input information.

[0029] 2) Selectively memorize the input and determine which attributes need to be updated and the input gate of the updated content, specifically: i t =σ(W i [h t-1 , x t ]+b i ), where: i t is the parameter passed to the next stage, σ is an activation function, W i is the weight coefficient, b i is the bias, h t-1 is the hidden layer state at the previous moment, x t To input information.

[0030] 3) Determine the output gate of the next unit as the output of the current state, specifically: t =σ(W o [h t-1 , x t ]+b0), where: o t is the parameter passed to the next stage, σ is an activation function, W o is the weight coefficient, b0 is the bias, h t-1 is the hidden layer state at the previous moment, x t To input information.

[0031] The candidate state value of the current neuron of the LSTM neural network is: g t =tanh(W g [h t-1 , x t ]+b g ); the updated neuron state is: C t =f t Ct-1 +i t g t ; The hidden layer state value is: h t =o t tanhC t , where: W and b correspond to the weight coefficient matrix and bias term respectively, and tanh is the hyperbolic tangent activation function.

[0032] Step 2.2: Introduce the following on the basis of LSTM neural network: Figure 3 The attention mechanism shown includes:

[0033] Step 2.2.1: At time t, the hidden layer state of LSTM is [h t,1 ,h t,2 ,…,h t,i ,…h t,T ] T , calculate the attention weight S of each hidden layer state ki =vtanh(Wh k +Uh i +b), Among them: v, U, b are all unknown coefficients, α t,i is the obtained attention weight.

[0034] Step 2.2.1: Output new feature vector Among them: C is the feature vector passed downward.

[0035] Step 2.3: Optimize the parameters of the neural network based on the test set data.

[0036] In this embodiment, two layers of LSTM are selected as the experimental setting, using 256 neurons and 32 neurons respectively. In the first layer, a higher number of neurons is set to ensure that enough information is learned, and in the second layer, data is compressed and fewer neurons are set to reduce the interference of redundant information. Figure 4 As shown in Figure 2, the LSTM step size is set to 24.

[0037] Step 3: Determine the time period for which load forecasting is required and input the load forecasting results, including:

[0038] Step 3.1: Normalize the raw data of a given period and input it into the load forecasting model. Normalize meteorological data and load data to a unified data range [-1,1] to achieve dimensionlessness. Define weekly data and time data as a unified data interval. The weekly data sequence defines weekends as 0 and weekdays as 1. Map the time data from 1:00 to 24:00 to the interval [0.25,6].

[0039] Step 3.2: Normalize the original data of a given period, input it into the load forecasting model, and calculate the final output load forecast result d'=d×(d max -d min )+d min , where: d is the output result of the neural network.

[0040] After specific practical experiments, in a two-layer LSTM network, the neuron settings are 256 and 32 respectively, the iterations are 100 times, and the step size is 24. The input contains Figure 5 (a) shows the actual load data of a certain area in Shanghai for 60 days. The figure shows the last 7 days, of which the 7th day is the test result and is not input into the model. The experiment is carried out with the above parameters, and the prediction result for the 7th day can be obtained as follows: Figure 5 (b) as shown.

[0041] Compared with the prior art, the present invention can improve the accuracy of load forecasting. Taking the root mean square error RMSE as the standard, the accuracy is 21.04MW, which is 20.49MW higher than the Linear Regression linear fitting method and 5.46MW higher than the LSTM method.

[0042] The above-mentioned specific implementation can be partially adjusted in different ways by those skilled in the art without departing from the principle and purpose of the present invention. The protection scope of the present invention shall be based on the claims and shall not be limited by the above-mentioned specific implementation. Each implementation scheme within its scope shall be subject to the constraints of the present invention.

Claims

1. A short-term power load forecasting method based on attention mechanism and LSTM, characterized in that: In the offline phase, the correlation between historical load data, meteorological data, and the load data to be predicted is analyzed based on the maximum mutual information coefficient algorithm to obtain test data. Then, a load forecasting model is established based on the attention mechanism and LSTM. The load forecasting model is trained using the test data to adjust network parameters. In the online phase, the trained load forecasting model is used to predict the power load for the forecast period. The maximum mutual information coefficient algorithm is a non-parametric exploratory algorithm based on maximum information, which is used to measure the degree of association between two variables X and Y, that is, the strength of linear or nonlinearity, where mutual information Where: p(d x ,d y ) is the joint probability density distribution function, which is approximately replaced in this algorithm by the following method: Among them: a, b are d X ,d Y The number of discretizations in the direction; The short-term power load forecasting method specifically includes: Step 1: Process the data based on the maximum mutual information coefficient algorithm, calculate the correlation between the data, and select highly correlated data, including: Step 1.1: Process power load data and meteorological data: Make them dimensionless by normalizing them, including: Step 1.1.1: Normalize the meteorological data and load data to a unified data range of [1,1] to achieve dimensionlessness. Specifically: Among them: d is the data to be processed, d max is the maximum value of the data, d min is the minimum value of the data; Step 1.1.2: Define the weekly data and time data as a unified data interval. In the weekly data sequence, weekends are defined as 0 and weekdays as 1 to distinguish the energy characteristics during weekends. The time data is mapped from 1:00 to 24:00 to the interval [0.25, 6] to improve the sensitivity of time information. Step 1.2: Calculate the mutual information between the characteristic data sample set and the load data to be predicted to obtain the correlation between the data, specifically: Where: d X , d Y are the characteristic data sample set and the load data to be predicted, p(d x ) and p(d y ) is the probability density distribution function, p(d x ,d y ) is the joint probability density distribution function; Step 1.3: Based on the calculated data correlation, select the characteristic data for input into the load forecasting model according to the value of the maximum mutual information coefficient from high to low. Select the loads one, two, three, and seven days before the forecast day as the input information for load forecasting. Select the real-time forecast weather on the forecast day as the input information for load forecasting. Select the day of the week and time of the forecast day as the input information for load forecasting. Step 2: Build a short-term load prediction model based on the attention mechanism and LSTM and adjust the neural network parameters, including: Step 3: Determine the time period for load forecasting and input the load forecast results, including: The step 2 specifically includes: Step 2.1: Build an LSTM neural network, including: 1) A forget gate that selectively forgets the data sent from the previous node, specifically: f t =σ(W f [h t-1 ,x t ]+b f ), where: f t is the parameter passed to the next stage, σ is an activation function, W f is the weight coefficient, b f is the bias, h t-1 is the hidden layer state at the previous moment, x t To input information; 2) Selectively memorize the input and determine which attributes need to be updated and the input gate of the updated content, specifically: i t =σ(W i [h t-1 ,x t ]+b i ), where: i t is the parameter passed to the next stage, σ is an activation function, W i is the weight coefficient, b i is the bias, h t-1 is the hidden layer state at the previous moment, x t To input information; 3) Determine the output gate of the next unit as the output of the current state, specifically: t =σ(W o [h t-1 ,x t ]+b0), where: o t is the parameter passed to the next stage, σ is an activation function, W o is the weight coefficient, b0 is the bias, h t-1 is the hidden layer state at the previous moment, x t To input information; Step 2.2: Introduce the attention mechanism based on the LSTM neural network, specifically including: Step 2.2.1: At time t, the hidden layer state of LSTM is [h t,1 ,h t,2 ,…,h t,i ,…h t,T ] T , calculate the attention weight S of each hidden layer state ki =v tanh(Wh k +Uh i +b), Among them: v, U, b are all unknown coefficients, α t,i is the obtained attention weight; Step 2.2.1: Output new feature vector Where: C is the eigenvector passed downward; Step 2.3: Optimize the parameters of the neural network based on the test set data.

2. The short-term power load forecasting method based on attention mechanism and LSTM according to claim 1 is characterized in that: The test set data is obtained in the following way: Step 1: Normalize meteorological data and load data to a unified data range; define weekly data and time data as a unified data interval; Step 2: Using the maximum mutual information coefficient algorithm, calculate the correlation between the characteristic data and the power load data, perform mutual information calculation on the data sample set and the load data to be predicted, and obtain the correlation between the data; Step 3: Select characteristic data for input into the load forecasting model based on the calculated data correlation.

3. The short-term power load forecasting method based on attention mechanism and LSTM according to claim 1 is characterized in that: The load forecasting model includes: an original data processing unit, a neural network modeling and training unit, and an actual load forecasting unit, wherein: the original data processing unit performs data correction and normalization processing based on the original input information, obtains the adjusted input data and divides it into a training set and a test set, the neural network unit establishes a corresponding neural network according to the format of the input data, trains the neural network based on the training set, the actual load forecasting unit inputs the data of the test set, performs load forecasting work in the neural network, denormalizes the output result of the neural network, and obtains the final output load forecasting result.

4. The short-term power load forecasting method based on attention mechanism and LSTM according to claim 1 is characterized in that: In the online stage, the normalized raw data of a given time period is input into the load forecasting model, and the result output by the load forecasting model is denormalized to obtain the final forecast result.

5. The short-term power load forecasting method based on attention mechanism and LSTM according to claim 1 is characterized in that: The candidate state value of the current neuron of the LSTM neural network is: g t =tanh(W g [h t-1 ,x t ]+b g ); the updated neuron state is: C t =f t C t-1 +i t g t ;The hidden layer state value is: h t =o t tanh C t , where: W and b correspond to the weight coefficient matrix and bias term, respectively, corresponding to the sigmoid activation function and hyperbolic tangent activation function, respectively.

6. The short-term power load forecasting method based on attention mechanism and LSTM according to claim 1 is characterized in that: A two-layer LSTM is used, using 256 neurons and 32 neurons respectively. In the first layer, a higher number of neurons is set to ensure that sufficient information is learned. In the second layer, fewer neurons are set to compress the data and reduce the interference of redundant information. The LSTM step size is set to 24.

7. The short-term power load forecasting method based on attention mechanism and LSTM according to claim 1 is characterized in that: The step 3 specifically includes: Step 3.1: Normalize the raw data for a given period and input it into the load forecasting model. Normalize the meteorological data and load data to a unified data range of [-1, 1] to achieve dimensionlessness. Define the weekly data and time data as a unified data interval. In the weekly data series, weekends are defined as 0 and weekdays as 1. Map the time data from 1:00 to 24:00 to the interval of [0.25, 6]. Step 3.2: Normalize the original data of a given period, input it into the load forecasting model, and calculate the final output load forecast result d'=d×(d max -d min )+d min , where: d is the output of the neural network.