Load forecasting method based on improved whale algorithm and neural network

By improving the whale optimization algorithm, balancing global search and local development, increasing population diversity and leader updates, the problems of difficulty in selecting hyperparameters and low model performance in the existing technology are solved, and more efficient load prediction model performance and accuracy are achieved.

CN115271150BActive Publication Date: 2025-05-06NANJING UNIV OF SCI & TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210545126.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-19
Publication Date
2025-05-06
Estimated Expiration
2042-05-19

AI Technical Summary

Technical Problem

The existing whale optimization algorithms have problems such as uneven distribution of global search and local development, insufficient late development capabilities, low leader update frequency and low initial population diversity in load prediction, which makes it difficult to obtain optimal hyperparameters, reducing the performance and accuracy of the load prediction model.

Method used

By improving the whale algorithm, nonlinear convergence factors are used to balance global search and local development, adaptive weights and random differential variations are added, population diversity is increased, and the number of leaders is increased through random perturbations, simplifying hyperparameter selection.

Benefits of technology

The improved whale algorithm simplifies hyperparameter selection, improves the generalization ability and performance of the load prediction model, reduces prediction errors, and enhances the accuracy and stability of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115271150B_ABST
    Figure CN115271150B_ABST
Patent Text Reader

Abstract

The present invention discloses a load forecasting method based on an improved whale algorithm and a neural network, which includes: using a neural network loss function as an objective function of the improved whale algorithm, recording a hyperparameter as a population characteristic of the improved whale algorithm, and establishing a hyperparameter selection model; using a nonlinear convergence factor to balance the global search and local development of the whale optimization algorithm; adding adaptive weights to the update formulas for encircling prey and spiral motion and adding random differential mutations to population updates to improve the late development capability of the whale optimization algorithm; adding random perturbations to the leader to improve the algorithm accuracy; using reverse learning and quasi-reverse learning to increase population diversity; using optimal hyperparameters to establish a prediction model for load forecasting. The present invention can simplify the hyperparameter selection method, improve the performance of the whale optimization algorithm, increase the accuracy and generalization ability of the load forecasting model built by the neural network, further improve the load forecasting accuracy, and help power plants better formulate power generation plans and dispatch centers to arrange dispatch more reasonably.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field related to load forecasting, and in particular to a load forecasting method based on an improved whale algorithm and a neural network. Background Art

[0002] In the context of smart grids, accurate load forecasting can help power plants formulate power generation plans and dispatch centers arrange dispatching. Neural networks are widely used in load forecasting because of their high nonlinear fitting ability. The load forecasting model established by them is affected by its hyperparameters. Since there are many forms of hyperparameters, they are generally selected in a compromise manner, making it difficult to establish an optimal model. The whale optimization algorithm is a heuristic algorithm that can be used to assist in the selection of hyperparameters. However, due to the problems of uneven distribution of global search and local development, insufficient late development capabilities, low leader update frequency, and low initial population diversity in the whale optimization algorithm, it is difficult to obtain the optimal hyperparameters, which in turn reduces the performance of the load forecasting model and increases the error of load forecasting. Summary of the invention

[0003] The object of the present invention is to provide a load forecasting method based on an improved whale algorithm and a neural network.

[0004] The technical solution to achieve the purpose of the present invention is as follows: In the first aspect, the present invention provides a load forecasting method based on an improved whale algorithm and a neural network, comprising the following steps:

[0005] Step 1: Determine the objective function and population characteristics, use the mean square error of the load as the objective function of the improved whale algorithm, and use the hyperparameters as population characteristics;

[0006] Step 2: Initialize the population using reverse learning and quasi-reverse learning;

[0007] Step 3: Update the leader, record the mean square error of the load as the fitness, record the hyperparameter with the smallest fitness in the population as the leader, add random perturbations to it, generate a pseudo leader, compare the fitness of the pseudo leader and the leader, and take the smaller one as the leader;

[0008] Step 4: Add random disturbances to encircle the prey and spiral motion, determine the update method, update the hyperparameters according to the mean square error of the load, add random differential mutations to the population, and update the population;

[0009] Step 5: Repeat steps 3 and 4 until the iteration ends, and consider the leader of the last iteration as the optimal hyperparameter;

