Load prediction method and system

By combining the sliding window and the image feature extraction module, the LSTM model is improved and the IPSO algorithm is used to update the weight parameters. The BILSTM and XGBoost models are integrated to solve the accuracy and convergence speed problems of the traditional load forecasting method in load fluctuation scenarios, and achieve a better High prediction accuracy and efficiency.

CN118659366APending Publication Date: 2024-09-17INFORMATION & COMM BRANCH OF STATE GRID JIANGSU ELECTRIC POWER +1
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411010334.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-26
Publication Date
2024-09-17

AI Technical Summary

Technical Problem

Traditional load forecasting methods have low prediction accuracy and slow convergence speed in scenarios with large fluctuations in electricity load, making it difficult to meet the requirements of high accuracy and high reliability.

Method used

The sliding window dynamic value is used combined with the image feature extraction module for feature processing, the LSTM model structure is improved, the IPSO algorithm is used to update the weight parameters of the BILSTM and XGBoost models, and is integrated into a load forecasting model.

Benefits of technology

It improves the accuracy and convergence speed of the load prediction model in scenarios with large load fluctuations, enhances nonlinear feature extraction capabilities, alleviates the vanishing gradient problem, and improves prediction accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118659366A
    Figure CN118659366A
Patent Text Reader

Abstract

The invention discloses a load prediction method and system, and belongs to the technical field of load prediction. According to the invention, feature processing is carried out in combination with an image feature extraction module on the basis of sliding window dynamic values, the structure of an existing LSTM model is improved, and an existing XGBoost model is trained by using a Bagging algorithm, so that the convergence speed can be accelerated, and the gradient disappearance problem can be relieved; weight parameters and bias parameters of the BILSTM model and the XGBoost model are updated by using the IPSO algorithm, and mutation operation based on a genetic algorithm is added into a disturbance function of an existing PSO algorithm in the IPSO algorithm, so that better performance can be achieved in different iteration stages, and the convergence speed and the prediction precision can be further improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of load forecasting, and in particular to a load forecasting method and system. Background Art

[0002] With the proposal of the dual carbon goals, electricity, as a clean and efficient secondary energy source, will play a more important role in supporting social and economic development, serving the people's livelihood energy needs, and building a clean, low-carbon, safe and efficient energy system. The balance of electricity supply and demand is of great significance to ensuring energy security, and to a certain extent alleviates the power supply pressure in local areas. However, the electricity load is greatly affected by weather conditions and has a certain degree of randomness and uncertainty, which poses new challenges to the electricity load forecasting. In addition, factors such as holiday types and climatic conditions will also have a certain impact on the changes in electricity load demand, increasing the nonlinearity of actual load and the difficulty of load forecasting. However, traditional load forecasting methods are insufficient in evaluating the importance of various external factors that cause load changes, and it is difficult to meet the requirements of high precision and high reliability. Therefore, the research on methods to improve the accuracy of short-term forecasting of electricity load is of great significance.

[0003] Traditional load forecasting methods use statistical models to learn the nonlinear relationship between various influencing factors and loads, but the fitting effect is poor. With the development of artificial intelligence technology, the advantages of using neural networks to establish fitting models are more obvious. Using them for short-term load forecasting, the prediction accuracy is significantly improved. With the help of accurate load forecasting, reasonable power transmission and distribution can be carried out, and the operating cost can be accurately controlled to ensure the stable operation of the power grid. Therefore, based on the continuous accumulation of predecessors, it is of great practical significance to study a high-precision short-term load forecasting model. Summary of the invention

[0004] The purpose of the present invention is to overcome the shortcomings in the prior art and provide a load forecasting method and system. On the basis of extracting time series features and taking eigenvalues, an image feature extraction module is combined to perform feature processing, and the weight parameters and bias parameters of the BILSTM model and the XGBoost model are respectively updated using the IPSO algorithm. The two updated models are integrated as a load forecasting model to make up for the problems of low prediction accuracy and slow convergence speed in scenarios with large load fluctuations.

[0005] To achieve the above object, the present invention is implemented by adopting the following technical solutions: In one aspect, the present invention provides a load forecasting method, comprising: Get the load data set; Extracting the time series characteristics of the load data set, taking characteristic values ​​of the time series characteristics multiple times according to a preset sliding step, and obtaining an input characteristic graph; Extracting features from the input feature graph, and inputting the extracted image features into a pre-built load forecasting model to obtain a load forecasting result; The construction of the load forecasting model includes: Get the original LSTM model; The input gate of the original LSTM model is deleted and the tanh activation function in the original LSTM model is replaced with a softsign activation function to obtain an ILSTM model; a bidirectional processing layer is added before the output gate of the ILSTM model to obtain a BILSTM model; Get the pre-trained XGBoost model; The weight parameters and bias parameters of the BILSTM model and the pre-trained XGBoost model are respectively updated by using the IPSO algorithm to obtain an IPSO-BILSTM model and an IPSO-XGBoost model; the determination of the IPSO algorithm includes: obtaining a PSO algorithm, and adding a mutation operation based on a genetic algorithm to a perturbation function of the PSO algorithm to obtain the IPSO algorithm; The IPSO-BILSTM model and the IPSO-XGBoost model are integrated to obtain the load forecasting model.

