Method for optimizing long short-term memory network based on improved whale algorithm, transformer load prediction method, medium and equipment

Through the improved whale algorithm, optimize the long and short-term memory network and adaptively adjust the hyperparameter combination, the problem of insufficient optimization time and accuracy of the automated hyperparameter optimization scheme in transformer load prediction is solved, and more efficient search and more accurate prediction are achieved. result.

CN119067164APending Publication Date: 2024-12-03YUNNAN POWER GRID CO LTD ELECTRIC POWER RES INST
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411074617.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-07
Publication Date
2024-12-03

Smart Images

  • Figure CN119067164A_ABST
    Figure CN119067164A_ABST
Patent Text Reader

Abstract

The invention discloses a method for optimizing a long short-term memory network based on an improved whale algorithm, a transformer load prediction method, a medium and equipment, and the method comprises the steps: firstly, randomly initializing a plurality of hyper-parameter combinations, and calculating the fitness of an LSTM according to the combinations; then, current optimal and non-optimal hyper-parameter combinations are determined through sorting; then, a control parameter, a spiral shape parameter and a behavior selection threshold value are calculated in a self-adaptive mode based on the current iteration number, a contraction and expansion vector and an attraction vector are calculated through the parameters so as to determine parameter updating modes including spiral updating, contraction surrounding updating and search updating, and the non-optimal parameter combination is updated based on the modes. According to the method, the fitness is recalculated and ranked after each iteration until a preset iteration number threshold value is reached, and finally the optimal LSTM hyper-parameter combination is determined. According to the method, the control parameters, the threshold values and the vectors are adjusted according to the current iteration times, and the efficiency and the accuracy of searching the optimal hyper-parameter combination are remarkably 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 transformer load prediction, and in particular to a method for optimizing a long short-term memory network based on an improved whale algorithm, a transformer load prediction method, a medium and a device. Background Art

[0002] The goal of transformer load forecasting is to predict transformer operating parameters, such as oil temperature and high-voltage side current. However, due to the complexity and non-stationarity of the transformer operating environment, accurately predicting transformer operating parameters is a challenging task.

[0003] Long Short-Term Memory (LSTM) is an effective method that can predict current operating parameters based on historical load data. To obtain better prediction accuracy, we will continuously adjust the parameters of the LSTM model (such as the learning rate and the number of neurons in the hidden layer). Compared with manually adjusting these parameters, automated hyperparameter optimization methods can save time to a certain extent and obtain parameters with better accuracy. However, with the increasingly stringent requirements for prediction results today, conventional automated hyperparameter optimization solutions still need to be further optimized. Summary of the invention

[0004] Based on this, it is necessary to provide a method for optimizing long short-term memory networks based on the improved whale algorithm, a transformer load prediction method, a medium and an apparatus, so as to solve the problem that for long short-term memory networks, conventional automated hyperparameter optimization schemes still need to be further optimized in terms of optimization time and result accuracy.

[0005] A method for optimizing a long short-term memory network based on an improved whale algorithm, wherein the long short-term memory network takes characteristic parameters of a transformer as input and takes predicted load of the transformer as output, and the method comprises:

[0006] Randomly initialize n hyperparameter combinations of the long short-term memory network, obtain sample characteristic parameters of the transformer, input the sample characteristic parameters into the long short-term memory network under different hyperparameter combination settings, and calculate the fitness according to the output of the long short-term memory network to obtain the fitness of the n hyperparameter combinations;

[0007] Sort the fitness of n hyperparameter combinations, and determine the current optimal parameter combination and non-optimal parameter combination from the n hyperparameter combinations according to the sorting results;

[0008] Adaptively calculate the current control parameters, spiral shape parameters and first behavior selection threshold according to the current number of iterations, calculate the contraction-expansion vector according to the control parameters, and calculate the attraction vector according to the random vector within a preset range; wherein the control parameters are used to control the range of the contraction-expansion vector, the spiral shape parameters are used to control the shape of the spiral motion when the individual whale is spirally updated, the behavior selection threshold is the critical value for the whale to select different predation behaviors, the contraction-expansion vector is used to control the scale and direction of the individual whale's position, and the attraction vector is used to adjust the attraction between the individual whale and the prey;

[0009] Based on the comparison result between the randomly generated behavior selection random number and the first behavior selection threshold, and the comparison result between the absolute value of the shrink-expand vector and the preset second behavior selection threshold, the current parameter update mode is determined, and the current non-optimal parameter combination is updated according to the current parameter update mode; wherein the parameter update mode includes spiral update, shrink-enclose update and search update, and the shrink-enclose update and the search update are determined based on the shrink-expand vector and the attraction vector.

[0010] Inputting the sample characteristic parameters into the long short-term memory network under the current optimal parameter combination or different updated non-optimal parameter combination settings, and calculating the fitness according to the output of the long short-term memory network to obtain the fitness of the updated n hyperparameter combinations;

