Short-term power load prediction method for LSTM optimization based on improved SFLA algorithm
The LSTM network is optimized through the improved SFLA algorithm to find the optimal initial threshold and weight parameters, which solves the accuracy of power load prediction and achieves higher prediction accuracy and stability.
Patent Information
- Application Number
- CN202510125081.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-27
- Publication Date
- 2025-05-27
AI Technical Summary
The existing technology is difficult to accurately predict power loads, especially in the case of the increase in the number of new energy vehicles, which leads to challenges in power supply in the power grid.
The improved SFLA algorithm is used to optimize the LSTM network, and the DNA-SFLA algorithm is used to find the optimal initial threshold and weight parameters to establish an LSTM model for power load prediction.
It improves the accuracy and stability of power load prediction, effectively solves the problems of gradient disappearance and explosion, and improves the prediction ability of the model.
Smart Images

Figure CN120049421A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical fields of power system planning and power load forecasting, and specifically to a short-term power load forecasting method based on optimizing LSTM with an improved SFLA algorithm. Background Art
[0002] With the proposal of the concepts of "carbon peak" and "carbon neutrality", the installed capacity of new energy is continuously increasing, and new energy power generation is an inevitable trend for future development. The load has strong dispersion, uncertainty, and randomness, making it difficult to accurately predict the load. Especially in the current context of "carbon peak" and "carbon neutrality", the number of new energy vehicles has increased sharply, and the number of charging piles has also increased accordingly. Each new energy vehicle can be regarded as a small distributed power source when driving, with uncertain charging power and charging time. When the number of new energy vehicles reaches a certain level, it poses a great challenge to the power grid power supply. In order to better understand the electricity demand in each region, reasonably arrange the installed capacity of new energy, and ensure the dispatching safety, planning rationality, and operation economy of the power system, doing a good job in load forecasting can provide important reference for it. Therefore, it is necessary to further improve the accuracy of load forecasting.
[0003] With the rapid progress of the concept of big data and many intelligent learning technologies, using artificial intelligence technology for short-term forecasting can more accurately simulate complex non-linear relationships, thereby enhancing the prediction accuracy. In traditional recurrent neural networks, as the sequence length increases, problems such as gradient disappearance or gradient explosion are likely to occur, resulting in the inability to effectively learn long-distance time series dependencies. Setting gradient thresholds and reasonably initializing weight values can avoid or solve the problems of gradient disappearance and gradient explosion. At the same time, the long short-term memory network (LSTM) can, to a certain extent, alleviate the problem of gradient disappearance through its special gating mechanism, enabling the model to better process power load data with longer time series and improving the prediction accuracy and stability.
[0004] The inventors of the present application found through research in the process of implementing the present invention that: in order to make the prediction results of the LSTM network model more accurate, it can start from two aspects: on the one hand, improve from the training data, and on the other hand, optimize the LSTM network. To solve the problems of gradient disappearance and explosion to ensure prediction accuracy, the present invention sets an initial gradient threshold and weight, and uses the shuffled frog leaping algorithm (SLFA) to find the optimal initial threshold and weight method steps to ensure the stability of the model and improve the prediction accuracy.
[0005] The SFAL algorithm is prone to falling into local optimum in the local search mechanism, which will reduce the convergence speed. To improve the convergence speed of SFLA and avoid falling into local optimum, the DNA genetic shuffled frog leaping algorithm is proposed. When the algorithm falls into local optimum, the mutation operator of the DNA genetic algorithm plays an important role. When most individuals in the population become similar, the mutation operator can guide the algorithm to jump out of local optimum. Summary of the Invention
[0006] In view of the problems existing in the background technology, the present invention provides a power load forecasting modeling method for optimizing LSTM based on an improved SFLA algorithm, and establishes an LSTM prediction model based on the DNA-SFLA algorithm, which can solve the inherent problems of long-time series prediction.
[0007] The present invention proposes a power load forecasting method for optimizing LSTM by DNA-SFLA, which includes the following steps:
[0008] Step 1: Collect historical load data, preprocess the collected historical load data and normalize it, and divide the preprocessed historical load data into a training set and a test set;
[0009] Step 2: Establish an LSTM load forecasting network model;
[0010] Step 3: Establish a DNA-SFLA optimization algorithm, and use the DNA-SFLA algorithm to optimize the LSTM load forecasting network model established in Step 2 to obtain the optimal initial values and threshold parameters;
[0011] Step 4: Substitute the output optimal initial weights and thresholds into the LSTM network for training to obtain the optimal LSTM load forecasting network model, and call the test set data for load forecasting.
[0012] Further, Step 2 specifically includes: setting the hyperparameters of the LSTM model, training the LSTM model using the training set data, and initializing the weights and thresholds of different LSTM models to obtain LSTM load forecasting network models with different weight parameters.
[0013] Further, Step 3 specifically includes:
[0014] Step 3.1: Determine the parameters of the DNA-SFLA algorithm: the total number of frogs N, the number of subpopulations m, the number of evolutions of each subpopulation G, and the number of frogs in each subgroup n; determine the parameters of the LSTM load forecasting network model based on the DNA-SFLA algorithm, select the fitness function with a smaller training mean square error E and a higher fitness, calculate the fitness values of frog individuals, and sort them in descending order. The frog population after descending order is divided into two parts, the first part is the high-quality population SuG, and the second part is the low-quality population InG;
[0015] Step 3.2: Execute the DNA - SFLA algorithm steps: First, perform a crossover operation on two frog individuals randomly selected from the high - quality population SuG until the number of newly generated frog individuals is greater than 0.5N. Then, perform a mutation operation. After the mutation operation, perform DNA decoding and tournament selection operations, and use N - 1 individuals as the next - generation individuals, and retain the optimal individual before executing the genetic algorithm.
[0016] Step 3.3: If the convergence condition is reached, output the optimal individual. If the termination condition is not satisfied, continue to execute Step 3.2 until the condition is met. The optimal individual is the optimal initial value and threshold parameter of this model.
[0017] Furthermore, the fitness function in Step 3.1 is:
[0018]
[0019] where y i is the predicted value of the load, is the actual value of the load, and f is the number of training samples;
[0020] The update formula for frog individuals within each subgroup is as follows:
[0021]
[0022] In the formula, the update step size of the frog each time is D, the optimal individual within the subgroup is P b , and the worst individual is P w ; the update compensation D is determined by the random number r between [0, 1] and the difference between the optimal individual and the worst individual within the subgroup. If the fitness of the updated frog is better than the original fitness, it is retained. If it is not improved, use the global optimal individual P g to update again through the following formula:
[0023]
[0024] Furthermore, the DNA - SFLA algorithm steps in Step 3.2 are as follows:
[0025] Step 3.2.1: Crossover operation. After completing Step 3.1, adopt a two - point crossover operation strategy, that is, perform a crossover operation on two frog individuals randomly selected from SuG with a certain crossover probability to form new individuals, and repeat the operation until the set condition is met, and then execute Step 3.2.2;
[0026] Step 3.2.2: Mutation operation. Let the frog individuals that meet the mutation conditions in the population generate a new individual through mutation with a certain mutation probability.
[0027] Step 3.2.3: Select an operation. After Step 3.2.2, perform DNA encoding, execute the tournament selection operation on the mutated population, use N - 1 individuals as the next generation individuals, and retain the optimal individual before executing the genetic algorithm.
[0028] Further, the overall optimal frog individual G after the final update in Step 3.3 s Determine the ideal initial weights and thresholds, and the relationship is as follows:
[0029] G s =(W i ,θ i )
[0030] Among them, W i ={W 1 ,W 2 ,…,W i}, representing the weights between each network layer; θ i ={θ 1 ,θ 2 ,...,θ i}, representing the thresholds between each network layer.
[0031] The present invention uses the Shuffled Frog Leaping Algorithm (SFLA) to optimize the Long Short - Term Memory Network (LSTM). At the same time, to solve the problem that SFLA may fall into a local optimal solution, the DNA - based Shuffled Frog Leaping Algorithm (DNA - SFLA) is proposed to reduce useless searches and avoid the occurrence of local optimal situations. This prediction model has the following advantages: (1) Set a gradient threshold. When gradient explosion occurs, the program can detect that the gradient value is very large or overflows, and directly truncate after the gradient exceeds the threshold; (2) Reasonably initialize the weight values to make each neuron in the recurrent neural network model avoid taking extremely large or extremely small values as much as possible, so as to avoid the area range that may lead to gradient disappearance. This power load prediction method can solve the inherent problems of long - time series prediction, has certain advantages in practical applications, and can be further improved and extended to cope with the challenges and requirements in power load prediction. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 is a flowchart of the short - term power load prediction method for optimizing LSTM based on the improved SFLA algorithm of the present invention.
[0033] Figure 2 is an example effect diagram of load prediction using the present invention. DETAILED DESCRIPTION OF THE INVENTION
[0034] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the scope of protection of the present invention.
[0035] Please refer to Figure 1 , the embodiments of the present invention provide a short-term power load forecasting method for optimizing LSTM based on an improved SFLA algorithm, including the following steps:
[0036] Step 1: Collect historical load data, preprocess the collected historical load data and normalize it, and divide the preprocessed historical load data into a training set and a test set;
[0037] Step 2: Establish an LSTM load forecasting network model. First, set the hyperparameters of the LSTM model, use the training set data to train the LSTM model, and initialize the weights and thresholds of different LSTM models to obtain LSTM load forecasting network models with different weight parameters;
[0038] There are many weight matrices and bias vectors in the LSTM load forecasting network model that need to set initial values. Use the Xavier initialization method and adopt a uniform distribution:
[0039]
[0040] Among them, -1 represents the number of nodes in the i-th and i+1-th layers of the LSTM network. The data of the feature vector is input through the input layer, and after being trained by the LSTM network, the predicted load value is obtained. This LSTM load forecasting network adopts the form of multiple inputs corresponding to one output, and groups the experimental data. One group is used for training, one group is used for testing, and then standardized processing is performed. The main feature vectors in the data are used as the input for model training. The error term in the backpropagation during the training process is the derivative of the loss function with respect to the output value. The loss function is the mean square error function. The gradient descent algorithm continuously updates the network weights to obtain the final hidden layer network. Finally, the test set data is predicted and the prediction results are output.
[0041] Step 3: Establish a DNA-SFLA optimization algorithm, and use the DNA-SFLA algorithm to optimize the LSTM load forecasting network model established in Step 2 to obtain the optimal initial values and threshold parameters. Step 3 specifically includes:
[0042] Step 3.1: Determine the parameters of the DNA - SFLA algorithm: the total number of frogs N, the number of sub - populations m, the number of evolutions of each sub - population G, the number of frogs in each subgroup n. Determine the parameters of the LSTM load prediction network model based on the DNA - SFLA algorithm. Select the fitness value function with a smaller training mean square error E, which means a higher fitness. Calculate the fitness values of frog individuals and sort them in descending order. The sorted frog population is divided into two parts. The first part is the high - quality population SuG, and the second part is the low - quality population InG.
[0043] The fitness value function selected in the present invention is:
[0044]
[0045] where y i is the predicted value of the load, is the actual value of the load, and f is the number of training samples.
[0046] The update formula for frog individuals within each subgroup is as follows:
[0047]
[0048] In the formula, the update step size of the frog each time is D, the best individual within the subgroup is P b , and the worst individual is P w . The update compensation D is determined by the random number r between [0, 1] and the difference between the best individual and the worst individual within the subgroup. If the fitness of the updated frog is better than the original fitness, it is retained. If not improved, it is updated again using the global best individual P g through the following formula:
[0049]
[0050] Step 3.2: Execute the steps of the DNA - SFLA algorithm. First, perform the crossover operation on two frog individuals randomly selected from the high - quality population SuG until the number of newly generated frog individuals is greater than 0.5N, and then perform the mutation operation. After the mutation operation, perform DNA decoding and tournament selection operations, and use N - 1 individuals as the next - generation individuals, and retain the best individual before executing the genetic algorithm;
[0051] The steps of the DNA - SFLA algorithm are as follows:
[0052] Step 3.2.1: Crossover operation. After completing the above Step 3.1, adopt the two - point crossover operation strategy, that is, perform the crossover operation on two frog individuals randomly selected from SuG with a certain crossover probability to form new individuals, repeat the operation until the set conditions are met, and then execute Step 3.2.2;
[0053] Step 3.2.2: Mutation operation. Let the frog individuals in the population that meet the mutation conditions generate a new individual through mutation with a certain mutation probability. This is an important means for the genetic algorithm to jump out of local minima.
[0054] Step 3.2.3: Selection operation. After Step 3.2.2, perform DNA encoding, and execute the tournament selection operation on the mutated population. Take N - 1 individuals as the next-generation individuals, and retain the optimal individual before executing the genetic algorithm.
[0055] DNA Encoding and Decoding:
[0056] The encoding and decoding processes complete the mutual mapping between the problem space and the DNA operator space. This process can be described as follows: First, set the parameter encoding as a quaternary data sequence; then, these sequences change their forms by adopting certain DNA genetic algorithm operations; finally, perform the decoding process, that is, the inverse mapping from the DNA encoding space to the real-value space. The global optimization problem can be expressed as:
[0057]
[0058] In the formula, x = (x 1 , x 2 ,..., x n ) represents an individual with n control variables, f(x) is the objective function to be optimized, x mini and x maxi are the parameter ranges of the control variable x i . In the optimization problem, each variable x i represents an integer string with a coding length of 1, and the precision of the variable x i is (x maxi - x mini ) / 4 l .
[0059] The coding sequence of the variable x i is:
[0060]
[0061] Converted to an integer value:
[0062]
[0063] According to the upper and lower bounds of each variable, the sequence can be converted to the corresponding solution through the following formula
[0064]
[0065] Step 3.3: If the convergence condition is reached, output the optimal individual. If the termination condition is not satisfied, continue to execute Step 3.2 until the condition is met. The optimal individual is the optimal initial value and threshold parameter of the model.
[0066] Relationship between the optimal individual and the initial weights and thresholds:
[0067] The overall optimal frog individual G after the final update s Determine the ideal initial weights and thresholds, and the relationship is as follows:
[0068] G s =(W i , θ i )
[0069] where, W i ={W 1 , W 2 ,…, W i}, represents the weights between each network layer; θ i ={θ 1 , θ 2 ,..., θ i}, represents the thresholds between each network layer.
[0070] Step 4: Substitute the output optimal initial weights and thresholds into the LSTM network for training to obtain the optimal LSTM load prediction network model, and call the test set data for load prediction.
[0071] To make the above objects, features, and advantages of the present invention more obvious and understandable, the following specific preferred embodiments are given and described in conjunction with the accompanying drawings.
[0072] Example: Select the power load data from February 20th to May 20th, 2022 in a certain place as the original data, and divide it into a training set and a test set according to an 8:2 ratio. For the LSTM load prediction network model with different weight parameters, use the DNA-SFLA algorithm to optimize and train the LSTM to obtain the optimal weight and threshold parameters. Use the optimized model to perform load prediction on the test set. Select the data on May 18th and use the method proposed in the present invention for prediction and compare it with the prediction of the conventional LSTM algorithm. The prediction results are as Figure 2, compared with the prediction results of the LSTM without optimization, the accuracy of the final prediction results has been greatly improved. It can be seen from the prediction results that there are large prediction errors between the prediction results of the LSTM without optimization and the actual situation at four time nodes: 6:00, 16:00, 17:00, and 19:00 on the same day. This is because the power load changes at these time nodes are complex, and gradient explosion or disappearance occurs during the training of the LSTM. After optimizing the LSTM using DNA-SFLA, the prediction error is significantly reduced, indicating that this optimization algorithm effectively controls the gradient problem and greatly improves the prediction accuracy.
[0073] As described above, it is only the specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by those skilled in the art within the technical scope disclosed by the present invention should be covered by the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.
Claims
1. A short-term power load forecasting method based on LSTM optimization by improved SFLA algorithm, characterized in that: The steps include: Step 1: Collect historical load data, preprocess and normalize the collected historical load data, and divide the preprocessed historical load data into a training set and a test set; Step 2: Establish LSTM load forecasting network model; Step 3: Establish a DNA-SFLA optimization algorithm, and use the DNA-SFLA algorithm to optimize the LSTM load forecasting network model established in step 2 to obtain the optimal initial value and threshold parameters; Step 4: Substitute the output optimal initial weights and thresholds into the LSTM network for training to obtain the optimal LSTM load forecasting network model, and call the test set data for load forecasting.
2. The short-term power load forecasting method based on LSTM optimization based on the improved SFLA algorithm as claimed in claim 1 is characterized by: Step 2 specifically includes: setting LSTM model hyperparameters, training the LSTM model using training set data, and initializing weights and thresholds of different LSTM models to obtain LSTM load forecasting network models with different weight parameters.
3. The short-term power load forecasting method based on LSTM optimization based on the improved SFLA algorithm as claimed in claim 1, characterized in that: Step 3 specifically includes: Step 3.1: Determine the parameters of the DNA-SFLA algorithm: total number of frogs N, number of subpopulations m, number of subpopulation evolutions G, number of frogs in each subpopulation n; determine the parameters of the LSTM load forecasting network model based on the DNA-SFLA algorithm, select the fitness value function with the smaller the training mean square error E, the higher the fitness, to calculate the fitness value of the individual frogs, and sort them in descending order according to the value size. After descending, the frog population is divided into two parts, the first part is the high-quality population SuG, and the second part is the low-quality population InG; Step 3.2: Execute the DNA-SFLA algorithm steps: First, two frog individuals randomly selected from the high-quality population SuG are crossover-operated until the number of newly generated frog individuals is greater than 0.5N, and then the mutation operation is performed. After the mutation operation is completed, DNA decoding and league selection operations are performed, and N-1 individuals are used as the next generation of individuals, and the best individual before the execution of the genetic algorithm is retained; Step 3.3: If the convergence condition is met, the optimal individual is output. If the termination condition is not met, step 3.2 is continued until the condition is met. The optimal individual is the optimal initial value and threshold parameter of the model.
4. The short-term power load forecasting method based on LSTM optimization based on the improved SFLA algorithm as claimed in claim 3 is characterized by: The fitness value function in step 3.1 is: Among them, y i is the predicted value of the load, is the actual load value, f is the number of training samples; The update formula for frog individuals in each subgroup is as follows: In the formula, the update step length of the frog each time is D, and the optimal individual in the subgroup is P b , the worst individual is P w ; The update compensation D is determined by the difference between the random number r between the random number [0,1] and the best individual and the worst individual in the subgroup; if the updated frog fitness is better than the original fitness, it is retained; if it is not improved, the global best individual P is used g Update again with:
5. The short-term power load forecasting method based on LSTM optimization based on the improved SFLA algorithm as claimed in claim 3 is characterized by: The steps of the DNA-SFLA algorithm in step 3.2 are as follows: Step 3.2.1: Crossover operation. After completing step 3.1, a two-point crossover operation strategy is adopted, that is, two frog individuals randomly selected from SuG are crossovered with a certain crossover probability to form a new individual. The operation is repeated until the conditions are set, and then step 3.2.2 is executed; Step 3.2.2: Mutation operation, with a certain mutation probability, allows the frog individuals in the population that meet the mutation conditions to mutate and regenerate a new individual; Step 3.2.3: Selection operation. After step 3.2.2, DNA encoding is performed and the league selection operation is performed on the mutated population. N-1 individuals are selected as the next generation of individuals, and the optimal individual before the execution of the genetic algorithm is retained.
6. The short-term power load forecasting method based on LSTM optimization based on the improved SFLA algorithm as claimed in claim 3 is characterized by: The overall optimal frog individual G after the final update in step 3.3 s Determine the ideal initial weight and threshold, the relationship is as follows: G s =(W i ,i i ) Among them, W i ={W1,W2,…,W i }, represents the weights between each network layer; θ i ={θ1,θ2,...,θ i }, indicating the threshold between each network layer.
Citation Information
Patent Citations
Short-term power load prediction method and system based on LSTM algorithm
CN117913787A
Electrical power system prediction method and apparatus
WO2020063690A1