[0006] Optionally, the load data set includes power load data, meteorological data and holiday data; and the load data set is preprocessed.

[0007] Considering the existence of missing values ​​and outliers in the original data set, in order to avoid adverse effects on the prediction accuracy of the model, the gradient boosting decision tree algorithm is used to fill the missing values ​​in the load data set; Using the quartile method, detecting outliers in the load data set, treating the outliers as missing values, and using the gradient boosting decision tree algorithm to correct the outliers in the load data set; The tsfresh module is used to extract the time series features of the load data set, the sliding window algorithm is used to extract feature values ​​of the time series features multiple times according to a preset sliding step, and the image feature extraction module is used to extract features from the input feature map.

[0008] Optionally, in the input feature map, the i-th feature sequence is as follows: ; ; In the formula, is the value of the i-th feature sequence at the k-th moment; is the observed value of the i-th feature sequence at the k-th moment; is the value of the i-th feature sequence k moments before; t is the size of the sliding window. The load data set is dynamically valued by moving the window according to the sliding step size, and the load data set after the sliding window value is used as the input feature map. The image feature extraction module is used to automatically extract features, and finally the load forecasting model is used to obtain k+1 The load forecast value at the time.

[0009] Optionally, the ILSTM model is as follows: ; ; ; ; ; In the formula, , They are the state quantities of the forget gate and the output gate at time t respectively; is the candidate memory unit at time t; is the memory unit at time t; is the hidden layer state at time t; is the sigmoid activation function; is the forget gate weight matrix; is the output gate weight matrix; is the candidate memory unit weight matrix; is the input at time t; is the hidden state weight matrix of the forget gate; Update the weight matrix of the gate in the forget gate; is the softsign activation function; is the hidden state weight matrix of the candidate memory unit; , , They are the bias items of the forget gate, output gate, and candidate memory unit respectively; is the hidden state weight matrix of the output gate; Update the gate weight matrix in the output gate; Multiply matrices element-wise.

[0010] Optionally, the construction of the bidirectional processing layer includes: The historical time series Input the forward ILSTM layer of the ILSTM model and output the forward hidden state of each time step in the time series ; The historical time series Input the reverse ILSTM layer of the ILSTM model and output the reverse hidden state of each time step in the time series ; The forward hidden state and the reverse hidden state The bidirectional processing layer is obtained by linearly superimposing the preset weights.

[0011] Optionally, the XGBoost model is trained using a Bagging algorithm, and the formula is: ; Where n is the number of trained XGBoost sub-models; is the trained XGBoost sub-model.

[0012] Optionally, the mathematical model of the IPSO algorithm is: ; ; ; ; ; In the formula, , They represent the velocity and position of the ith particle in the dth dimension respectively; k is the number of iterations of the entire algorithm; is the inertia weight; is the best position found by the particle in the current iteration; is the global optimal position of the particle; is the fitness value of the global best position; and is a non-negative constant; and is a random number between [0, 1]; is the perturbation function; is the current iteration number; is the maximum number of iterations; is the collective behavior evaluation function in the particle group and the control function of the disturbance required for collective motion; n is the total number of particles; is the position of particle i in the jth dimension; , are the maximum and minimum values ​​of the inertia weight respectively.

[0013] The IPSO algorithm has better performance in different iteration stages: in the early stage of iteration, the solution space of particles is larger, which means that particles can more easily find better solutions; during the iteration, the perturbation function will adaptively adjust the size of the mutation according to the particle cohesion, which helps to maintain the diversity of the particle swarm; in the later stage of iteration, the particle swarm is prone to fall into the local optimum, and the perturbation function can increase the perturbation amount, thereby increasing the mutation value and helping particles jump out of the local optimum; in addition, when the algorithm is close to the global optimal solution, the mutation value can be reduced to help the algorithm converge faster.

[0014] Optionally, using the IPSO algorithm to update the weight parameters and bias parameters of the BILSTM model and the pre-trained XGBoost model respectively includes: The IPSO algorithm is used to calculate the function fitness value of each particle in the BILSTM model and the pre-trained XGBoost model, and the position and speed of each particle are updated according to the function fitness value of each particle to obtain the optimal position of each particle; The optimal position of each particle is compared to obtain the global optimal position, which is the optimal weights and parameters of the BILSTM model and the trained XGBoost model.