[0010] Step 6: Use the optimal hyperparameters to establish a load forecasting model and perform load forecasting.

[0011] In a second aspect, the present invention provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method described in the first aspect when executing the program.

[0012] In a third aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method described in the first aspect.

[0013] Compared with the prior art, the beneficial effects of the present invention are: (1) it simplifies the selection of hyperparameters and improves the generalization ability of the load forecasting model; (2) it optimizes the allocation of global search and local development of the whale optimization algorithm, so that it adjusts the proportion of global search and local development according to the error form of the load; (3) it improves the local development ability of the whale optimization algorithm in the later stage, induces the whale optimization algorithm to jump out of the local optimum, and enhances the performance of the load forecasting model; (4) compared with the general selection method, the improved whale algorithm avoids the load forecasting model error caused by the compromise selection of hyperparameters; (5) compared with the whale algorithm, the improved whale algorithm has stronger convergence ability and optimization ability, is easy to select hyperparameters suitable for modeling, and more effectively assists the neural network to establish a load forecasting model; (6) the load forecasting accuracy is further improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] Figure 1 It is a flowchart for improving the whale algorithm to find hyperparameters.

[0015] Figure 2 It is the loss function curve of the model built by different methods.

[0016] Figure 3 is the load forecast error curve. DETAILED DESCRIPTION

[0017] To overcome the shortcomings of the above problems, the present invention uses a nonlinear convergence factor to balance the global search and local development of the whale optimization algorithm; adds adaptive weights to the update formulas of encircling prey and spiral motion, and adds random differential mutation to population update to improve the late development capability of the whale optimization algorithm; adds random perturbations to the leader to increase the number of leader updates; uses quasi-reverse learning and reverse learning to increase population diversity; and uses optimal hyperparameters to establish a load forecasting model for load forecasting.

[0018] The present invention is further described below using the accompanying drawings and actual examples. It should be understood that this embodiment is only used to illustrate the present invention and is not used to limit the scope of use of the present invention.

[0019] A load forecasting method based on improved whale algorithm and neural network includes the following steps:

[0020] Step 1: Determine the objective function and population characteristics, including:

[0021] The mean square error of the load is used as the objective function of the improved whale algorithm:

[0022]

[0023] Where: F represents the mean square error of the load; n represents the number of load sampling points; y i They represent the predicted value and true value of the load at time i respectively.

[0024] Taking the hyperparameters as individual whales and considering the general hyperparameter selection method, the constraints on the hyperparameters are as follows:

[0025]

[0026] Where: B i and E i represents the lower and upper bounds of the hyperparameters, i=1,2,3,4; l represents the learning rate; iter represents the number of iterations of the neural network; h1 and h2 represent the number of neurons in the first and second hidden layers of the neural network, respectively.

[0027] Step 2: Initialize the population; specifically:

[0028] Use reverse learning and quasi-reverse learning to increase population diversity.

[0029] 1) Reverse learning

[0030]

[0031] Where: and Represents the lower and upper bounds of the hyperparameters; represents the i-th group of hyperparameters; express The reverse solution of .

[0032] 2) Quasi-reverse learning

[0033]

[0034] Where: Avg represents the median; rand represents the random value between two vector features; express The quasi-reverse solution of .

[0035] Step 3: Update the leader; specifically:

[0036] The hyperparameter that minimizes the mean square error of the load in the population is selected as the leader. Considering that the leader update frequency is not high, random perturbations are added to the leader:

[0037]

[0038] Where: and represents the leader before and after the disturbance; ε represents the disturbance coefficient, which is used to adjust the disturbance space and its value is 0.01; r and p represent random numbers in the interval [0,1].

[0039] Step 4: Determine the update method and update the population; specifically:

[0040] Use a nonlinear convergence factor to balance global search and local exploitation in the whale optimization algorithm:

[0041]

[0042]

[0043] Where: v represents the adjustment coefficient, which is used to adjust the curve shape, and the adjustment range is [1.5, 4]; T represents the maximum number of iterations of the improved whale algorithm; t represents the number of iterations of the improved whale algorithm; T c Indicates segmentation point.