[0011] Sort the fitness of the n updated hyperparameter combinations, and determine the current optimal parameter combination and non-optimal parameter combination from the n updated hyperparameter combinations according to the sorting results;

[0012] If the current number of iterations is less than the preset iteration number threshold, the current number of iterations is set to +1, and the step of adaptively calculating the current control parameters, spiral shape parameters and first behavior selection threshold according to the current number of iterations and subsequent steps are returned. If the current number of iterations is equal to the preset iteration number threshold, the long short-term memory network is set based on the current optimal parameter combination to obtain the target long short-term memory network.

[0013] In one embodiment, the hyperparameter combination includes K hyperparameters, and the n hyperparameter combinations of the randomly initialized long short-term memory network include:

[0014] Get the value range of each hyperparameter respectively, and divide the value range of each hyperparameter evenly into n intervals;

[0015] Randomly select a point in each interval within the value range corresponding to the kth hyperparameter to obtain n random points of the kth hyperparameter; where 1≤k≤K;

[0016] A random point of each hyperparameter is randomly selected each time for combination to obtain n hyperparameter combinations of the long short-term memory network.

[0017] In one embodiment, the step of calculating the fitness according to the output of the long short-term memory network to obtain the fitness of n hyperparameter combinations includes:

[0018] Obtaining the actual load corresponding to the sample characteristic parameters, calculating the mean square error each time based on the predicted load output by the long short-term memory network and the actual load, and obtaining n mean square errors as the fitness of n hyperparameter combinations;

[0019] The step of ranking the fitness of the n hyperparameter combinations and determining the current optimal parameter combination and the non-optimal parameter combination from the n hyperparameter combinations according to the ranking results includes:

[0020] Sort the n mean square errors, and take the hyperparameter combination with the smallest mean square error as the current optimal parameter combination, and take the hyperparameter combinations other than the current optimal parameter combination as the current non-optimal parameter combination.

[0021] In one embodiment, the calculation formula for adaptively calculating the current control parameter, spiral shape parameter and first behavior selection threshold according to the current iteration number is expressed as:

[0022]

[0023] In the above formula, represents the control parameter, t represents the current iteration number, t Max represents the iteration number threshold, b represents the spiral shape parameter, P a It indicates that the first line is the selection threshold, and k, v, L, and f represent the preset control coefficients.

[0024] In one embodiment, the calculation formula for calculating the contraction expansion vector according to the control parameter is expressed as:

[0025]

[0026] In the above formula, represents the contraction-expansion vector, represents a random vector in the range [0,1];

[0027] The calculation formula for calculating the attraction vector according to the random vector within the preset range is expressed as:

[0028]

[0029] represents the attraction vector, represents a random vector in the range [0,1].

[0030] In one embodiment, the current parameter update method is determined based on the comparison result between the randomly generated behavior selection random number and the first behavior selection threshold, and the comparison result between the absolute value of the contraction and expansion vector and the preset second behavior selection threshold, including:

[0031] When the randomly generated behavior selection random number is greater than or equal to the first behavior selection threshold, setting the current parameter update mode to spiral update;

[0032] When the randomly generated behavior selection random number is smaller than the first behavior selection threshold, and the absolute value of the shrink-expand vector is smaller than the preset second behavior selection threshold, the current parameter update mode is set to shrink-surround update;

[0033] When the randomly generated behavior selection random number is smaller than the first behavior selection threshold, and the absolute value of the contraction-expansion vector is greater than or equal to the preset second behavior selection threshold, the current parameter update mode is set to search update.

[0034] In one embodiment, updating the current non-optimal parameter combination according to the current parameter updating method includes:

[0035] If the current parameter update method is spiral update, the update of the current non-optimal parameter combination is expressed as:

[0036]

[0037] In the above formula, represents the updated non-optimal parameter combination, represents the current non-optimal parameter combination, represents the current optimal parameter combination, b represents the spiral shape parameter, and l represents a random number between [0,1];

[0038] If the current parameter update method is shrinking and wrapping update, the update of the current non-optimal parameter combination is expressed as:

[0039]

[0040] In the above formula, represents the contraction-expansion vector, represents the attraction vector;

[0041] If the current parameter update method is search update, the update of the current non-optimal parameter combination is expressed as:

[0042]

[0043] In the above formula, represents a random one of n hyperparameter combinations.

[0044] A transformer load prediction method, the method comprising:

[0045] Obtain target characteristic parameters of the transformer to be predicted, input the target characteristic parameters into a target long short-term memory network, and obtain an output prediction load; wherein the target long short-term memory network is optimized by a method for optimizing long short-term memory networks based on an improved whale algorithm.

[0046] A computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the processor executes the steps of a method for optimizing a long short-term memory network based on an improved whale algorithm and a transformer load prediction method.

[0047] A terminal device includes a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the above-mentioned method for optimizing long short-term memory network based on improved whale algorithm and transformer load prediction method.