[0015] Optionally, the extracted image features are divided into a training set, a validation set and a test set according to a ratio of 8:1:1; Using the training set and the validation set, constructing the load forecasting model and adjusting hyperparameters; The test set is input into the constructed load forecasting model to obtain the load forecasting result, such as the formula: ; ; In the formula, is the root mean square error; is the accuracy of daily load forecast; is the actual value, is the predicted value; n is the number of predicted samples; m is the number of predicted load points per day; is the actual value of the i-th point; is the predicted value of the i-th point.

[0016] In a second aspect, the present invention provides a computer system, characterized in that it includes: Memory, for storing computer instructions; A processor is used to execute the computer instructions to implement the steps of the load forecasting method described in the first aspect.

[0017] Beneficial Effects Compared with the prior art, the present invention has the following beneficial effects: The present invention combines the image feature extraction module for feature processing on the basis of dynamic sliding window value taking, which can effectively increase the extraction capability of nonlinear features, further characterize the detailed features in the two dimensions of time and influencing factors, so that the load forecasting model can better learn the deep nonlinear relationship between features, thereby making up for the disadvantage that the traditional method has low prediction accuracy in the face of large load fluctuation scenarios; and improves the structure of the existing LSTM model and uses the Bagging algorithm to train the existing XGBoost model, which can accelerate the convergence speed and alleviate the gradient vanishing problem, and uses the IPSO algorithm to update the weights and biases of the BILSTM model and the XGBoost model, and the IPSO algorithm adds a mutation operation based on the genetic algorithm to the perturbation function of the existing PSO algorithm, which can have better performance in different iteration stages, and can further improve the convergence speed and prediction accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 Shown is a schematic flow chart of a load forecasting method of the present invention in one embodiment; Figure 2 Shown is a structural schematic diagram of the image feature extraction module of the present invention; Figure 3 Shown is a schematic structural diagram of the ILSTM model of the present invention; Figure 4 Shown is a schematic diagram of the structure of the BILSTM model of the present invention; Figure 5 Shown is a schematic diagram of the structure of the XGBoost model of the present invention; Figure 6 Shown is a schematic diagram of a power load curve containing abnormal data in one embodiment of the present invention; Figure 7 The figure shows a schematic diagram of a power load curve after abnormal value correction in one embodiment of the present invention; Figure 8 Shown is a schematic diagram of a temperature curve in one embodiment of the present invention; Fig. 9 Shown is a schematic diagram comparing load forecasting results of different load forecasting models in an embodiment of the present invention. DETAILED DESCRIPTION

[0019] The technical solution of the present invention is described in detail below through the accompanying drawings and specific embodiments. It should be understood that the embodiments of the present invention and the specific features in the embodiments are detailed descriptions of the technical solution of the present invention, rather than limitations on the technical solution of the present invention. The embodiments of the present invention and the technical features in the embodiments may be combined with each other unless there is a conflict.

[0020] The term "and / or" is only a description of the association relationship between related objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " generally indicates that the related objects are in an "or" relationship.

[0021] Example 1

[0022] like Figure 1-9 As shown, this embodiment introduces a load forecasting method, including: Acquire a load data set; and preprocess the load data set.

[0023] In order to mine more time series features and increase the nonlinear feature extraction process, the tsfresh module is used to extract the time series features of the load data set, and the sliding window algorithm is used to take characteristic values ​​of the time series features multiple times according to the preset sliding step to obtain the input feature map.

[0024] The image feature extraction module is used to automatically extract features from the input feature graph, and the extracted image features are input into a pre-built load prediction model to obtain a load prediction result. In this embodiment, the image feature extraction module may be a convolutional neural network (CNN) model.

[0025] The construction of the load forecasting model includes: Get the original LSTM model; The input gate of the original long short-term memory network (LSTM) model is deleted and the tanh activation function in the original long short-term memory network (LSTM) model is replaced with a softsign activation function, and the output value affected by the previous parameter update process is deleted through the forget gate of the long short-term memory network (LSTM) model to obtain an improved long short-term memory network (ILSTM) model; and a bidirectional processing layer is added in front of the output gate of the improved long short-term memory network (ILSTM) model to obtain a bidirectional improved long short-term memory network (BILSTM) model.

[0026] The guided aggregation (Bagging) algorithm is used to train the extreme gradient boosting decision tree (XGBoost) model to obtain a trained extreme gradient boosting decision tree (XGBoost) model.

[0027] The sample subsets randomly sampled from the extracted image features are input into the extreme gradient boosting decision tree (XGBoost) model to obtain a trained extreme gradient boosting decision tree (XGBoost) sub-model corresponding to each sample subset, and the average value of the trained extreme gradient boosting decision tree (XGBoost) sub-models is used as the trained extreme gradient boosting decision tree (XGBoost) model.

