Bi-LSTM-based short-term power load prediction method
The Bi-LSTM network optimizes hyperparameters and employs a bidirectional structure to enhance feature capture, addressing low accuracy in existing power load forecasting methods and achieving high-precision short-term predictions.
Patent Information
- Application Number
- CN202411106680.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-13
- Publication Date
- 2024-12-03
AI Technical Summary
Existing power load forecasting methods, particularly those based on BP neural networks, struggle with low accuracy due to increased complexity, variability, and uncertainty in load data from new energy sources and power-consuming equipment, failing to capture long-term trends and short-term fluctuations effectively.
A short-term power load forecasting method using a Bi-LSTM network that optimizes hyperparameters with a load-meteorological characteristic data set and evaluation indices, transforming data into a three-dimensional format, and employing a bidirectional LSTM structure to enhance feature capture and prediction accuracy.
The method significantly improves the accuracy of short-term power load forecasting by effectively exploiting time series characteristics, achieving high-precision predictions through optimized Bi-LSTM models.
Smart Images

Figure CN119070276A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of power system load forecasting, and in particular to a short-term power system load forecasting method based on Bi-LSTM. Background Art
[0002] Power load forecasting is an important part of power system planning. Accurate power load forecasting is of great significance to the operation of the power system. Existing technical solutions mostly adopt prediction methods based on BP neural network. BP neural network minimizes the loss function by continuously adjusting weights and biases to achieve model training and optimization. However, due to the addition of new energy sources and the surge in power-consuming equipment, the complexity, variability, randomness and uncertainty of influencing factors of load data are indirectly increased. Therefore, BP neural network often finds it difficult to consider the long-term laws of the internal development of the load, which affects the accuracy of load forecasting. Summary of the invention
[0003] In order to solve the problem of low prediction accuracy of the power load forecasting method based on BP neural network in the existing technology, a short-term power load forecasting method based on Bi-LSTM is proposed. The power load forecasting is realized through the Bi-LSTM network with high prediction accuracy.
[0004] A short-term power load forecasting method based on Bi-LSTM, comprising:
[0005] Step 1: construct a load characteristic data set and a meteorological characteristic data set; obtain a load-meteorological characteristic training set based on the load characteristic data set and the meteorological characteristic data set, wherein the input of the load-meteorological characteristic training set is historical load data and historical meteorological data, and the output is actual load data corresponding to the predicted date;
[0006] Step 2: Set the initial hyperparameters of the Bi-LSTM model and build the Bi-LSTM model; optimize the hyperparameters of the Bi-LSTM model according to the load-meteorological characteristic training set and evaluation indicators to obtain the optimized Bi-LSTM model;
[0007] Step 3: Predict load data based on the optimized Bi-LSTM model.
[0008] Beneficial Effects
[0009] The present application discloses a short-term power load forecasting method based on Bi-LSTM, which optimizes the hyperparameters of the Bi-LSTM model through a load-meteorological characteristic data set and an evaluation index, obtains an optimized Bi-LSTM model according to the optimized hyperparameters of the Bi-LSTM model, and predicts the load data according to the optimized Bi-LSTM model; the present invention can fully exploit the time series characteristics in the power load data, so that the accuracy of short-term power load forecasting can be effectively improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] Figure 1 A flowchart of a short-term power load forecasting method based on Bi-LSTM according to a specific implementation mode of the present invention;
[0011] Figure 2 It is an analysis diagram of determining the time window length of load data based on the discrete Fourier transform method in a specific implementation manner of the present invention;
[0012] Figure 3 This is a graph showing the relationship between meteorological characteristics and load data determined based on the Pearson correlation coefficient analysis method in a specific implementation manner of the present invention. DETAILED DESCRIPTION
[0013] Specific implementation method 1. Figures 1 to 3 , describing this embodiment, a short-term power load forecasting method based on Bi-LSTM, comprising:
[0014] Step 1: construct a load characteristic data set and a meteorological characteristic data set; obtain a load-meteorological characteristic training set based on the load characteristic data set and the meteorological characteristic data set, wherein the input of the load-meteorological characteristic training set is historical load data and historical meteorological data, and the output is actual load data corresponding to the predicted date;
[0015] Step 2: Set the initial hyperparameters of the Bi-LSTM model and build the Bi-LSTM model; optimize the hyperparameters of the Bi-LSTM model according to the load-meteorological characteristic training set and evaluation indicators to obtain the optimized Bi-LSTM model;
[0016] Step 3: Predict load data based on the optimized Bi-LSTM model.
[0017] Specifically, the time span of the load forecast target area is determined, the load data and meteorological data of the area are collected, and the load characteristic data set and the meteorological characteristic data set are constructed. The obtained data set is processed, and the Bi-LSTM model parameters are optimized through the processed data set to obtain the optimized Bi-LSTM model for power load data forecasting, so as to achieve high-precision forecasting of short-term power load; the historical meteorological data include: soil temperature, apparent temperature, temperature, soil moisture, dew point, water vapor pressure difference, evapotranspiration, scattered radiation, land radiation, high cloud cover, shortwave radiation, global oblique radiation, rainfall, precipitation, cloud cover, wind speed, direct radiation, snowfall, cloud cover, direct normal radiation, wind speed, relative humidity, wind direction, surface pressure, air pressure, and snow depth.
[0018] Furthermore, according to the obtained load characteristic data set and meteorological characteristic data set, a method for obtaining a load-meteorological characteristic data set is as follows:
[0019] The load characteristic data set is tested for missing values and outliers. If there are missing values or outliers, they are supplemented by the level average interpolation method. The calculation formula is: y d,t is the power load value at time t on day d;
[0020] The meteorological characteristic dataset that is strongly correlated with the load is obtained by screening the meteorological characteristic dataset and the completed load characteristic dataset;
[0021] A load-meteorological characteristic data set is obtained according to the load characteristic data set and the screened meteorological characteristic data set that is strongly correlated with the load, and the load-meteorological characteristic data set is divided to obtain a load-meteorological characteristic training set.
[0022] Specifically, the load characteristic data set and the meteorological characteristic data set are correspondingly merged according to the principle of the same time point to form a load-meteorological characteristic data set; the load-meteorological characteristic data set is divided into a load-meteorological characteristic training set, a load-meteorological characteristic verification set and a load-meteorological characteristic test set. Since power load forecasting belongs to time series forecasting, which predicts future information based on historical information, the data set needs to meet the following requirements: the sample time of the data set is earlier than the sample time of the verification set, and the sample time of the verification set is earlier than the sample time of the test set.
[0023] Furthermore, a method for screening a meteorological characteristic data set that is strongly correlated with the load based on the meteorological characteristic data set and the completed load characteristic data set is as follows: a Pearson correlation coefficient is calculated based on the meteorological characteristic data set and the load characteristic data set, and the meteorological characteristic data set is screened based on the Pearson correlation coefficient to obtain a meteorological characteristic data set that is strongly correlated with the load.
[0024] The Pearson correlation coefficient calculation method is:
[0025] Among them, x is the load data in the load training feature data set, y is the meteorological data in the meteorological training feature data set, σ x is the standard deviation of x; σ y is the standard deviation of y; COV(x,y) represents the covariance of x and y, E|(x-μ x )(y-μ y )| is x and y and their respective means μ x and μ y The expected value of the product of the differences.
[0026] Furthermore, step one also includes dimension processing and normalization processing of the load-meteorological feature training set;
[0027] According to the time window length and the Bi-LSTM model, there are certain requirements for the format and characteristics of the input data. Therefore, it is necessary to change the data dimension of the load-meteorological characteristic training set from two-dimensional data to three-dimensional data.
[0028] The time window length is obtained according to the load training feature training set, and its calculation formula is:
[0029]
[0030] Where N = 365, freq represents the frequency window center point sequence starting from 0 with a sampling interval of period, T = {1, 2, 3, ..., N}, and i is the imaginary unit i 2 =-1g(freq) is the frequency domain component signal, f(T) is the power load time series;
[0031] Since the Bi-LSTM model is sensitive to the scale of input data, if the range of the characteristic values of the data varies greatly, it may cause numerical stability problems during the training process. Usually, before training the Bi-LSTM model, the data set needs to be normalized so that each indicator is a dimensionless uniform value. The present invention uses the maximum-minimum normalization method to process the three-dimensional data load-meteorological feature training set to obtain a normalized load-meteorological feature training set;
[0032] The calculation formula is:
[0033] Among them, m is the value of the load-meteorological characteristic training set after normalization, and M is the value of the load-meteorological characteristic training set before normalization; M min is the minimum value of the load-meteorological characteristic training set before normalization, M max It is the maximum value of the load-meteorological characteristic training set before normalization.
[0034] Furthermore, the Bi-LSTM model hyperparameters include: the number of hidden layer neurons, learning rate, batch size and number of training iterations.
[0035] Specifically, the number of hidden layer neurons in Bi-LSTM, i.e., the number of hidden units, is a key hyperparameter that determines the capacity and complexity of the network. A large number of neurons can enhance the learning and memory capabilities of the network, enabling it to capture more complex features;
[0036] The number of Bi-LSTM layers determines the depth and learning ability of the network, and affects the model's ability to capture complex features. Increasing the number of layers can improve the model's expression and memory capabilities.
[0037] The learning rate is a key hyperparameter in Bi-LSTM model training. It controls the step size for updating model parameters based on the gradient of the loss function, and directly affects the convergence speed and stability of the model. Choosing an appropriate learning rate can speed up convergence and improve the generalization ability of the model.
[0038] The batch size of the Bi-LSTM model specifies the number of samples used in each model training iteration. It affects memory usage, computational efficiency, the stability of gradient estimation, and the generalization ability of the model. An appropriate batch size can speed up training and improve model performance.
[0039] The number of training iterations of the Bi-LSTM model, that is, the number of times the entire data set is traversed during the training process, determines the depth of the model's learning features and the degree of parameter optimization. An appropriate number of iterations helps the model fully learn and converge.
[0040] In step 2, the initial hyperparameters of the Bi-LSTM model are set to construct the Bi-LSTM model; and the hyperparameters of the Bi-LSTM model are optimized according to the load-meteorological characteristic training set and the evaluation index to obtain the optimized Bi-LSTM model; the method is:
[0041] The number of Bi-LSTM model layers, the value range of the number of neurons in the hidden layer of the Bi-LSTM model, and the number of neurons in the hidden layer are set to obtain the first Bi-LSTM model; the power load forecast value is obtained through the first Bi-LSTM model according to the processed load-meteorological feature training set, and the evaluation index is calculated according to the obtained power load forecast value. If the evaluation index reaches the target value, the number of neurons in the hidden layer of the first Bi-LSTM model is selected as the optimal number of neurons in the hidden layer; if the evaluation index does not reach the target value, the number of network nodes is iterated by enumeration until the evaluation index reaches the target value;
[0042] The value range of the learning rate, batch size and training iteration number of the Bi-LSTM model is set, and the learning rate, batch size and training iteration number are set to obtain the second Bi-LSTM model; the power load prediction value is obtained through the second Bi-LSTM model according to the processed load-meteorological feature training set, and the evaluation index is calculated according to the obtained power load prediction value. If the evaluation index reaches the target value, the learning rate, batch size and training iteration number of the second Bi-LSTM model are selected as the optimal learning rate, batch size and training iteration number; if the evaluation index does not reach the target value, the learning rate, batch size and training iteration number are iterated by enumeration until the evaluation index reaches the target value;
[0043] The optimized Bi-LSTM model is obtained based on the optimal number of hidden layer neurons, optimal learning rate, batch size and number of training iterations.
[0044] Specifically, the present application uses a two-layer Bi-LSTM model, which includes a forward LSTM layer and a backward LSTM layer. The forward LSTM layer processes the sequence from the first time step, and updates its hidden state and unit state time by time step. At each time step, the LSTM layer updates the state through its internal gating mechanism (input gate, forget gate, output gate) and generates output; the backward LSTM layer reversely processes from the last time step of the sequence, and also updates its hidden state and unit state time by time step. The update process of the backward LSTM layer is similar to that of the forward LSTM, but it processes the reverse order of the sequence; at each time step, the outputs of the forward and backward LSTM layers are merged, usually by concatenating the output vectors in two directions; after passing through the LSTM layer, the merged state can be sent to one or more fully connected layers for the final prediction task, and the parameters of the output layer will also be updated during the training process;
[0045] The LSTM layer updates the state through its internal gating mechanism (input gate, forget gate, output gate) and generates the output expression as follows:
[0046]
[0047] Among them, C t is the forget gate, σ is the sigmoid function, W f , W i , W c , W o is the weight coefficient, b f is the bias parameter, [h t-1 ,x t ] is the output h at the previous moment t-1 and the current time x t A new vector connected; i tis the input gate, C% t is the current input unit state, b i , b c , b o is the bias parameter, tanh is the hyperbolic function, C t is the unit state at the current moment, C t-1 is the unit state at the previous moment, t is the output gate, h t is the output.
[0048] Compared with the original LSTM network, the Bi-LSTM network adds a hidden layer that can transfer information backward, transforming the unidirectional LSTM layer into a bidirectional LSTM layer, and more effectively learns the load-meteorological factor characteristics in a bidirectional manner, which is conducive to improving the accuracy of short-term power load forecasting. The formula of the Bi-LSTM output gate is:
[0049] output:h (f&b)t =g(W f h ft +W b h bt + b);
[0050] Among them, h ft and h bt Respectively represent the load forecasting results of the forward and backward LSTM layers at time t; W f and W b are the weight coefficients of the forward and backward LSTM layers, b is the output bias matrix, and h (f&b)t The final output of Bi-LSTM is weighted and merged through the activation function g.
[0051] Furthermore, the evaluation indicators include mean absolute error, mean absolute percentage error and root mean square error;
[0052] The formula for calculating the mean absolute error is:
[0053] The mean absolute percentage error is calculated as:
[0054] The formula for calculating the root mean square error is:
[0055] Among them, y i is the actual value of the ith load, y ihat is the ith power load forecast value, and n is the total number of power load samples.
[0056] Furthermore, the evaluation index reaching the target value is that the mean absolute error, mean absolute percentage error and root mean square error reach their respective target values; the evaluation index not reaching the target value is that the mean absolute error, mean absolute percentage error or root mean square error reaches their respective error values.
[0057] The optimized Bi-LSTM model is used to predict the load-meteorological feature test set and obtain the load prediction results. The prediction results need to be denormalized. In order to test the accuracy and generalization ability of the optimized Bi-LSTM model in predicting unknown load data, the model is evaluated by the evaluation index. The better the evaluation result, the better the generalization ability of the Bi-LSTM model.
[0058] Specifically, in actual operation, the number of layers of the optimized Bi-LSTM model is 2, the number of neurons in the hidden layer is 371 in the first layer and 484 in the second layer, the learning rate is 0.00196, the batch size is 121, and the number of training iterations is 1008;
[0059] The total electricity consumption data of a city from January 2022 to December 2022 is used as input, the time window length is 7 days, and the meteorological characteristics are: soil temperature (range: 0-7cm, unit: Celsius), soil temperature (range: 7-28cm, unit: Celsius), soil temperature (range: 28-100cm, unit: Celsius), soil moisture (range: 100-255cm, unit: m 3 / m 3 ), snow depth (unit: m), the optimized Bi-LSTM model is used to predict the electricity consumption data from June to October 2023, and the predicted results are compared with the actual load. The comparison results are shown in Table 1;
[0060] From the analysis of Table 1, it can be seen that the average prediction accuracy (taking 1-MAPE as an example) of the scheme proposed in the present invention is 92.51%. This result shows that the method has a relatively accurate grasp of the total amount from June to October 2023. The method proposed in the present invention solves the problem that the single-layer neural network model is difficult to capture the long-term development trend and short-term fluctuation characteristics of the data at the same time, thereby obtaining a more accurate prediction result.
[0061] Table 1: Forecast results of total electricity consumption in a city from June to October 2023
[0062]
[0063] Specific implementation method 2: A computer-readable storage medium stores a computer program. When the computer program is read and executed by a processor, a short-term power load forecasting method based on Bi-LSTM as described in specific implementation method 1 is implemented.
[0064] Specific implementation method three: a short-term power load forecasting device based on Bi-LSTM, comprising a storage device, a processor, and a computer program stored in the storage device and executable on the processor, characterized in that the processor executes the computer program to implement the steps of the short-term power load forecasting method based on Bi-LSTM as described in specific implementation method one.
[0065] Specific implementation method 4. A computer program product includes a computer program, characterized in that when the computer program is executed by a processor, the steps of the short-term power load forecasting method based on Bi-LSTM as described in specific implementation method 1 are implemented.
Claims
1. A short-term power load forecasting method based on Bi-LSTM, characterized in that: include: Step 1: Construct load characteristic data set and meteorological characteristic data set; According to the load characteristic data set and the meteorological characteristic data set, a load-meteorological characteristic training set is obtained, wherein the input of the load-meteorological characteristic training set is historical load data and historical meteorological data, and the output is actual load data corresponding to the forecast date; Step 2: Set the initial hyperparameters of the Bi-LSTM model and build the Bi-LSTM model; optimize the hyperparameters of the Bi-LSTM model according to the load-meteorological characteristic training set and evaluation indicators to obtain the optimized Bi-LSTM model; Step 3: Predict load data based on the optimized Bi-LSTM model.
2. A short-term power load forecasting method based on Bi-LSTM according to claim 1, characterized in that: According to the obtained load characteristic data set and meteorological characteristic data set, the method of obtaining the load-meteorological characteristic training set is as follows: The load characteristic data set is tested for missing values and outliers. If there are missing values or outliers, they are supplemented by the level average interpolation method. The calculation formula is: y d,t is the power load value at time t on day d, y d,t-1 is the power load value at time t-1 on day d, y d,t+1 is the power load value at time t+1 on the dth day; The meteorological characteristic dataset that is strongly correlated with the load is obtained by screening the meteorological characteristic dataset and the completed load characteristic dataset; A load-meteorological characteristic data set is obtained according to the load characteristic data set and the screened meteorological characteristic data set that is strongly correlated with the load, and the load-meteorological characteristic data set is divided to obtain a load-meteorological characteristic training set.
3. A short-term power load forecasting method based on Bi-LSTM according to claim 2, characterized in that: The method for screening the meteorological characteristic data set that is strongly correlated with the load according to the meteorological characteristic data set and the completed load characteristic data set is: calculating the Pearson correlation coefficient according to the meteorological characteristic data set and the load characteristic data set, and screening the meteorological characteristic data set according to the Pearson correlation coefficient to obtain the meteorological characteristic data set that is strongly correlated with the load.
4. A short-term power load forecasting method based on Bi-LSTM according to claim 3, characterized in that: Step one also includes: performing dimension processing and normalization processing on the load-meteorological feature training set; The load-meteorological characteristic training set is transformed from two-dimensional data to three-dimensional data according to the time window length. The time window length is obtained according to the load training characteristic data set, and its calculation formula is: Where N = 365, freq represents the frequency window center point sequence starting from 0 with a sampling interval of period, T = {1, 2, 3, ..., N}, and i is the imaginary unit i 2 =-1, g(freq) is the frequency domain component signal, f(T) is the power load time series; The maximum-minimum normalization method is used to process the three-dimensional load-meteorological characteristic training set to obtain the processed load-meteorological characteristic training set.
5. A short-term power load forecasting method based on Bi-LSTM according to claim 4, characterized in that: The hyperparameters of the Bi-LSTM model include: the number of neurons in the hidden layer, the learning rate, the batch size, and the number of training iterations.
6. A short-term power load forecasting method based on Bi-LSTM according to claim 5, characterized in that: In step 2, the initial hyperparameters of the Bi-LSTM model are set to build the Bi-LSTM model; and the hyperparameters of the Bi-LSTM model are optimized according to the load-meteorological characteristic training set and the evaluation index. The method for obtaining the optimized Bi-LSTM model is as follows: The number of layers of the Bi-LSTM model is set to 2, and the value range of the number of neurons in the hidden layer of the Bi-LSTM model and the number of neurons in the hidden layer are set to obtain the first Bi-LSTM model; the power load forecast value is obtained through the first Bi-LSTM model according to the processed load-meteorological feature training set, and the evaluation index is calculated according to the obtained power load forecast value. If the evaluation index reaches the target value, the number of neurons in the hidden layer of the first Bi-LSTM model is selected as the optimal model layer number and the number of neurons in the hidden layer; If the evaluation index does not reach the target value, the number of hidden layer neurons is iterated by enumeration within the value range of the number of hidden layer neurons until the evaluation index reaches the target value; The learning rate, batch size and training iteration number of the Bi-LSTM model are set to have a value range, and the learning rate, batch size and training iteration number are set to obtain a second Bi-LSTM model; a power load forecast value is obtained through the second Bi-LSTM model according to the processed load-meteorological feature training set, and an evaluation index is calculated according to the obtained power load forecast value. If the evaluation index reaches the target value, the learning rate, batch size and training iteration number of the second Bi-LSTM model are selected as the optimal learning rate, batch size and training iteration number; if the evaluation index does not reach the target value, the learning rate, batch size and training iteration number are iterated by enumeration within the value range of the learning rate, batch size and training iteration number until the evaluation index reaches the target value; The optimized Bi-LSTM model is obtained based on the optimal number of hidden layer neurons, optimal learning rate, batch size and number of training iterations.
7. A short-term power load forecasting method based on Bi-LSTM according to claim 6, characterized in that: The evaluation indicators include mean absolute error, mean absolute percentage error and root mean square error; The formula for calculating the mean absolute error is: The mean absolute percentage error is calculated as: The formula for calculating the root mean square error is: Among them, y i is the actual value of the i-th load, y ihat is the i-th load forecast value, and n is the total number of load samples.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is read and executed by a processor, the short-term power load forecasting method based on Bi-LSTM as described in any one of claims 1 to 7 is implemented.
9. A short-term power load forecasting device based on Bi-LSTM, comprising a storage device, a processor, and a computer program stored in the storage device and executable on the processor, characterized in that: The processor executes the computer program to implement the steps of the short-term power load forecasting method based on Bi-LSTM according to any one of claims 1 to 7.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the short-term power load forecasting method based on Bi-LSTM as described in any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Small hydropower station full-time-domain power generation prediction method and system based on heuristic deep learning
CN119990400A