[0048] The present invention provides a method for optimizing a long short-term memory network based on an improved whale algorithm, a transformer load prediction method, a medium and a device. First, a plurality of hyperparameter combinations are randomly initialized, and the fitness of LSTM is calculated according to these combinations. Then, the current optimal and non-optimal hyperparameter combinations are determined by sorting. Then, control parameters, spiral shape parameters and behavior selection thresholds are adaptively calculated based on the current number of iterations, and contraction expansion vectors and attraction vectors are calculated by these parameters to determine the parameter update method. The specific update method includes spiral update, contraction surround update and search update, and non-optimal parameter combinations are updated based on these methods. The method recalculates and sorts the fitness after each iteration until a preset number of iterations threshold is reached, and finally determines the optimal LSTM hyperparameter combination. The adaptive improvement strategy of the present invention significantly improves the search efficiency by adjusting the control parameters, thresholds and vectors according to the current number of iterations, and increases the possibility of finding a better LSTM hyperparameter combination. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0050] in:

[0051] Figure 1 A flowchart of a method for optimizing long short-term memory networks based on an improved whale algorithm;

[0052] Figure 2 Schematic diagram of the process of randomly initializing n hyperparameter combinations of long short-term memory networks;

[0053] Figure 3 It is the comparison curve of the high-voltage side current prediction results;

[0054] Figure 4 It is the comparison curve of transformer oil temperature prediction results;

[0055] Figure 5 This is a structural block diagram of the terminal equipment. DETAILED DESCRIPTION

[0056] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0057] The terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.

[0058] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0059] like Figure 1 As shown, Figure 1 It is a flow chart of a method for optimizing a long short-term memory network based on an improved whale algorithm in one embodiment. In this embodiment, the long short-term memory network takes the characteristic parameters of the transformer as input and the predicted load of the transformer as output.

[0060] Specifically, the characteristic parameters of the transformer refer to data closely related to the operating status of the transformer. These parameters are used to describe the working conditions of the transformer and changes in its surrounding environment. Common characteristic parameters include but are not limited to: high-voltage side three-phase current amplitude, high-voltage side active power, high-voltage side reactive power, high-voltage side three-phase voltage amplitude and oil temperature.

[0061] The predicted load of a transformer refers to the prediction of the load of the transformer at a certain moment in the future. The load usually refers to the power demand borne by the transformer, including active load and reactive load.

[0062] The steps provided in the method for optimizing the long short-term memory network based on the improved whale algorithm in this embodiment include:

[0063] S101, randomly initialize n hyperparameter combinations of the long short-term memory network, obtain sample feature parameters of the transformer, input the sample feature parameters into the long short-term memory network under different hyperparameter combination settings, and calculate the fitness based on the output of the long short-term memory network to obtain the fitness of the n hyperparameter combinations.

[0064] Specifically, some hyperparameters in the LSTM model need to be set before training, such as learning rate, number of hidden layer units, batch size, etc. The combination of these hyperparameters constitutes a hyperparameter combination. Here, different hyperparameter combinations are randomly initialized for subsequent comprehensive exploration in the search space, thereby increasing the probability of finding the best parameter combination.

[0065] In a specific example, the hyperparameter combination includes K hyperparameters, such as Figure 2 As shown in Figure 1, the specific steps of randomly initializing n hyperparameter combinations of the long short-term memory network include:

[0066] S1011, respectively obtain the value range of each hyperparameter, and evenly divide the value range of each hyperparameter into n intervals.

[0067] For example, K=3, the learning rate range is [0.0001, 0.01], the number of hidden layer units ranges from [10, 100], the batch size ranges from [16, 128], and n=3 is set.

[0068] Then the learning rate is evenly divided into interval 1: [0.0001, 0.0034], interval 2: [0.0034, 0.0067], interval 3: [0.0067, 0.01].

[0069] The number of hidden layer units is evenly divided into interval 1: [10,40], interval 2: [40,70], and interval 3: [70,100].

[0070] The batch size is evenly divided into interval 1: [16,53], interval 2: [53,90], interval 3: [90,128].

[0071] S1012, randomly select a point in each interval within the value range corresponding to the kth hyperparameter to obtain n random points of the kth hyperparameter.

[0072] Among them, 1≤k≤K. Assume that all random points obtained randomly include

[0073] Learning rate random points: interval 1: 0.002, interval 2: 0.005, interval 3: 0.009.

[0074] Random points for the number of hidden layer units: interval 1: 20, interval 2: 50, interval 3: 80.

[0075] Batch size random points: interval 1: 32, interval 2: 64, interval 3: 100.

[0076] S1013, randomly select a random point of each hyperparameter for combination each time to obtain n hyperparameter combinations of the long short-term memory network.

[0077] Exemplarily, the n hyperparameter combinations may be:

[0078] Combination 1: learning rate 0.005, number of hidden layer units 50, batch size 100