[0028] The improved particle swarm optimization (IPSO) algorithm is used to respectively update the weight parameters and bias parameters of the bidirectional improved long short-term memory network (BILSTM) model and the pre-trained extreme gradient boosting decision tree (XGBoost) model to obtain a particle swarm optimization bidirectional improved long short-term memory network (IPSO-BILSTM) model and a particle swarm optimization extreme gradient boosting decision tree (IPSO-XGBoost) model; the determination of the improved particle swarm optimization (IPSO) algorithm includes: obtaining a particle swarm optimization (PSO) algorithm, and adding a mutation operation based on a genetic algorithm to a perturbation function of the particle swarm optimization (PSO) algorithm to obtain the improved particle swarm optimization (IPSO) algorithm.

[0029] The load forecasting model is obtained by integrating the particle swarm optimization bidirectional improved long short-term memory network (IPSO-BILSTM) model and the particle swarm optimization extreme gradient boosting decision tree (IPSO-XGBoost) model.

[0030] When this embodiment is applied, the present invention can effectively increase the ability to extract nonlinear features by combining the image feature extraction module for feature processing based on the dynamic value of the sliding window, further characterize the detailed features in the two dimensions of time and influencing factors, so that the prediction model can better learn the deep nonlinear relationship between features, thereby compensating for the shortcomings of traditional methods in the face of large load fluctuations. The disadvantage is that the prediction accuracy is not high; and the structure of the existing LSTM model is improved and the existing XGBoost model is trained with the Bagging algorithm, which can speed up the convergence speed and alleviate the gradient vanishing problem. The weights and biases of the BILSTM model and the XGBoost model are updated with the IPSO algorithm, which can further improve the convergence speed and prediction accuracy.

[0031] Example 2

[0032] like Figure 1 As shown, based on Example 1, this example introduces the specific process of the load forecasting method.

[0033] Acquire a load data set; and preprocess the load data set.

[0034] The load data set includes power load data, meteorological data and holiday data. In this embodiment, the power load data and meteorological data are obtained through the State Grid, and the holiday data are obtained through the network. All data are integrated to form the load data set.

[0035] Taking into account the existence of missing values ​​and outliers in the load data set, in order to avoid adverse effects on the prediction accuracy of the model, the boosted decision tree algorithm is used to fill the missing values; when the boosted decision tree algorithm is used to fill the missing data, the data set without missing values ​​is used as the sample set for model training, and the missing data is filled based on the results of the boosted decision tree model.

[0036] First, the number of missing values ​​of each feature in the load data set is counted, and the missing values ​​are first assigned in a traditional way (such as using the mode or mean to fill the missing values). In one embodiment, a data set containing n features, wherein feature T has missing values, feature T is used as a label, and the remaining n-1 features and the original labels form a new feature matrix, wherein the other n-1 features corresponding to the non-missing values ​​of feature T and the original labels are used as x_train, the other n-1 features corresponding to the missing values ​​and the original labels are used as x_test, the part of feature T without missing values ​​is y_train, and the missing part of feature T is y_test. The decision tree model is trained and improved using the composed training set, and the missing values ​​are predicted using the test set, and the predicted values ​​are used as the filling values ​​to fill the missing data. After each regression prediction is completed, the predicted values ​​are placed in the original feature matrix, and then the next feature is filled, and all features are traversed and filled until the data is complete.

[0037] The load data set is tested for outliers using the quartile method, and then the outliers are taken as missing values, and the missing values ​​are corrected using the boosted decision tree algorithm. , , represent the upper quartile, median, and lower quartile, respectively. represents the interquartile range, i.e. .

[0038] Determined as an outlier The conditions are: ; Finally, in order to avoid the adverse effects of different dimensions of each feature quantity on the model training effect, the corrected data is normalized and the min-max method is used for data normalization. The calculation formula is: ; In the formula, Features i No.k The original value of samples; , Characteristics i The minimum and maximum values ​​in Features i No. k The normalized value of the samples.

[0039] In order to increase the nonlinear feature extraction process, the tsfresh module is used to extract the time series features of the load data set, and the sliding window algorithm is used to take characteristic values ​​of the time series features multiple times according to a preset sliding step to obtain an input feature map.

[0040] The sliding window is used to take values ​​of the time series features in the time dimension and feature dimension of the data set according to the preset sliding step multiple times. The size of the data set dimension is ( n features, and the length of each feature sequence is m ), in the input feature map, i The feature sequences are: ; by k The time is the current time, i Before feature t The time is: ; In the formula, is the value of the i-th feature sequence at the k-th moment; is the observed value of the i-th feature sequence at the k-th moment; t is the size of the sliding window.

[0041] In this embodiment, the sliding window is moved to take values ​​of the time series features multiple times according to the sliding step size, and the data set after the sliding window is taken is used as the input feature map. The image feature extraction module is used to automatically extract features, and finally the load forecasting model is used to obtain the k+1 The load forecast value at the time.

[0042] In order to further enhance the extraction process of nonlinear features, an image feature extraction module is used to automatically extract features from the input feature map. The image feature extraction module can use a convolutional neural network model, and its structural diagram is shown in FIG. Figure 2 shown.