[0044] Use adaptive weights to enhance late local development:

[0045]

[0046] Where: w s and w e They represent the initial weight and final weight respectively; k represents the control factor, which controls the smoothness of the curve.

[0047] Improved update formula:

[0048]

[0049]

[0050] Where: w represents the adaptive weight; and represents the update step size of encircling the prey and spiral motion; A is the function of the convergence factor a, and its value range is [-a, a]; b represents the spiral shape constant; l represents a random number in [-1, 1].

[0051] When selecting the update method, there is a 50% probability of using spiral motion to update the hyperparameters. If spiral motion is not selected, choose to surround the prey or search for prey according to |A|. When |A| < 1, surround the prey; when |A| ≥ 1, search for prey.

[0052] Use random difference mutation to enhance late local development:

[0053]

[0054]

[0055] Where: represents a random hyperparameter.

[0056] Step 5: Get the optimal hyperparameters; specifically:

[0057] Repeat steps 3 and 4 until the iteration ends, and record the leader at this time as the optimal hyperparameter.

[0058] Step 6: Load forecasting; specifically:

[0059] The load forecasting model is established using the optimal hyperparameters. The model input is the predicted load of the previous day and the temperature and weather of the predicted day, and the output is the predicted load of the predicted day.

[0060] The technical solution of the present invention is described in detail below through the drawings and embodiments.

[0061] Example

[0062] like Figure 1 As shown, considering the urban load forecasting problem, the improved whale algorithm is used to find the optimal hyperparameters, solve the model performance, and verify the optimization strategy of the present invention.

[0063] In the embodiment of the present invention, it is assumed that the neural network has two hidden layers, the population number of the improved whale algorithm is 20, the number of iterations is 30, the population characteristics are the learning rate, the number of neural network iterations, the number of neurons in the first hidden layer and the number of neurons in the second hidden layer, and one year of data is used to establish a model to predict the load for the next day.

[0064] When using a bidirectional long short-term memory neural network, different methods are used to find hyperparameters to build a model and calculate the model performance:

[0065] Case 1: The improved whale algorithm proposed in this invention;

[0066] Case 2: Whale optimization algorithm;

[0067] Case 3: General selection method;

[0068] The hyperparameters found by using the improved whale algorithm, whale optimization algorithm and general selection method are shown in Table 1;

[0069] Table 1 Hyperparameters

[0070]

[0071] The model performance is calculated and the results are shown in Table 2. The loss function of the model is established as follows Figure 2 As shown;

[0072] Table 2 Results analysis in different scenarios

[0073]

[0074] according to Figure 2 Analyze the optimization results, according to Figure 3 By analyzing the prediction results and comparing the prediction errors under different scenarios in Table 2, we can draw the following conclusions:

[0075] (1) The loss of Case 2 and Case 3 validation sets has sudden increases and large fluctuations, and the generalization of the built prediction model is low. Therefore, the whale optimization algorithm and the general selection method did not obtain the optimal hyperparameters;

[0076] (2) The prediction results of Case 2 and Case 3 are worse than those of Case 1, so Case 1 improves the prediction accuracy.

[0077] (3) The mean absolute percentage errors of Case 2 and Case 3 are larger than that of Case 1, so Case 1 has the lowest prediction deviation;

[0078] (4) The root mean square errors of Case 2 and Case 3 are larger than that of Case 1, so Case 1 has the smallest prediction deviation;

[0079] (5) The mean absolute errors of Case 2 and Case 3 are larger than that of Case 1, so Case 1 has the highest prediction accuracy;

[0080] (6) Comprehensive multiple factors show that in load forecasting, the proposed hyperparameter selection method can find the optimal hyperparameters accurately and quickly by improving the whale algorithm, further improving the performance of the load forecasting model built by the neural network, thereby improving the accuracy of load forecasting. Compared with the whale optimization algorithm, the average absolute percentage error is reduced by 9.176%, the root mean square error is reduced by 2.262%, and the average absolute error is reduced by 8.860%. Compared with the general selection method, the average absolute percentage error is reduced by 7.063%, the root mean square error is reduced by 3.582%, and the average absolute error is reduced by 7.224%. Therefore, it provides better guarantee for power plants to formulate power generation plans and dispatch centers to arrange dispatch.