[0079] Combination 2: learning rate 0.002, number of hidden layer units 20, batch size 64

[0080] Combination 3: learning rate 0.009, number of hidden layer units 80, batch size 32

[0081] It can be understood that this embodiment can make the hyperparameter combination cover the entire search space more evenly, thereby improving the representativeness of the samples and the accuracy of the analysis.

[0082] Next, we obtain the sample characteristic parameters of the transformer, such as the three-phase current amplitude on the high-voltage side, the active power on the high-voltage side, the reactive power on the high-voltage side, the three-phase voltage amplitude on the high-voltage side, or the oil temperature. Then, we use the sample characteristic parameters of the transformer as input and pass them to the LSTM network under each different hyperparameter combination setting. The LSTM network will output the predicted load, and then we can calculate the fitness by combining the error between the predicted result and the actual result to obtain the fitness of n hyperparameter combinations.

[0083] In a specific embodiment, the fitness is calculated based on the output of the long short-term memory network to obtain the fitness of n hyperparameter combinations. The specific steps include: obtaining the actual load corresponding to the sample characteristic parameters, calculating the mean square error each time based on the predicted load output by the long short-term memory network and the actual load, and obtaining n mean square errors as the fitness of the n hyperparameter combinations.

[0084] Through the above steps, we can get the fitness of each hyperparameter combination, so as to compare the performance of the LSTM model under different hyperparameter combinations and then select the optimal hyperparameter combination.

[0085] S102, sorting the fitness of the n hyperparameter combinations, and determining the current optimal parameter combination and non-optimal parameter combination from the n hyperparameter combinations according to the sorting result.

[0086] In a specific embodiment, the fitness of n hyperparameter combinations is sorted, and the specific steps of determining the current optimal parameter combination and non-optimal parameter combination from the n hyperparameter combinations according to the sorting results include: sorting the n mean square errors, and taking the hyperparameter combination with the smallest mean square error as the current optimal parameter combination, and taking the hyperparameter combinations other than the current optimal parameter combination as the current non-optimal parameter combination.

[0087] Through the above steps, the current optimal parameter combination and non-optimal parameter combination can be determined, so that in the next optimization process, the performance of the model can be further optimized based on these combinations.

[0088] S103, adaptively calculating the current control parameters, spiral shape parameters and the first behavior selection threshold according to the current number of iterations, calculating the contraction and expansion vector according to the control parameters, and calculating the attraction vector according to the random vector within a preset range.

[0089] Among them, the control parameter is used to control the range of the contraction and expansion vector, the spiral shape parameter is used to control the shape of the spiral motion when the whale individual spiral updates, the behavior selection threshold is the critical value for the whale to choose different predation behaviors, the contraction and expansion vector is used to control the scale and direction of the whale individual position, and the attraction vector is used to adjust the attraction between the whale individual and the prey. These parameters and vectors are important factors in determining how to update the hyperparameter combination later.

[0090] In a specific embodiment, the calculation formula for adaptively calculating the current control parameter, spiral shape parameter and first behavior selection threshold according to the current iteration number is expressed as:

[0091]

[0092] In the above formula, represents the control parameter, t represents the current iteration number, t Maxrepresents the iteration number threshold, b represents the spiral shape parameter, P a It indicates that the first line is the selection threshold, and k, v, L, and f represent the preset control coefficients.

[0093] In a specific embodiment, the calculation formula for calculating the contraction expansion vector according to the control parameter is expressed as:

[0094]

[0095] In the above formula, represents the contraction-expansion vector, represents a random vector in the range [0,1];

[0096] The calculation formula for calculating the attraction vector based on a random vector within a preset range is expressed as:

[0097]

[0098] represents the attraction vector, represents a random vector in the range [0,1].

[0099] That is to say, compared with the traditional whale algorithm, the adaptive super improvement strategy of the present invention can adjust the control parameters and thresholds according to the current number of iterations, so that the algorithm can achieve a better balance between global search and local search. In the early stage of the algorithm, this embodiment can accelerate the convergence speed, quickly narrow the search space, and find a better initial solution as soon as possible through larger control parameters and thresholds. This helps to obtain a better set of hyperparameter combination candidates in a shorter time. As the number of iterations increases, the parameters and thresholds will be further adjusted with the number of iterations. This embodiment is more inclined to perform local search to fine-tune the hyperparameter combination and improve accuracy and performance. That is, this embodiment can not only improve search efficiency, but also is more likely to find a better LSTM hyperparameter combination.

[0100] S104, determine the current parameter update method based on the comparison result between the randomly generated behavior selection random number and the first behavior selection threshold, and the comparison result between the absolute value of the contraction and expansion vector and the preset second behavior selection threshold, and update the current non-optimal parameter combination according to the current parameter update method.