[0043] The feature extraction process of the image feature extraction module mainly includes two steps: convolution and pooling. The output of the convolution layer can be expressed as: ; In the formula, is the output sequence of the convolution layer; is the sigmoid activation function; M is the number of input feature maps; For the first layer j Feature sequence mapping; For the j The convolution kernel and i The convolution kernel size of the input feature sequence map for convolution; is the bias term.

[0044] The convolution output layer When input to the pooling layer, it is used to improve the robustness of the extracted features, while reducing the amount of redundant features, retaining the main features of the load forecast data, and reducing the calculation parameters to achieve dimensionality reduction, prevent overfitting, and thus improve the generalization ability of the model. The pooling layer is most commonly used in average pooling and maximum pooling. Taking maximum pooling as an example, its output mathematical expression is: ; In the formula, r represents the pooling domain; Indicates the first layer j Pooling results. Assume that the convolutional layer outputs is an n-dimensional column vector, extracted by maximum pooling After the maximum pooling, the original n-dimensional data is compressed into After that, the redundancy of the data is reduced, and the input data of the prediction layer becomes less, thereby reducing the amount of calculation during the data propagation process and reducing the risk of overfitting in the training network.

[0045] The extracted features are input into the pre-built load forecasting model to obtain the load forecasting results.

[0046] The construction of the load forecasting model includes: Get the original LSTM model.

[0047] The input gate of the original LSTM model is deleted and the tanh activation function in the original LSTM model is replaced with a softsign activation function, and the output value affected by the previous parameter update process is deleted through the forget gate of the LSTM model to obtain the ILSTM model.

[0048] The ILSTM model is obtained by further simplifying and improving the standard LSTM model structure, which includes: First, remove the input gate of LSTM to reduce the computation time when inputting data and further speed up the convergence speed; Secondly, the tanh activation function is changed to the softsign function. The activation function curve is flatter and the derivative decreases more slowly, which can further alleviate the gradient vanishing problem. Finally, the output value affected by the previous parameter update process is removed through the forget gate to obtain the ILSTM model.

[0049] like Figure 3 As shown, the ILSTM model is as follows: ; ; ; ; ; In the formula, , They are the state quantities of the forget gate and the output gate at time t respectively; is the candidate memory unit at time t; is the memory unit at time t; is the hidden layer state at time t; is the sigmoid activation function; is the forget gate weight matrix; is the output gate weight matrix; is the candidate memory unit weight matrix; is the input at time t; is the hidden state weight matrix of the forget gate; Update the weight matrix of the gate in the forget gate; is the softsign activation function; is the hidden state weight matrix of the candidate memory unit; , , They are the bias items of the forget gate, output gate, and candidate memory unit respectively; is the hidden state weight matrix of the output gate; Update the gate weight matrix in the output gate; Multiply matrices element-wise.

[0050] The ILSTM network structure obtained above is further improved to BILSTM on this basis. By adding a bidirectional processing layer before the output gate of the ILSTM model, a BILSTM model is obtained. The BILSTM structure is as follows Figure 4 shown.

[0051] The bidirectional processing layer can consider both the forward and reverse information of the time series data, so as to capture the context information of the time series data. The construction of the bidirectional processing layer includes: The historical time series Input the forward ILSTM layer of the ILSTM model and output the forward hidden state of each time step in the time series ; The historical time series Input the reverse ILSTM layer of the ILSTM model and output the reverse hidden state of each time step in the time series ; The forward hidden state and the reverse hidden state The bidirectional processing layer is obtained by linearly superimposing the preset weights.

[0052] Based on the standard XGBoost model, the Bagging algorithm is used for training, and sample subsets are obtained by random sampling from the extracted image features. Then each XGBoost sub-model is trained based on the sample subset, and finally the average of each model result is taken as the output. Figure 5 As shown, the XGBoost model is trained using the Bagging algorithm, and the formula is: ; Where n is the number of trained XGBoost sub-models; is the trained XGBoost sub-model.

[0053] On the basis of the above, the IPSO algorithm is used to update the weight parameters and bias parameters of the BILSTM model and the pre-trained XGBoost model respectively to obtain the IPSO-BILSTM model and the IPSO-XGBoost model.

[0054] The IPSO algorithm is used to calculate the function fitness value of each particle in the BILSTM model and the pre-trained XGBoost model, and the position and speed of each particle are updated according to the function fitness value of each particle to obtain the optimal position of each particle.

[0055] The optimal position of each particle is compared to obtain the global optimal position, which is the optimal weights and parameters of the BILSTM model and the trained XGBoost model.

[0056] In this embodiment, the IPSO algorithm is an optimized particle swarm PSO algorithm with genetic algorithm mutation operation, which is a search algorithm that simulates bird flocks foraging. During the search process, each bird will adjust its flight direction and position based on its own experience (i.e., the best position it has found) and the experience of other birds (i.e., the best position found in the entire group). In this way, the flock of birds keeps moving in the solution space and gradually approaches the optimal solution.