[0081] The above discussion is only an embodiment of the present invention. Any equivalent transformation made on the basis of the present invention is included in the patent protection scope of the present invention.

Claims

1. A load forecasting method based on improved whale algorithm and neural network, characterized in that: The following steps are involved: Step 1: Determine the objective function and population characteristics, use the mean square error of the load as the objective function of the improved whale algorithm, and use the hyperparameters as population characteristics, specifically: The mean square error of the load is used as the objective function of the improved whale algorithm: Where: F represents the mean square error of the load; n represents the number of load sampling points; y i Respectively represent the predicted value and true value of the load at time i; Taking the hyperparameters as population characteristics, the constraints on the hyperparameters are as follows: Where: B i and E i represents the lower and upper bounds of the hyperparameters, i = 1, 2, 3, 4; l represents the learning rate; iter represents the number of iterations of the neural network; h1 and h2 represent the number of neurons in the first and second hidden layers of the neural network respectively; Step 2: Initialize the population using reverse learning and quasi-reverse learning, specifically: 1) Reverse learning Where: and Represents the lower and upper bounds of the hyperparameters; represents the i-th group of hyperparameters; express The reverse solution of ; 2) Quasi-reverse learning Where: Avg represents the median; rand represents the random value between two vector features; express The quasi-reverse solution of Step 3: Update the leader, record the mean square error of the load as fitness, record the hyperparameter with the smallest fitness in the population as the leader, add random perturbations to it, generate a pseudo leader, compare the fitness of the pseudo leader and the leader, and take the smaller one as the leader; the updating of the leader specifically includes: The hyperparameter that minimizes the mean square error of load in the population is selected as the leader, and random perturbations are added to the leader: Where: and represents the leader after and before the disturbance; ε represents the disturbance coefficient, which is used to adjust the disturbance space; r and p represent random numbers in the interval [0,1]; Step 4: Add random perturbations to encircle the prey and spiral motion, determine the update method, update the hyperparameters according to the mean square error of the load, add random differential mutations to the population, and update the population; specifically: 1) Use nonlinear convergence factors to balance global search and local development of the whale optimization algorithm: Where: v represents the adjustment coefficient, which is used to adjust the curve shape; T represents the maximum number of iterations of the improved whale algorithm; t represents the number of iterations of the improved whale algorithm; T c Indicates segmentation point; 2) Use adaptive weights to enhance late-stage local development Where: w s and w e They represent the initial weight and the final weight respectively; k represents the control factor, which controls the smoothness of the curve; 3) Improve the update formula Where: w represents the adaptive weight; and represents the update step size of encircling the prey and spiral motion; A is the function of the convergence factor a, and its value range is [-a, a]; b represents the spiral shape constant; l represents a random number in [-1, 1]; When selecting the update method, there is a 50% probability of using spiral motion to update the hyperparameters; if spiral motion is not selected, choose to surround the prey or search for prey according to |A|. When |A| < 1, surround the prey; when |A| ≥ 1, search for prey; 4) Random difference variation Where: represents a random hyperparameter; Step 5: Repeat steps 3 and 4 until the iteration ends, and consider the leader of the last iteration as the optimal hyperparameter; Step 6: Use the optimal hyperparameters to establish a load forecasting model and perform load forecasting, specifically: The load forecasting model is established using the optimal hyperparameters. The model input is the predicted load of the previous day and the temperature and weather of the predicted day, and the output is the predicted load of the day.

2. The load forecasting method based on improved whale algorithm and neural network according to claim 1 is characterized in that: The value of ε is 0.

01.

3. The load forecasting method based on improved whale algorithm and neural network according to claim 1 is characterized in that: The adjustment range of v is [1.5,4].

4. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the method according to any one of claims 1 to 3 are implemented.

5. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method described in any one of claims 1 to 3 are implemented.

Citation Information

Patent Citations

  • Recurrent neural network short-term power load prediction method of improved whale algorithm

    CN110110930A

  • BiLSTM voltage deviation prediction method based on Bayesian optimization

    CN113554148A