[0101] The object of parameter update is the individual whale (the current non-optimal parameter combination), the reference benchmark of parameter update is the prey (the current optimal parameter combination), and the parameter update methods include spiral update, shrinkage and envelopment update, and search update. The spiral update is used to simulate the behavior of the individual whale moving around the prey in a spiral shape, the shrinkage and envelopment update is used to simulate the behavior of the individual whale moving toward the prey, and the search update is used to simulate the behavior of the individual whale moving away from the prey. The shrinkage and envelopment update and the search update determine the update method based on the shrinkage and expansion vector and the attraction vector.

[0102] In a specific embodiment, when the randomly generated behavior selection random number is greater than or equal to the first behavior selection threshold, the current parameter update mode is set to spiral update; this update mode helps to explore a wider search space in the global search phase, thereby increasing the possibility of finding the global optimal solution. By using random numbers and thresholds to control the conditions for entering the spiral update, the algorithm can perform a large-scale search at the appropriate time to avoid falling into the local optimum.

[0103] When the randomly generated behavior selection random number is less than the first behavior selection threshold, and the absolute value of the shrink-expand vector is less than the preset second behavior selection threshold, the current parameter update method is set to shrink-surround update; this method helps to guide the whale individual to move towards the current optimal solution by narrowing the search range in the local search stage, so as to refine the search and improve the local search accuracy. When the absolute value of the shrink-expand vector is small, it indicates that the whale individual is closer to the current optimal solution. At this time, performing a local refinement search is more conducive to finding a better solution.

[0104] When the randomly generated behavior selection random number is less than the first behavior selection threshold, and the absolute value of the shrink-expand vector is greater than or equal to the preset second behavior selection threshold, the current parameter update mode is set to search update. This update mode is used for global search. When the absolute value of the shrink-expand vector is large, it indicates that the individual whale is far away from the current optimal solution. At this time, a wider range of random search is performed to increase the chance of finding a new potential optimal solution.

[0105] Furthermore, if the current parameter update method is spiral update, the update of the current non-optimal parameter combination is expressed as:

[0106]

[0107] In the above formula, represents the updated non-optimal parameter combination, represents the current non-optimal parameter combination, represents the current optimal parameter combination, b represents the spiral shape parameter, and l represents a random number between [0,1];

[0108] If the current parameter update method is shrinking and wrapping update, the update of the current non-optimal parameter combination is expressed as:

[0109]

[0110] In the above formula, represents the contraction-expansion vector, represents the attraction vector;

[0111] If the current parameter update method is search update, the update of the current non-optimal parameter combination is expressed as:

[0112]

[0113] In the above formula, represents a random one of n hyperparameter combinations.

[0114] Through the dynamic selection and update method of this step, the whale optimization algorithm can flexibly adjust the search strategy according to the current search status, find the best balance between global search and local search, and update non-optimal parameter combinations in the fastest and most accurate manner.

[0115] S105, input the sample feature parameters into the long short-term memory network under the current optimal parameter combination or different updated non-optimal parameter combination settings, and calculate the fitness based on the output of the long short-term memory network to obtain the fitness of the updated n hyperparameter combinations.

[0116] S106, sorting the fitness of the n updated hyperparameter combinations, and determining the current optimal parameter combination and non-optimal parameter combination from the n updated hyperparameter combinations according to the sorting result.

[0117] The principles of the above steps S105-S106 are basically the same as those of steps S101-S102. The only difference is that the LSTM is set to the current optimal parameter combination that has not been updated or the non-optimal parameter combination after different updates. Therefore, they will not be described in detail.

[0118] S107, determine whether the current number of iterations is less than the preset number of iterations threshold; if the current number of iterations is less than the preset number of iterations threshold, set the current number of iterations + 1, and return to execute S103 and subsequent steps. If the current number of iterations is equal to the preset number of iterations threshold, execute S108, set the long short-term memory network based on the current optimal parameter combination to obtain the target long short-term memory network.

[0119] The above method for optimizing the long short-term memory network based on the improved whale algorithm first randomly initializes multiple hyperparameter combinations, and calculates the fitness of LSTM based on these combinations. Then, the current optimal and non-optimal hyperparameter combinations are determined by sorting. Then, the control parameters, spiral shape parameters and behavior selection thresholds are adaptively calculated based on the current number of iterations, and the contraction and expansion vectors and the attraction vectors are calculated by these parameters to determine the parameter update method. The specific update methods include spiral update, contraction and encirclement update and search update, and the non-optimal parameter combinations are updated based on these methods. The method recalculates and sorts the fitness after each iteration until the preset number of iterations threshold is reached, and finally determines the optimal LSTM hyperparameter combination. The adaptive improvement strategy of the present invention significantly improves the search efficiency by adjusting the control parameters, thresholds and vectors according to the current number of iterations, and increases the possibility of finding a better LSTM hyperparameter combination.