[0057] In the implementation of genetic algorithms, mutation operations are usually performed together with selection operations and crossover operations. First, individuals with higher fitness are selected from the current population as parents through selection operations; then, offspring individuals are generated through crossover operations; finally, offspring individuals are randomly changed through mutation operations to generate new individuals. These new individuals will replace some of the old individuals in the population, forming a new population, and continue the next round of iteration process.

[0058] The mathematical model of the IPSO algorithm is: ; On the right side of the equation, the value of the first part will determine the impact of the last speed and direction, the second part represents the part of the particle's action that comes from its own experience, and the third part reflects the cooperation and information sharing between particles.

[0059] ; ; ; ; In the formula, , They represent the velocity and position of the ith particle in the dth dimension respectively; k is the number of iterations of the entire algorithm; is the inertia weight; is the best position found by the particle in the current iteration; is the global optimal position of the particle; is the fitness value of the global best position; and is a non-negative constant; and is a random number between [0, 1]; is the perturbation function; is the current iteration number; is the maximum number of iterations; is the collective behavior evaluation function in the particle group and the control function of the disturbance required for collective motion. The more dispersed the particles are, The larger the value of , the smaller the disturbance amount needs to be, and the more particles are aggregated. The smaller the value, the greater the disturbance required; n is the total number of particles; is the position of particle i in the jth dimension; , They are the maximum and minimum values ​​of the inertia weight respectively, and the dynamic change of the inertia weight is realized by combining the current number of iterations and the maximum number of iterations.

[0060] Compared with the fixed value in PSO optimization particle swarm algorithm, dynamic It can obtain better optimization results than fixed values. , the global optimization ability and local optimization ability of the algorithm are different. The larger it is, the stronger the global optimization ability is, and the weaker the local optimization ability is. The smaller the value, the opposite is true. The optimization ability of the algorithm can be improved at different stages of the PSO optimization particle swarm algorithm.

[0061] The adjusted IPSO algorithm has better performance in different iteration stages: In the early stages of iteration, the solution space of particles is larger, which means that particles can more easily find better solutions. During the iteration, the perturbation function will adaptively adjust the size of the mutation according to the particle cohesion, which helps to maintain the diversity of the particle swarm. In the later stages of iteration, the particle swarm is prone to fall into the local optimum. The perturbation function can increase the perturbation amount, thereby increasing the mutation value and helping particles jump out of the local optimum. In addition, when the algorithm is close to the global optimal solution, the mutation value can be reduced to help the algorithm converge faster.

[0062] The IPSO-BILSTM model and the IPSO-XGBoost model are integrated to obtain the load forecasting model.

[0063] The integration method of the IPSO-BILSTM model and the IPSO-XGBoost model refers to the Boosting integration method, specifically: First, the IPSO-BILSTM model is used to obtain the prediction results and residuals. Then, the IPSO-XGBoost model is used to model the residuals, and the residuals after modeling by the IPSO-BILSTM model are used as the new target variable.

[0064] The target variable and the predicted value of the IPSO-BILSTM model are used as input features and input into the IPSO-XGBoost model for training to obtain the sum of the predicted value of the IPSO-BILSTM model and the adjusted value of the IPSO-XGBoost model, which is the final prediction result, that is, the load forecasting model.

[0065] The extracted features are divided into training set, validation set and test set according to the ratio of 8:1:1.

[0066] The load forecasting model is constructed and hyperparameters are adjusted using the training set and the validation set.

[0067] The test set is input into the constructed load forecasting model to obtain the load forecasting result, such as the formula: ; ; In the formula, is the root mean square error; is the accuracy of daily load forecast; is the actual value, is the predicted value; n is the number of predicted samples; m is the number of predicted load points per day; is the actual value of the i-th point; is the predicted value of the i-th point.

[0068] In this embodiment, the prediction results of the load prediction model are evaluated using the root mean square error and the daily load prediction accuracy, and a comparative analysis is performed with multiple comparison algorithms to verify the effectiveness and accuracy of the load prediction method.

[0069] Example 3 like Figure 6-9 As shown, this embodiment introduces an experimental example of a load forecasting method.

[0070] The data used in this embodiment are power load data and weather data of the State Grid Zhenjiang area.

[0071] The load data sampling period is from January 16, 2023 to January 20, 2024, with a time resolution of 15 minutes, and a total of 35,521 data items. The weather data includes 10 features: irradiance, temperature, relative humidity, atmospheric pressure, wind speed, wind direction, cloud cover, body sensation, weather conditions, and rainfall.

