Power load prediction method based on improved lstm and related equipment
Patent Information
- Application Number
- CN202511391537.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-26
- Publication Date
- 2026-08-21
- Estimated Expiration
- 2045-09-26
AI Technical Summary
[0002]在现有技术中,虽然可以采用LSTM网络模型来进行短期电力负荷预测,但是前期在对LSTM网络模型进行训练时通常采用固定的超参数,导致LSTM网络模型在训练后的应用性能不佳,即预测出的电力负荷准确性低下
[0032] This application includes at least the following beneficial effects: by setting an improved LSTM network model to perform fusion calculations based on the cell states of all previous time steps when performing the cell state update task, and then optimizing and training the improved LSTM network model for hyperparameters, the prediction accuracy and reliability of the trained power load prediction model can be improved when it is officially put into application.
Smart Images

Figure CN121457682B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of power technology, and in particular to a power load forecasting method and related equipment based on an improved LSTM. Background Technology
[0002] While LSTM network models can be used for short-term power load forecasting in existing technologies, fixed hyperparameters are typically used during the initial training of these models. This leads to poor performance in post-training applications, resulting in low accuracy in predicted power load. Furthermore, traditional LSTM network models often rely solely on the cell state from the previous time step when performing cell state updates, making global memory optimization and correction difficult. This negatively impacts the predictive performance of the LSTM network model. Summary of the Invention
[0003] The main purpose of this application is to propose an improved LSTM-based power load forecasting method and related equipment, aiming to improve the accuracy and efficiency of power load forecasting.
[0004] To achieve the above objectives, one aspect of this application proposes a power load forecasting method based on an improved LSTM, the method comprising:
[0005] Obtain the power load sequence for the current time period;
[0006] After preprocessing the power load sequence, it is input into the power load prediction model for prediction processing to obtain the predicted power load sequence for future time periods;
[0007] The power load prediction model is obtained by hyperparameter optimization and training of a pre-built improved LSTM network model. The improved LSTM network model performs fusion calculations based on the cell states of all previous time steps when performing the cell state update task.
[0008] Furthermore, the preprocessing of the power load sequence includes: outlier correction of the power load sequence, wherein the outlier correction method includes horizontal processing and vertical processing.
[0009] Furthermore, the power load forecasting model is obtained in the following way:
[0010] Obtain a sample dataset with labels, wherein the sample dataset contains multiple historical power load sequences, and each historical power load sequence carries a label that is a future real power load sequence;
[0011] The sample dataset is extracted to obtain the first sample dataset;
[0012] Based on the first sample dataset, the improved goat optimization algorithm is used to optimize multiple hyperparameters of the improved LSTM network model to obtain the optimal values of the multiple hyperparameters.
[0013] The improved LSTM network model is trained based on the sample dataset and the optimal values of the multiple hyperparameters to obtain the power load prediction model.
[0014] Furthermore, the step of optimizing multiple hyperparameters of the improved LSTM network model using an improved goat optimization algorithm based on the first sample dataset to obtain the optimal values of the multiple hyperparameters includes:
[0015] The location of the goat population is initialized, with the location of each individual goat representing the value of the multiple hyperparameters. The initial location of the goat population is then used as the current location of the goat population, and the optimal goat location is determined by combining it with a preset fitness function. The fitness function is used to evaluate the prediction performance achieved by the improved LSTM network model after training based on the first sample dataset and the values of the multiple hyperparameters.
[0016] Determine whether the preset termination condition is met;
[0017] If not, update the current position of the goat population to obtain the first position of the goat population; according to the fitness function, partially reset the first position of the goat population and select the first optimal goat position; perturb the first optimal goat position to obtain the second optimal goat position; according to the fitness function, determine whether the first optimal goat position or the second optimal goat position is the current optimal goat position; use the partially reset first position of the goat population as the current position of the goat population, and then return to the step of determining whether the preset termination condition is met;
[0018] If so, then the optimal values of the multiple hyperparameters are determined based on the current optimal goat position.
[0019] Furthermore, updating the current position of the goat population to obtain the first position of the goat population includes:
[0020] For each individual goat in the goat population, if the individual goat is in the jumping phase, the distance between the current optimal goat position and the current position of the individual goat is calculated and adjusted to obtain an adaptive amplitude; based on the number of the multiple hyperparameters, a Levy flight step length is generated; based on the adaptive amplitude, the Levy flight step length, and multiple preset value ranges corresponding to the multiple hyperparameters, the current position of the individual goat is updated to obtain the first position of the individual goat.
[0021] Furthermore, updating the current position of the goat population to obtain the first position of the goat population includes:
[0022] For each individual goat in the goat population, if the individual goat is not in the jumping phase, an inertia weight value is calculated based on a preset weight range, the current iteration number of the improved goat optimization algorithm, and a preset maximum iteration number. The current positions of two individual goats are selected from the current positions of the goat population and differential calculation and adjustment are performed to obtain the differential position. The current position of the individual goat is updated based on the inertia weight value and the differential position to obtain the first position of the individual goat.
[0023] Further, updating the current position of the individual goat based on the inertia weight value and the differential position to obtain the first position of the individual goat includes:
[0024] If the goat is in the exploration phase, the current position of the goat is updated according to the inertia weight value, the differential position, and the multiple preset value ranges corresponding to the multiple hyperparameters to obtain the first position of the goat.
[0025] If the goat is in the utilization stage, the preset utilization coefficient value is adjusted according to the current iteration number and the preset maximum iteration number to obtain the first utilization coefficient value; the current position of the goat is updated according to the current optimal goat position, the first utilization coefficient value, the inertia weight value and the differential position to obtain the first position of the goat.
[0026] To achieve the above objectives, another aspect of this application proposes a power load forecasting system based on an improved LSTM, the system comprising:
[0027] The acquisition module is used to acquire the power load sequence for the current time period;
[0028] The processing module is used to preprocess the power load sequence and then input it into the power load prediction model for prediction processing to obtain the predicted power load sequence for future time periods.
[0029] The power load prediction model is obtained by optimizing and training a pre-built improved LSTM network model with hyperparameters. The improved LSTM network model performs fusion calculations based on the cell states in all previous time steps when performing the cell state update task.
[0030] To achieve the above objectives, another aspect of this application proposes an electronic device comprising a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the above-described power load forecasting method based on improved LSTM.
[0031] To achieve the above objectives, another aspect of this application proposes a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described power load forecasting method based on improved LSTM.
[0032] This application includes at least the following beneficial effects: by setting an improved LSTM network model to perform fusion calculations based on the cell states of all previous time steps when performing the cell state update task, and then optimizing and training the improved LSTM network model for hyperparameters, the prediction accuracy and reliability of the trained power load prediction model can be improved when it is officially put into application. Attached Figure Description
[0033] Figure 1 This is a flowchart illustrating an improved LSTM-based power load forecasting method provided in an embodiment of this application.
[0034] Figure 2 This is a schematic diagram of the composition of an improved LSTM-based power load forecasting system provided in an embodiment of this application;
[0035] Figure 3 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0036] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to limit it. In the following description, when referring to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with those of this application; they are merely examples of systems and methods consistent with some aspects of the embodiments of this application as detailed in the appended claims.
[0037] It is understood that the terms “first,” “second,” etc., used in this application may be used herein to describe various concepts, but unless otherwise stated, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another. For example, without departing from the scope of the embodiments of this application, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the words “if,” “when,” or “in response to a determination” as used herein may be interpreted as “when…” or “when…” or “in response to a determination.”
[0038] As used in this application, the terms "at least one", "multiple", "each", "any", etc., "at least one" includes one, two or more, "multiple" includes two or more, "each" refers to each of the corresponding multiples, and "any" refers to any one of the multiples.
[0039] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0040] With the continuous development of clean energy, distributed energy resources in the power grid are increasing, leading to increased load volatility and numerous problems such as renewable energy absorption, transformer overload, and backfeeding from main transformers. Accurate short-term power load forecasting is crucial for achieving the economic, safe, and stable operation of the power system. Its purpose is to predict power load demand for the next day to several days to ensure a balance between power supply and demand. Power load can be understood as the total electrical power consumed by all electrical devices in the power grid at a given moment.
[0041] Traditional load forecasting methods generally include regression integral moving average models, multiple linear regression, and grey forecasting methods. While these methods offer good interpretability and fast computation speed, they perform poorly on large datasets. With the development of deep learning and the improvement of computing power, some researchers have proposed using LSTM (Long Short-Term Memory) network models for short-term power load forecasting. However, fixed hyperparameters are typically used during the initial training of LSTM network models, leading to poor application performance after training—namely, low accuracy in predicting power load and poor generalization ability. Furthermore, traditional LSTM network models usually rely solely on the cell state from the previous time step when performing cell state updates, making global memory optimization and correction difficult, which negatively impacts the predictive performance of the LSTM network model.
[0042] In view of this, embodiments of this application provide a power load forecasting method and related equipment based on an improved LSTM. This scheme enhances the model's ability to capture long-distance dependencies by setting the improved LSTM network model to perform fusion calculations based on the cell states of all previous time steps when performing the cell state update task. Subsequently, hyperparameter optimization and training of the improved LSTM network model can improve the prediction accuracy and reliability of the trained power load forecasting model when it is formally put into application.
[0043] This application provides a power load forecasting method based on an improved LSTM, relating to the field of power technology. It can be applied to terminals, servers, or software running on either a terminal or server. In some embodiments, the terminal can be a smartphone, tablet, laptop, or desktop computer, but is not limited to these. The server can be configured as an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The server can also be a node server in a blockchain network. The software can be an application implementing the above method, but is not limited to these forms.
[0044] Please see Figure 1 , Figure 1 This is an optional flowchart illustrating an improved LSTM-based power load forecasting method provided in an embodiment of this application. The method may include, but is not limited to, the following steps S101 to S102:
[0045] Step S101: Obtain the power load sequence for the current time period;
[0046] Step S102: After preprocessing the power load sequence for the current time period, input it into the power load prediction model for prediction processing to obtain the predicted power load sequence for the future time period.
[0047] In step S101 of some embodiments, the power load sequence for the current time period can be understood as containing power load subsequences for multiple consecutive days. Each power load subsequence contains multiple power load data corresponding to multiple sampling times, and there is a one-to-one correspondence between sampling times between every two power load subsequences. Before preprocessing the power load sequence for the current time period, each power load data contained in the power load sequence for the current time period can be assigned a period identifier. This period identifier is mainly used to indicate whether the power load data belongs to weekday data or rest day data. The period identifier can also further indicate which season and / or which holiday the power load data belongs to.
[0048] In step S102 of some embodiments, outlier correction can be performed on the power load sequence of the current time period to complete the preprocessing operation. The corresponding outlier correction methods include horizontal processing and vertical processing. In this application, it is preferred to perform horizontal processing first and then vertical processing. The specific description is as follows:
[0049] (1) If abnormal fluctuations occur within the power load sequence of the current time period, that is, if the power load data of adjacent time periods change significantly, it generally indicates that the electrical equipment is operating abnormally or that there is human intervention. In this case, the horizontal processing method is used to smooth the entire power load curve to ensure that its trend is continuous and reasonable. The corresponding implementation principle is to meet the following conditions. and In this case, the following expression is used for outlier correction:
[0050] ;
[0051] In the formula, For the power load data at the t-th sampling time on day d, For the power load data at the (t-1)th sampling time on day d, For the power load data at the (t+1)th sampling time on day d, and All are preset load deviation thresholds. This refers to the power load data at the t-th sampling time on day d after horizontal processing. As a new To complete outlier correction;
[0052] (2) The vertical processing method is adopted to constrain the load difference between adjacent days at the same time to maintain within a reasonable range. The corresponding implementation principle is to meet the following conditions. In this case, the following expression is used for outlier correction:
[0053] ;
[0054] In the formula, This refers to the power load data at the t-th sampling time of an adjacent day, where an adjacent day refers to either day d-1 or day d+1. The same preset load deviation threshold This refers to the power load data at the t-th sampling time on day d after vertical processing. As a new To complete outlier correction, and and These are generally data from weekdays, or and These are generally data from rest days.
[0055] In step S102 of some embodiments, the power load forecasting model is obtained by hyperparameter optimization and training of a pre-built improved LSTM network model. The network architecture of the power load forecasting model is the same as that of the improved LSTM network model. The power load forecasting model is actually based on the network architecture of the improved LSTM network model, learning from input data to continuously adjust its internal parameters (such as weights and biases), thereby possessing the ability to generalize to the power load forecasting task. The generation method of this power load forecasting model may include, but is not limited to, steps S201 to S204.
[0056] Step S201: Obtain a labeled sample dataset. This sample dataset contains multiple historical power load sequences, and each historical power load sequence carries a label representing a future real power load sequence. More specifically, this sample dataset contains multiple power load sequences from different historical time periods. The label carried by each historical power load sequence is the real power load sequence of the first future time period after that historical time period, which is before the current time period. Furthermore, at least each historical power load data contained in each historical power load sequence is assigned a periodic identifier. This allows the model to utilize the co-occurrence statistical regularity of discrete features and load fluctuations during the training phase, reducing parameter uncertainty and the exploration space for periodic patterns, and improving the model's generalization ability in low sample density regions.
[0057] Step S202: Extract the sample dataset to obtain the first sample dataset.
[0058] In this step, the first sample dataset can be obtained by randomly sampling the sample dataset according to a preset ratio, or by iterative sampling the sample dataset according to a preset step size. This application does not limit the method.
[0059] Step S203: Based on the first sample dataset, the improved goat optimization algorithm is used to optimize multiple hyperparameters of the improved LSTM network model to obtain the optimal values of multiple hyperparameters; among which, multiple hyperparameters include the number of hidden layer units, learning rate and number of training epochs.
[0060] Step S204: Based on the sample dataset and the optimal values of multiple hyperparameters, train the improved LSTM network model to obtain the power load prediction model.
[0061] In this step, the sample dataset is preprocessed, specifically by correcting outliers for each historical power load sequence within the dataset. Outlier correction methods include horizontal and vertical correction. Based on the preprocessed sample dataset, the optimal values of multiple hyperparameters, and a predefined loss function, the improved LSTM network model is trained in a supervised manner. This involves: first, calculating the model output using forward propagation and then using the loss function to calculate the model prediction error; then, calculating the gradient based on this prediction error using backpropagation and updating the model parameters using the Adam optimizer. These steps are iteratively executed until the model converges. The loss function can be a mean squared error function, a mean absolute error function, or a mean squared logarithmic error function.
[0062] In this application, by extracting a first sample dataset from the sample dataset to perform hyperparameter optimization on the improved LSTM network model, the running efficiency can be improved and the computational cost reduced. Subsequently, by training the improved LSTM network model after hyperparameter optimization on the sample dataset, the generalization ability and application performance of the model can be improved.
[0063] In step S203 above, the goat optimization algorithm is an emerging swarm intelligence optimization algorithm inspired by the natural behavior of goats in harsh and resource-scarce environments. Goats possess remarkable adaptability, strategic foraging behavior, and the ability to navigate rugged terrain. They exhibit a unique balance between the exploration phase (i.e., finding new grazing areas) and the utilization phase (maximizing resource utilization within a given area). Furthermore, they can escape predators and acquire unused resources through jumping patterns, making them an ideal source of inspiration for optimization problems. Regarding the optimization of multiple hyperparameters of the improved LSTM network model using the improved goat optimization algorithm, the corresponding implementation may include, but is not limited to, steps S301 to S307 below.
[0064] Step S301: Initialize the position of the goat population. The position of each individual goat refers to the value of multiple hyperparameters. Then, take the initial position of the goat population as the current position of the goat population, and combine it with the preset fitness function to determine the current optimal goat position.
[0065] The fitness function is used to evaluate the predictive performance of the improved LSTM network model after training on the first sample dataset and the values of multiple hyperparameters. It can be either the mean squared error function, the mean absolute error function, or the mean square logarithmic error function. It should be noted that the first sample dataset should ideally be preprocessed before being input into the improved LSTM network model for training. This preprocessing involves correcting outliers for each historical power load sequence contained in the first sample dataset. The outlier correction methods include horizontal and vertical correction.
[0066] In this step, the location of the goat population can be randomly initialized based on multiple preset value ranges corresponding to multiple hyperparameters to obtain the initial location of the goat population and use it as the current location of the goat population. For the current location of each individual goat in the goat population, the current fitness value of the individual goat is calculated after training the improved LSTM network model based on the first sample dataset and the current values of multiple hyperparameters represented by the current location of the individual goat. After calculating all the current fitness values corresponding to all the individual goats in the goat population, the minimum current fitness value is selected, and the current location of the individual goat corresponding to the minimum current fitness value is taken as the current optimal goat location.
[0067] Step S302: Determine whether the preset termination condition is met. The preset termination condition may be that the current iteration number of the improved goat optimization algorithm reaches the preset maximum iteration number. If not met, proceed to step S303. If met, proceed to step S307.
[0068] Step S303: Update the current position of the goat population to obtain the first position of the goat population.
[0069] In this step, for each individual goat in the goat population, if that individual goat is in the jumping phase, its position is updated as follows:
[0070] First, the distance between the current optimal goat position and the current position of the individual goat is calculated and adjusted to obtain the adaptive amplitude. The mathematical expression used in this process is as follows:
[0071] ;
[0072] Secondly, based on the number of multiple hyperparameters, the Lévy flight step size is generated. The mathematical expression used in this process is as follows:
[0073] ;
[0074] Finally, based on the adaptive amplitude, the Levy flight step size, and multiple preset value ranges corresponding to multiple hyperparameters, the current position of the individual goat is updated to obtain the first position of the individual goat. The mathematical expression used in this implementation process is as follows:
[0075] ;
[0076] In the formula, For adaptive amplitude, Let be the current position of the i-th individual goat. This is the current optimal position for the goat. Used for solving and The Euclidean distance between them The number of hyperparameters, i.e., the positional dimension of each individual goat. For Levi's flight stride, The preset Lévy flight parameters can be understood as the shape parameters of the Lévy distribution, which determine the degree of heavy tails in the distribution. Refers to the Lévy flight function, which is used to generate random vectors that conform to the Lévy distribution. Let represent the first position of the i-th goat individual. The preset value range for each hyperparameter limits its maximum and minimum values. This is the upper bound of the solution space, which contains multiple maximum values corresponding to multiple hyperparameters. It is the lower bound of the solution space, which contains multiple minimum values corresponding to multiple hyperparameters.
[0077] If the individual goat is not in the jumping phase, it means that the individual goat is in the exploration or utilization phase, and the position is updated in the following way:
[0078] First, the inertia weight value is calculated based on the preset weight range, the current iteration number, and the preset maximum iteration number of the improved goat optimization algorithm. The mathematical expression used in this process is as follows:
[0079] ;
[0080] Secondly, the current positions of two individual goats are selected from the current positions of the goat population, and the differences are calculated and adjusted to obtain the difference positions. The mathematical expression used in this process is as follows:
[0081] ;
[0082] Finally, based on the inertia weight value and the difference position, the current position of the individual goat is updated to obtain the first position of the individual goat, which is divided into the following two cases:
[0083] In the first scenario, if the goat is in the exploration phase, its current position is updated based on the inertia weight value, the differential position, and multiple preset value ranges corresponding to multiple hyperparameters, thus obtaining the goat's first position. The mathematical expression used in this process is as follows:
[0084] ;
[0085] In the second scenario, if the individual goat is in the utilization phase, the preset utilization coefficient value is first adjusted based on the current iteration number and the preset maximum iteration number of the improved goat optimization algorithm to obtain the first utilization coefficient value. The mathematical expression used in this implementation process is as follows:
[0086] ;
[0087] Then, based on the current optimal goat position, the first utilization coefficient value, the inertia weight value, and the difference position, the current position of the individual goat is updated to obtain the first position of the individual goat. The mathematical expression used in this process is as follows:
[0088] ;
[0089] In the formula, For inertial weights, The maximum weight value is defined as the weight range specified in the predefined weight range. The minimum weight value defined by the preset weight range. To improve the current iteration count of the goat optimization algorithm, To improve the preset maximum number of iterations in the goat optimization algorithm, For the difference position, This is a scaling factor used to control the degree of influence of the difference position; in this application, it is preferably set to 0.5. and This represents the current positions of two individual goats. These two goats are typically randomly selected from the goat population, and are distinct from the goat currently updating its position. This means generating a d-dimensional random vector that takes values in the range [0,1]. The first utilization coefficient is used to control how closely the individual goat moves closer to the optimal individual goat. This is the preset utilization factor.
[0090] It should be noted that before updating the position of the individual goat, a random number can be generated in the range [0,1]. If the random number is less than the preset jump probability, the individual goat is determined to be in the jumping phase. If the random number is greater than or equal to the preset jump probability, the individual goat is determined to be in the exploration or utilization phase. The preset jump probability is preferably set to 0.5. Then, based on the current iteration number and the preset maximum iteration number of the improved goat optimization algorithm, the preset exploration coefficient value is adjusted to obtain the first exploration coefficient value. If the random number is less than the first exploration coefficient value, the individual goat is determined to be in the exploration phase. If the random number is greater than or equal to the first exploration coefficient value, the individual goat is determined to be in the utilization phase. The first exploration coefficient value is calculated using the following expression:
[0091] ;
[0092] In the formula, As the first exploration coefficient, This is the preset exploration coefficient.
[0093] Step S304: Based on the fitness function, partially reset the first position of the goat population and then select the first optimal goat position.
[0094] In this step, for the first position of each goat individual in the goat population, the first fitness value of the goat individual is calculated after training the improved LSTM network model based on the first sample dataset and the first values of multiple hyperparameters represented by the first position of the goat individual. After calculating all the first fitness values corresponding to all goat individuals in the goat population, they are arranged in descending order. The first positions of goat individuals with the first fitness values at the top of the list are initialized to generate new first positions, and then the first positions of the partially reset goat population are obtained by summarizing them, wherein the preset proportion is preferably set to 5%. According to the fitness function, the first optimal goat position is selected from the first positions of the partially reset goat population.
[0095] Specifically, the content regarding initializing the first position of goat individuals with a preset proportion of first fitness values to generate new first positions, and then summarizing them to obtain the first position of the partially reset goat population, can be understood as follows: First, the goat population is divided into a first goat subpopulation and a second goat subpopulation. The ratio between the number of all goat individuals in the first goat subpopulation and the number of all goat individuals in the goat population is the preset ratio. The first fitness value of each goat individual in the first goat subpopulation is greater than the first fitness value of each goat individual in the second goat subpopulation. Then, based on multiple preset value ranges corresponding to multiple hyperparameters, the first position of each goat individual in the first goat subpopulation is randomly initialized to generate new first positions. Subsequently, the first positions of the second goat subpopulation and the randomly initialized first positions of the first goat subpopulation are summed to form the first position of the partially reset goat population.
[0096] Step S305: Perturb the first optimal goat position to obtain the second optimal goat position. The mathematical expression used in this process is:
[0097] ;
[0098] In the formula, The first optimal position for the goat. This is the second-best position for the goat.
[0099] Step S306: Based on the fitness function, determine the first optimal goat position or the second optimal goat position as the current optimal goat position, and take the first position of the partially reset goat population as the current position of the goat population, and then return to execute the above step S302.
[0100] In this step, the improved LSTM network model is first trained based on the first sample dataset and the first candidate values of multiple hyperparameters represented by the first optimal goat position, and the corresponding first candidate fitness value is calculated. Then, the improved LSTM network model is trained based on the first sample dataset and the second candidate values of multiple hyperparameters represented by the second optimal goat position, and the corresponding second candidate fitness value is calculated. Next, the first candidate fitness value and the second candidate fitness value are compared: if the first candidate fitness value is less than or equal to the second candidate fitness value, the first optimal goat position is taken as the current optimal goat position; if the first candidate fitness value is greater than the second candidate fitness value, the second optimal goat position is taken as the current optimal goat position.
[0101] Step S307: Determine the optimal values of multiple hyperparameters based on the current optimal goat position; it can be understood that the current values of the multiple hyperparameters represented by the current optimal goat position are directly used as the optimal values of the multiple hyperparameters.
[0102] In this application, considering that the traditional goat optimization algorithm makes it difficult for individuals to jump out of local regions due to the fixed and uniform jump step size, a Lévy flight step size with a heavy-tailed distribution and adaptive amplitude are introduced to assist in updating the individual's position. This allows individuals to make long-distance jumps, effectively avoiding the algorithm from getting trapped in local optima. Furthermore, considering that the traditional goat optimization algorithm uses fixed inertial weights and a purely random perturbation strategy, which makes the algorithm prone to missing the global optimum due to excessively small step sizes in the early stages and difficult to converge due to excessively large step sizes in the later stages, while also lacking guidance for the individual's exploration direction, an inertial weight based on a non-linear decreasing form is introduced. By first increasing the step size and then decreasing it, we can balance wide-area exploration with fine-grained utilization. Furthermore, by introducing differential positions, we can provide directional guidance when updating individual positions. Considering that the traditional goat optimization algorithm directly discards the 20% of individuals with the worst fitness after each iteration, which can easily destroy the information of the good solutions already obtained, we can ensure population diversity and prevent premature convergence by reducing the reset ratio to 5% and regenerating randomly throughout the entire exploration space. By applying a small Gaussian perturbation in the neighborhood of the best individual, we can further improve the solution accuracy of the algorithm without destroying the global framework.
[0103] In some embodiments, at least one improvement of the improved LSTM network model compared to the traditional LSTM network model is that it performs a fusion calculation based on the cell states at all previous time steps when performing the cell state update task, which can be implemented using the following expression:
[0104] ;
[0105] In the formula, This represents the cell state at the current time step t. The number of all previous time steps. These are the weighting coefficients. For the previous time step The state of the cells, The input gate control vector, This refers to the activation function used during the cell state update phase, which can be either a sigmoid activation function or a tanh activation function. Refers to linear transformation, This is the hidden state of the previous time step t-1. This is the input vector for the current time step t.
[0106] Among them, the weighting coefficient It can be a preset value, or it can be calculated using the following expression:
[0107] ;
[0108] In the formula, This represents the candidate cell state at the current time step t. For the previous time step Candidate cell state, For the previous time step The input vector.
[0109] In some embodiments, the improved LSTM network model can make an additional improvement over the traditional LSTM network model by hiding the hidden state of the previous time step t-1 during the computation of the input and output gates. and the input vector at the current time step t By performing linear transformations on each feature separately and then combining them for activation processing, the nonlinear expressive power of the model can be increased, enabling it to learn more complex feature mapping relationships. This can be achieved using the following expression:
[0110] ,
[0111] ;
[0112] In the formula, This refers to the activation function used by the input gate during the computation phase. These are the activation functions used by the output gate during the computation phase, and these two activation functions can be set to either the sigmoid activation function or the tanh activation function. This is the output gate control vector.
[0113] Please see Figure 2 , Figure 2 This is a schematic diagram of an optional component of an improved LSTM-based power load forecasting system provided in this application embodiment. This system can implement the aforementioned improved LSTM-based power load forecasting method and may include, but is not limited to, the following:
[0114] The acquisition module 401 is used to acquire the power load sequence for the current time period;
[0115] The processing module 402 is used to preprocess the power load sequence of the current time period and then input it into the power load prediction model for prediction processing to obtain the predicted power load sequence of the future time period.
[0116] The power load prediction model is obtained by optimizing and training a pre-built improved LSTM network model with hyperparameters. This improved LSTM network model performs fusion calculations based on the cell states in all previous time steps when performing the cell state update task.
[0117] It is understood that the content of the above method embodiments is applicable to this system embodiment. The specific functions implemented in this system embodiment are the same as those implemented in the above method embodiments, and the beneficial effects achieved by this system embodiment are also the same as those achieved by the above method embodiments.
[0118] This application also provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the above-described power load forecasting method based on improved LSTM. The electronic device may include any smart terminal such as a tablet computer or desktop computer.
[0119] It is understood that the content of the above method embodiments is applicable to the present device embodiments. The specific functions implemented by the present device embodiments are the same as those implemented by the above method embodiments, and the beneficial effects achieved by the present device embodiments are also the same as those achieved by the above method embodiments.
[0120] Please see Figure 3 , Figure 3 This is a schematic diagram illustrating the hardware structure of an electronic device according to another embodiment. The electronic device includes:
[0121] The processor 501 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this application.
[0122] The memory 502 can be implemented as a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 502 can store the operating system and other applications. When the technical solutions provided in the embodiments of this application are implemented through software or firmware, the relevant program code is stored in the memory 502 and is called and executed by the processor 501.
[0123] The input / output interface 503 is used to implement information input and output;
[0124] The communication interface 504 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0125] Bus 505 transmits information between various components of the device (e.g., processor 501, memory 502, input / output interface 503, and communication interface 504);
[0126] The processor 501, memory 502, input / output interface 503 and communication interface 504 are connected to each other within the device via bus 505.
[0127] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described power load forecasting method based on improved LSTM.
[0128] It is understood that the content of the above method embodiments is applicable to this storage medium embodiment. The specific functions implemented by this storage medium embodiment are the same as those implemented by the above method embodiments, and the beneficial effects achieved by this storage medium embodiment are also the same as those achieved by the above method embodiments.
[0129] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0130] The embodiments described in this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.
[0131] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of this application, and may include more or fewer steps than shown, or combine certain steps, or different steps.
[0132] The system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0133] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.
[0134] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0135] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0136] In the embodiments provided in this application, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the system embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between systems or units may be electrical, mechanical, or other forms.
[0137] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0138] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0139] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0140] The preferred embodiments of the present application have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of the present application. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and substance of the embodiments of the present application shall be within the scope of the claims of the present application.
Claims
1. A power load forecasting method based on an improved LSTM, characterized in that, The method includes: Obtain the power load sequence for the current time period; After preprocessing the power load sequence, it is input into the power load prediction model for prediction processing to obtain the predicted power load sequence for future time periods; The power load prediction model is obtained by optimizing and training a pre-built improved LSTM network model with hyperparameters. The improved LSTM network model performs fusion calculations based on the cell states in all previous time steps when performing the cell state update task. The power load forecasting model is obtained in the following way: Obtain a sample dataset with labels, wherein the sample dataset contains multiple historical power load sequences, and each historical power load sequence carries a label that is a future real power load sequence; The sample dataset is extracted to obtain the first sample dataset; Based on the first sample dataset, the improved goat optimization algorithm is used to optimize multiple hyperparameters of the improved LSTM network model to obtain the optimal values of the multiple hyperparameters. Based on the sample dataset and the optimal values of the multiple hyperparameters, the improved LSTM network model is trained to obtain the power load prediction model; The step of optimizing multiple hyperparameters of the improved LSTM network model using an improved goat optimization algorithm based on the first sample dataset to obtain the optimal values of the multiple hyperparameters includes: The location of the goat population is initialized, with the location of each individual goat representing the value of the multiple hyperparameters. The initial location of the goat population is then used as the current location of the goat population, and the optimal goat location is determined by combining it with a preset fitness function. The fitness function is used to evaluate the prediction performance achieved by the improved LSTM network model after training based on the first sample dataset and the values of the multiple hyperparameters. Determine whether the preset termination condition is met; If not, update the current position of the goat population to obtain the first position of the goat population; according to the fitness function, partially reset the first position of the goat population and select the first optimal goat position; perturb the first optimal goat position to obtain the second optimal goat position; according to the fitness function, determine whether the first optimal goat position or the second optimal goat position is the current optimal goat position; use the partially reset first position of the goat population as the current position of the goat population, and then return to the step of determining whether the preset termination condition is met; If so, then the optimal values of the multiple hyperparameters are determined based on the current optimal goat position.
2. The power load forecasting method based on improved LSTM according to claim 1, characterized in that, The preprocessing of the power load sequence includes: correcting outliers in the power load sequence, and the outlier correction methods include horizontal processing and vertical processing.
3. The power load forecasting method based on improved LSTM according to claim 1, characterized in that, The step of updating the current position of the goat population to obtain the first position of the goat population includes: For each individual goat in the goat population, if the individual goat is in the jumping phase, the distance between the current optimal goat position and the current position of the individual goat is calculated and adjusted to obtain an adaptive amplitude; based on the number of the multiple hyperparameters, a Levy flight step length is generated; based on the adaptive amplitude, the Levy flight step length, and multiple preset value ranges corresponding to the multiple hyperparameters, the current position of the individual goat is updated to obtain the first position of the individual goat.
4. The power load forecasting method based on improved LSTM according to claim 1, characterized in that, The step of updating the current position of the goat population to obtain the first position of the goat population includes: For each individual goat in the goat population, if the individual goat is not in the jumping phase, an inertia weight value is calculated based on a preset weight range, the current iteration number of the improved goat optimization algorithm, and a preset maximum iteration number. The current positions of two individual goats are selected from the current positions of the goat population and differential calculation and adjustment are performed to obtain the differential position. The current position of the individual goat is updated based on the inertia weight value and the differential position to obtain the first position of the individual goat.
5. The power load forecasting method based on improved LSTM according to claim 4, characterized in that, The step of updating the current position of the individual goat based on the inertia weight value and the differential position to obtain the first position of the individual goat includes: If the goat is in the exploration phase, the current position of the goat is updated according to the inertia weight value, the differential position, and the multiple preset value ranges corresponding to the multiple hyperparameters to obtain the first position of the goat. If the goat is in the utilization stage, the preset utilization coefficient value is adjusted according to the current iteration number and the preset maximum iteration number to obtain the first utilization coefficient value; the current position of the goat is updated according to the current optimal goat position, the first utilization coefficient value, the inertia weight value and the differential position to obtain the first position of the goat.
6. A power load forecasting system based on an improved LSTM, characterized in that, The system, applied to performing the power load forecasting method based on an improved LSTM as described in any one of claims 1 to 5, comprises: The acquisition module is used to acquire the power load sequence for the current time period; The processing module is used to preprocess the power load sequence and then input it into the power load prediction model for prediction processing to obtain the predicted power load sequence for future time periods. The power load prediction model is obtained by optimizing and training a pre-built improved LSTM network model with hyperparameters. The improved LSTM network model performs fusion calculations based on the cell states in all previous time steps when performing the cell state update task.
7. An electronic device, characterized in that, The electronic device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the power load forecasting method based on the improved LSTM as described in any one of claims 1 to 5.
8. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the power load forecasting method based on the improved LSTM as described in any one of claims 1 to 5.
Citation Information
Patent Citations
ISGU hybrid model-based short-term power load prediction method and system
CN114021847A
Intelligent industrial park power load prediction method
CN118627541A