[0120] Furthermore, in order to verify the training effect of the target LSTM network, we also used the historical operation data of a transformer in a substation for testing. Figure 3 The following is a comparison curve of the high-voltage side current prediction results. Figure 4 The following is a comparison curve of transformer oil temperature prediction results. It can be seen that the load value predicted by the model is very close to the actual load value. Table 1 and Table 2 are the evaluation indicators of high-voltage side current and transformer oil temperature prediction results respectively:

[0121] Evaluation indicators value RMSE 4.51241 MAE 2.55178 MAPE 1.2497%

[0122] Table 1 Evaluation index values ​​of transformer high voltage current measurement test set

[0123] Evaluation indicators value RMSE 1.40698 MAE 0.90236 MAPE 1.9092%

[0124] Table 2 Transformer oil temperature test set evaluation index values

[0125] It can be seen from the data in the table that the three evaluation indicators of load forecasting: RMSE, MAE, and MAPE all perform well.

[0126] In one embodiment, the present invention further proposes a transformer load prediction method, which includes:

[0127] The target characteristic parameters of the transformer to be predicted are obtained, and the target characteristic parameters are input into the target long short-term memory network to obtain the output prediction load; wherein, the target long short-term memory network is optimized by a method for optimizing the long short-term memory network based on the improved whale algorithm.

[0128] The above transformer load prediction method can accurately predict the load of the transformer by obtaining the target characteristic parameters and inputting them into the optimized LSTM network, thereby improving the operating efficiency and stability of the power system.

[0129] Figure 5 FIG. 2 shows an internal structure diagram of a terminal device in an embodiment. Figure 5 As shown, the terminal device includes a processor, a memory and a network interface connected via a system bus. Among them, the memory includes a non-volatile storage medium and an internal memory. The non-volatile storage medium of the terminal device stores an operating system and may also store a computer program. When the computer program is executed by the processor, the processor can implement a method for optimizing a long short-term memory network based on an improved whale algorithm. The internal memory may also store a computer program. When the computer program is executed by the processor, the processor can implement a method for optimizing a long short-term memory network based on an improved whale algorithm. Those skilled in the art can understand that Figure 5 The structure shown in the figure is only a block diagram of a partial structure related to the scheme of the present application, and does not constitute a limitation on the terminal device to which the scheme of the present application is applied. The specific terminal device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0130] A computer-readable storage medium stores a computer program, which implements the following steps when executed by a processor: randomly initialize n hyperparameter combinations of a long short-term memory network, obtain sample characteristic parameters of a transformer, input the sample characteristic parameters into the long short-term memory network under different hyperparameter combination settings, and calculate the fitness according to the output of the long short-term memory network to obtain the fitness of the n hyperparameter combinations; sort the fitness of the n hyperparameter combinations, and determine the current optimal parameter combination and non-optimal parameter combination from the n hyperparameter combinations according to the sorting results; adaptively calculate the current control parameters, spiral shape parameters and first behavior selection threshold according to the current number of iterations, calculate the contraction and expansion vector according to the control parameters, and calculate the attraction vector according to the random vector within a preset range; wherein the control parameter is used to control the range of the contraction and expansion vector, the spiral shape parameter is used to control the shape of the spiral motion of the individual whale during spiral update, the behavior selection threshold is the critical value for the whale to select different predation behaviors, the contraction and expansion vector is used to control the scale and direction of the individual whale position, and the attraction vector is used to adjust the attraction between the individual whale and the prey; based on the random number between the randomly generated behavior selection random number and the first behavior selection threshold The comparison result and the comparison result between the absolute value of the shrinkage expansion vector and the preset second behavior selection threshold determine the current parameter update mode, and update the current non-optimal parameter combination according to the current parameter update mode; wherein the parameter update mode includes spiral update, shrinkage surround update and search update, and the shrinkage surround update and search update determine the update mode based on the shrinkage expansion vector and the attraction vector; the sample feature parameters are respectively input into the long short-term memory network under the current optimal parameter combination or the different updated non-optimal parameter combinations, and the fitness is calculated according to the output of the long short-term memory network to obtain the fitness of the updated n hyperparameter combinations; the fitness of the updated n hyperparameter combinations is sorted, and the current optimal parameter combination and the non-optimal parameter combination are determined from the updated n hyperparameter combinations according to the sorting result; if the current number of iterations is less than the preset number of iterations threshold, the current number of iterations is set to +1, and the step of adaptively calculating the current control parameters, spiral shape parameters and the first behavior selection threshold according to the current number of iterations and the subsequent steps are returned; if the current number of iterations is equal to the preset number of iterations threshold, the long short-term memory network is set based on the current optimal parameter combination to obtain the target long short-term memory network.

[0131] And implement the following steps: obtain the target characteristic parameters of the transformer to be predicted, input the target characteristic parameters into the target long short-term memory network, and obtain the output predicted load; wherein, the target long short-term memory network is optimized by a method for optimizing the long short-term memory network based on the improved whale algorithm.