[0072] After obtaining the data, preprocess the data, such as Figure 6 As shown in the figure, the data set contains missing values, so the data is corrected for outliers. The original data contains abnormal data with small values, so the quartile method is used to detect and correct the data for outliers. At the same time, the weather data is also detected and corrected. Taking the temperature as an example, Figure 8 A temperature curve is given. After testing, the data does not contain abnormal data. Similarly, other features do not contain abnormal data. Therefore, the data is directly normalized and dynamically valued using a sliding window. In order to be able to predict the load of the next day in time, the prediction frequency is set to 15 minutes, that is, 96 load nodes of the next day are predicted on the same day. Therefore, the sliding window size is set to 96, and the sliding step is 1. The data after sliding value is input into the convolutional neural network (CNN) as a feature map for further feature extraction.

[0073] Then, a load forecasting model was constructed. The load forecasting model was the integration result of the IPSO-BILSTM model and the IPSO-XGBoost model. The main parameters of the model were set as follows: the number of CNN convolution kernels was 16, the convolution kernel size was 3×3, and the batch size was 32. The number of hidden layers of the standard LSTM was set to 2, the number of neurons was 32 and 64 respectively, the learning rate was 0.01, the number of iterations was 100, and other parameters were set to the default size. The number of trees was 62, the learning rate was 0.08, and the depth was 45. The number of ensembles was 8, and other parameters were set to the default size.

[0074] The load forecasting model of this embodiment is compared with the LSTM, ILSTM, XGBoost, and CNN-ILSTM models. The weights and biases of other models are updated using the Adam optimizer. At the same time, in order to objectively evaluate the prediction accuracy of the model and avoid the influence of accidental errors, 10 prediction experiments are uniformly carried out for each prediction situation. The average value of the 10 experimental prediction values ​​is taken as the final prediction value, and the error calculation and analysis are performed with the true value. The prediction evaluation index values ​​of the test sets of each model are obtained as shown in Table 1. The comparison of the prediction effects is shown in Fig. 9 shown.

[0075] Table 1 Comparison of prediction errors of various models Model <![CDATA[R MSE (KW)]]> Daily load forecast accuracy Training time(s) LSTM 8.05 0.8244 220 ILSTM 7.67 0.8539 221 CNN-ILSTM 7.21 0.8711 199 XGBoost 6.53 0.8942 252 Load Forecasting Model 4.42 0.9514 234 from Figure 7 It can be seen that the uncertainty of power load is greater, which comes from the uncertainty of user power demand. The load forecast results of all models for the next day are basically consistent with the actual curve change trend. Combined with Table 1, it can be seen that the load forecasting model in this embodiment has the smallest forecast error compared with the other five models, which shows the effectiveness of the load forecasting method in this embodiment. Although the training time is relatively long, it has higher accuracy in terms of forecasting effect.

[0076] By comparing the LSTM and ILSTM models, the ILSTM is reduced and the training time of ILSTM is also less, which means that removing the input gate can further accelerate the convergence speed and has better generalization performance on the test set, proving the effectiveness of the improvement on LSTM.

[0077] By comparing the CNN-ILSTM and ILSTM models, it can be seen that by further extracting deep nonlinear features through CNN, the subsequent prediction layer can learn more detailed features in terms of time and influencing factors, thereby improving the prediction accuracy of the model in scenarios with large load fluctuations.

[0078] Finally, by comparing the prediction effects of the load forecasting model of this embodiment with the CNN-ILSTM model, it can be seen that the model training time is reduced and the prediction error is further reduced, indicating that the use of the IPSO algorithm to update the weights and biases can effectively accelerate the convergence speed and improve the prediction accuracy. Compared with Adam, while ensuring a certain prediction accuracy, it reduces the training time and improves the prediction accuracy, verifying the effectiveness of the proposed method.

[0079] In summary, the load forecasting method of this embodiment is optimal in terms of forecast error, which fully verifies the effectiveness of the load forecasting method of this embodiment and has high forecast accuracy.

[0080] Example 4 This embodiment introduces a computer system, including: Memory, for storing computer instructions; A processor is used to execute the computer instructions to implement the steps of the load forecasting method described in Example 1, 2 or 3.

[0081] Example 5 This embodiment introduces a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the load forecasting method described in Embodiment 1, 2 or 3 are implemented.

[0082] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0083] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0084] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0085] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0086] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the enlightenment of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the purpose of the present invention and the claims, which all fall within the protection of the present invention.

Claims

1. A load forecasting method, characterized in that: include: Get the load data set; Extracting the time series characteristics of the load data set, taking characteristic values ​​of the time series characteristics multiple times according to a preset sliding step, and obtaining an input characteristic graph; Extracting features from the input feature graph, and inputting the extracted image features into a pre-built load forecasting model to obtain a load forecasting result; The construction of the load forecasting model includes: Get the original LSTM model; The input gate of the original LSTM model is deleted and the tanh activation function in the original LSTM model is replaced with a softsign activation function to obtain an ILSTM model; a bidirectional processing layer is added before the output gate of the ILSTM model to obtain a BILSTM model; Get the pre-trained XGBoost model; The weight parameters and bias parameters of the BILSTM model and the pre-trained XGBoost model are respectively updated by using the IPSO algorithm to obtain an IPSO-BILSTM model and an IPSO-XGBoost model; the determination of the IPSO algorithm includes: obtaining a PSO algorithm, and adding a mutation operation based on a genetic algorithm to a perturbation function of the PSO algorithm to obtain the IPSO algorithm; The IPSO-BILSTM model and the IPSO-XGBoost model are integrated to obtain the load forecasting model.