[0132] A terminal device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the following steps are implemented: randomly initializing n hyperparameter combinations of a long short-term memory network, obtaining sample characteristic parameters of a transformer, inputting the sample characteristic parameters into the long short-term memory network under different hyperparameter combination settings, and calculating fitness according to the output of the long short-term memory network to obtain the fitness of the n hyperparameter combinations; sorting the fitness of the n hyperparameter combinations, and determining the current optimal parameter combination and non-optimal parameter combination from the n hyperparameter combinations according to the sorting results. The present control parameter, spiral shape parameter and first behavior selection threshold are adaptively calculated according to the current number of iterations, and the contraction-expansion vector is calculated according to the control parameter, and the attraction vector is calculated according to the random vector within the preset range; wherein the control parameter is used to control the range of the contraction-expansion vector, the spiral shape parameter is used to control the shape of the spiral motion when the individual whale spirals are updated, the behavior selection threshold is the critical value for the whale to select different predation behaviors, the contraction-expansion vector is used to control the scale and direction of the individual whale position, and the attraction vector is used to adjust the attraction between the individual whale and the prey; based on the randomly generated behavior selection random number and the first behavior selection The method comprises the following steps: determining a current parameter updating mode based on a comparison result between the absolute value of the shrinkage expansion vector and the preset second behavior selection threshold, and determining a current parameter updating mode based on a comparison result between the absolute value of the shrinkage expansion vector and the preset second behavior selection threshold, and updating the current non-optimal parameter combination according to the current parameter updating mode; wherein the parameter updating mode includes spiral updating, shrinkage enveloping updating and search updating, and the shrinkage enveloping updating and search updating are based on the shrinkage expansion vector and the attraction vector to determine the updating mode; inputting the sample feature parameters into the long short-term memory network under the current optimal parameter combination or the different updated non-optimal parameter combinations, and calculating the fitness according to the output of the long short-term memory network to obtain the fitness of the updated n hyperparameter combinations; sorting the fitness of the updated n hyperparameter combinations, and determining the current optimal parameter combination and the non-optimal parameter combination from the updated n hyperparameter combinations according to the sorting result; if the current number of iterations is less than the preset number of iterations threshold, setting the current number of iterations +1, and returning to execute the step of adaptively calculating the current control parameters, spiral shape parameters and the first behavior selection threshold according to the current number of iterations and the subsequent steps; if the current number of iterations is equal to the preset number of iterations threshold, setting the long short-term memory network based on the current optimal parameter combination to obtain the target long short-term memory network.

[0133] And implement the following steps: obtain the target characteristic parameters of the transformer to be predicted, input the target characteristic parameters into the target long short-term memory network, and obtain the output predicted load; wherein, the target long short-term memory network is optimized by a method for optimizing the long short-term memory network based on the improved whale algorithm.

[0134] It should be noted that the above-mentioned method for optimizing long short-term memory network based on improved whale algorithm, transformer load prediction method, device and computer-readable storage medium belong to a general inventive concept, and the contents in the embodiments of the method for optimizing long short-term memory network based on improved whale algorithm, transformer load prediction method, device and computer-readable storage medium can be applied to each other.

[0135] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a non-volatile computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0136] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0137] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A method for optimizing long short-term memory networks based on improved whale algorithm, It is characterized in that The long short-term memory network takes the characteristic parameters of the transformer as input and takes the predicted load of the transformer as output, and the method includes: Randomly initialize n hyperparameter combinations of the long short-term memory network, obtain sample characteristic parameters of the transformer, input the sample characteristic parameters into the long short-term memory network under different hyperparameter combination settings, and calculate the fitness according to the output of the long short-term memory network to obtain the fitness of the n hyperparameter combinations; Sort the fitness of n hyperparameter combinations, and determine the current optimal parameter combination and non-optimal parameter combination from the n hyperparameter combinations according to the sorting results; Adaptively calculate the current control parameters, spiral shape parameters and first behavior selection threshold according to the current number of iterations, calculate the contraction-expansion vector according to the control parameters, and calculate the attraction vector according to the random vector within a preset range; wherein the control parameters are used to control the range of the contraction-expansion vector, the spiral shape parameters are used to control the shape of the spiral motion when the individual whale is spirally updated, the behavior selection threshold is the critical value for the whale to select different predation behaviors, the contraction-expansion vector is used to control the scale and direction of the individual whale's position, and the attraction vector is used to adjust the attraction between the individual whale and the prey; Based on the comparison result between the randomly generated behavior selection random number and the first behavior selection threshold, and the comparison result between the absolute value of the shrink-expand vector and the preset second behavior selection threshold, the current parameter update mode is determined, and the current non-optimal parameter combination is updated according to the current parameter update mode; wherein the parameter update mode includes spiral update, shrink-enclose update and search update, and the shrink-enclose update and the search update are determined based on the shrink-expand vector and the attraction vector. Inputting the sample characteristic parameters into the long short-term memory network under the current optimal parameter combination or different updated non-optimal parameter combination settings, and calculating the fitness according to the output of the long short-term memory network to obtain the fitness of the updated n hyperparameter combinations; Sort the fitness of the n updated hyperparameter combinations, and determine the current optimal parameter combination and non-optimal parameter combination from the n updated hyperparameter combinations according to the sorting results; If the current number of iterations is less than the preset iteration number threshold, the current number of iterations is set to +1, and the step of adaptively calculating the current control parameters, spiral shape parameters and first behavior selection threshold according to the current number of iterations and subsequent steps are returned. If the current number of iterations is equal to the preset iteration number threshold, the long short-term memory network is set based on the current optimal parameter combination to obtain the target long short-term memory network.

2. The method according to claim 1, It is characterized in that The hyperparameter combination includes K hyperparameters, and the n hyperparameter combinations of the randomly initialized long short-term memory network include: Get the value range of each hyperparameter respectively, and divide the value range of each hyperparameter evenly into n intervals; Randomly select a point in each interval within the value range corresponding to the kth hyperparameter to obtain n random points of the kth hyperparameter; where 1≤k≤K; A random point of each hyperparameter is randomly selected each time for combination to obtain n hyperparameter combinations of the long short-term memory network.

3. The method according to claim 1, It is characterized in that The fitness is calculated according to the output of the long short-term memory network to obtain the fitness of n hyperparameter combinations, including: Obtaining the actual load corresponding to the sample characteristic parameters, calculating the mean square error each time based on the predicted load output by the long short-term memory network and the actual load, and obtaining n mean square errors as the fitness of n hyperparameter combinations; The step of ranking the fitness of the n hyperparameter combinations and determining the current optimal parameter combination and the non-optimal parameter combination from the n hyperparameter combinations according to the ranking results includes: Sort the n mean square errors, and take the hyperparameter combination with the smallest mean square error as the current optimal parameter combination, and take the hyperparameter combinations other than the current optimal parameter combination as the current non-optimal parameter combination.

4. The method according to claim 1, It is characterized in that The calculation formula for adaptively calculating the current control parameters, spiral shape parameters and the first behavior selection threshold according to the current number of iterations is expressed as: In the above formula, represents the control parameter, t represents the current iteration number, t Max represents the iteration number threshold, b represents the spiral shape parameter, P a It indicates that the first line is the selection threshold, and k, v, L, and f represent the preset control coefficients.

5. The method according to claim 4, It is characterized in that The calculation formula for calculating the contraction expansion vector according to the control parameter is expressed as: In the above formula, represents the contraction-expansion vector, represents a random vector in the range [0,1]; The calculation formula for calculating the attraction vector according to the random vector within the preset range is expressed as: represents the attraction vector, represents a random vector in the range [0,1].

6. The method according to claim 1, It is characterized in that The current parameter update method is determined based on the comparison result between the randomly generated behavior selection random number and the first behavior selection threshold, and the comparison result between the absolute value of the contraction and expansion vector and the preset second behavior selection threshold, including: When the randomly generated behavior selection random number is greater than or equal to the first behavior selection threshold, setting the current parameter update mode to spiral update; When the randomly generated behavior selection random number is smaller than the first behavior selection threshold, and the absolute value of the shrink-expand vector is smaller than the preset second behavior selection threshold, the current parameter update mode is set to shrink-surround update; When the randomly generated behavior selection random number is smaller than the first behavior selection threshold, and the absolute value of the contraction-expansion vector is greater than or equal to the preset second behavior selection threshold, the current parameter update mode is set to search update.

7. The method according to claim 6, It is characterized in that The updating of the current non-optimal parameter combination according to the current parameter updating method includes: If the current parameter update method is spiral update, the update of the current non-optimal parameter combination is expressed as: In the above formula, represents the updated non-optimal parameter combination, represents the current non-optimal parameter combination, represents the current optimal parameter combination, b represents the spiral shape parameter, and l represents a random number between [0,1]; If the current parameter update method is shrinking and wrapping update, the update of the current non-optimal parameter combination is expressed as: In the above formula, represents the contraction-expansion vector, represents the attraction vector; If the current parameter update method is search update, the update of the current non-optimal parameter combination is expressed as: In the above formula, represents a random one of n hyperparameter combinations.

8. A transformer load prediction method, It is characterized in that The method comprises: Obtain target characteristic parameters of the transformer to be predicted, input the target characteristic parameters into a target long short-term memory network, and obtain an output predicted load; wherein the target long short-term memory network is optimized by the method according to any one of claims 1 to 7.

9. A computer-readable storage medium, It is characterized in that A computer program is stored, and when the computer program is executed by a processor, the processor is caused to perform the steps of the method according to any one of claims 1 to 8.

10. A terminal device, It is characterized in that The method comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the method according to any one of claims 1 to 8.

Citation Information

Cited By

  • Distributed power supply hierarchical access optimization method considering output deviation transmission between hierarchies

    CN121965824A