2. The load forecasting method according to claim 1, characterized in that: The load data set includes power load data, meteorological data and holiday data; Filling missing values ​​in the load data set using a gradient boosting decision tree algorithm; Using the quartile method, detecting outliers in the load data set, treating the outliers as missing values, and using the gradient boosting decision tree algorithm to correct the outliers in the load data set; The tsfresh module is used to extract the time series features of the load data set, the sliding window algorithm is used to extract feature values ​​of the time series features multiple times according to a preset sliding step, and the image feature extraction module is used to extract features from the input feature map.

3. The load forecasting method according to claim 1, characterized in that: In the input feature map, the i-th feature sequence is as follows: ; ; In the formula, is the value of the i-th feature sequence at the k-th moment; is the observed value of the i-th feature sequence at the k-th moment; is the value of the i-th feature sequence k moments before; t is the size of the sliding window.

4. The load forecasting method according to claim 1, characterized in that: The ILSTM model is as follows: ; ; ; ; ; In the formula, , They are the state quantities of the forget gate and the output gate at time t respectively; is the candidate memory unit at time t; is the memory unit at time t; is the hidden layer state at time t; is the sigmoid activation function; is the forget gate weight matrix; is the output gate weight matrix; is the candidate memory unit weight matrix; is the input at time t; is the hidden state weight matrix of the forget gate; Update the weight matrix of the gate in the forget gate; is the softsign activation function; is the hidden state weight matrix of the candidate memory unit; , , They are the bias items of the forget gate, output gate, and candidate memory unit respectively; is the hidden state weight matrix of the output gate; Update the gate weight matrix in the output gate; Multiply matrices element-wise.

5. The load forecasting method according to claim 4, characterized in that: The construction of the bidirectional processing layer includes: The historical time series Input the forward ILSTM layer of the ILSTM model and output the forward hidden state of each time step in the time series ; The historical time series Input the reverse ILSTM layer of the ILSTM model and output the reverse hidden state of each time step in the time series ; The forward hidden state and the reverse hidden state The bidirectional processing layer is obtained by linearly superimposing the preset weights.

6. The load forecasting method according to claim 1, characterized in that: The XGBoost model is trained using the Bagging algorithm, and the formula is: ; Where n is the number of trained XGBoost sub-models; is the trained XGBoost sub-model.

7. The load forecasting method according to claim 1, characterized in that: The mathematical model of the IPSO algorithm is: ; ; ; ; ; In the formula, , They represent the velocity and position of the ith particle in the dth dimension respectively; k is the number of iterations of the entire algorithm; is the inertia weight; is the best position found by the particle in the current iteration; is the global optimal position of the particle; is the fitness value of the global best position; and is a non-negative constant; and is a random number between [0, 1]; is the perturbation function; is the current iteration number; is the maximum number of iterations; is the collective behavior evaluation function in the particle group and the control function of the disturbance required for collective motion; n is the total number of particles; is the position of particle i in the jth dimension; , are the maximum and minimum values ​​of the inertia weight respectively.

8. The load forecasting method according to claim 7, characterized in that: Using the IPSO algorithm to update the weight parameters and bias parameters of the BILSTM model and the pre-trained XGBoost model respectively includes: The IPSO algorithm is used to calculate the function fitness value of each particle in the BILSTM model and the pre-trained XGBoost model, and the position and speed of each particle are updated according to the function fitness value of each particle to obtain the optimal position of each particle; The optimal position of each particle is compared to obtain the global optimal position, which is the optimal weights and parameters of the BILSTM model and the trained XGBoost model.

9. The load forecasting method according to claim 1, characterized in that: The extracted image features are divided into a training set, a validation set and a test set according to an 8:1:1 ratio; Using the training set and the validation set, constructing the load forecasting model and adjusting hyperparameters; The test set is input into the constructed load forecasting model to obtain the load forecasting result, such as the formula: ; ; In the formula, is the root mean square error; is the accuracy of daily load forecast; is the actual value, is the predicted value; n is the number of predicted samples; m is the number of predicted load points per day; is the actual value of the i-th point; is the predicted value of the i-th point.

10. A computer system, characterized in that: include: Memory, for storing computer instructions; A processor, configured to execute the computer instructions to implement the steps of the load forecasting method according to any one of claims 1 to 9.

Citation Information

Cited By

  • Load prediction method and device, storage medium and computer equipment

    CN120524211A