A method for optimizing risk prediction in power marketing
By improving the special relativity search algorithm and optimizing the parameters of the LSTM model, the βSRS-LSTM model is formed, which solves the problems of low prediction accuracy of the LSTM model and slow convergence of the special relativity search algorithm, and improves the accuracy and timeliness of the power marketing risk prediction.
Patent Information
- Application Number
- CN202410633348.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-21
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2044-05-21
AI Technical Summary
The excessive dependence of network parameters in the long and short-term memory neural network (LSTM) model leads to low prediction accuracy of power marketing risk and long prediction time. The special relativity search algorithm (SRS) is prone to fall into local optimality and has a slow convergence speed in the later stage of iteration, resulting in The prediction accuracy and speed of the SRS-LSTM prediction model are still poor.
By improving the special relativity search algorithm, we introduce the 'relative convergence' strategy model and particle optimization weight factor of the fitness value change and particle velocity, optimize the number of hidden layer nodes and initial learning rate of the LSTM model, and form a βSRS-LSTM model to Improve local convergence speed and ability to jump out of local optimality.
The performance of the SRS-LSTM prediction model is improved, the accuracy and timeliness of power marketing risk prediction are improved, and the stability and speed of the prediction results are avoided.
Smart Images

Figure CN118586955B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of data prediction, and in particular relates to a method for optimizing power marketing risk prediction. Background Art
[0002] With the continuous opening of the power market and the intensification of competition, power marketing is facing an increasingly complex external environment, including policy adjustments, market fluctuations, technological advances, and changes in customer demand. These changes have brought higher uncertainty and risks to power marketing on-site behaviors. In a complex marketing environment, risk management has become the key for power companies to enhance their competitiveness and ensure operational safety. Through effective risk prediction and optimization methods, companies can identify potential risks in advance, formulate targeted response strategies, and reduce risk losses. With the rapid development of big data and intelligent optimization algorithm technology, new ideas and methods have been provided for power marketing risk prediction. By collecting and analyzing massive data, a more accurate risk prediction model can be built, marketing strategies can be optimized, and the accuracy and timeliness of predictions can be improved.
[0003] Traditional risk prediction methods are often based on historical data and empirical models, which are difficult to adapt to complex and changing environments. These methods have limitations in prediction accuracy and timeliness and are difficult to meet the needs of modern power marketing. Existing risk management methods mainly focus on risk control and risk transfer, lacking in-depth analysis of risk sources and comprehensive monitoring of risk processes. This makes it difficult for companies to respond quickly when faced with sudden risks, reducing the effectiveness of risk management. With the help of big data and intelligent optimization algorithm technology, risk management can be intelligent and automated. Through real-time monitoring of risk processes, automatic early warning and intelligent decision support, companies can respond to risk challenges more efficiently and improve their risk management level.
[0004] The LSTM model is used to predict power marketing risks in complex environments. The long short-term memory neural network prediction model (LSTM) contains many network parameters, such as kernel function, learning rate and number of neurons. These parameters will affect the accuracy of the LSTM model in predicting power marketing risks in complex environments. Because these parameters are overly dependent on experience settings, their prediction accuracy is inaccurate. At the same time, the training time of the LSTM model will also change with different parameter settings, resulting in a long time for predicting power marketing risks.
[0005] The special relativity search algorithm (SRS) is a new meta-heuristic optimization algorithm. SRS is inspired by the interaction of particles in the electromagnetic field. The Lorentz force is used to calculate the interaction of particles, and the angular frequency is used to establish the equation of motion. The magnetic force between particles is perpendicular to the velocity and magnetic field of the charged particles, which causes the particles to move in a circular trajectory. The special relativity physics theory is used to determine the coordinates of the charged particles in each rotation. The charged particles are members of the randomly generated initial population, and their charges are determined according to their fitness. The SRS optimization mathematical model is established using the two phenomena of length contraction and time dilation. The use of the special relativity search algorithm to optimize the long short-term memory neural network prediction model can improve the prediction accuracy of the LSTM model to a certain extent. Further experimental measurements show that although the special relativity search algorithm has good global search performance, the algorithm is prone to fall into local optimality in the later stages of iteration and converges slowly. Summary of the invention
[0006] In view of the above-mentioned background technology, many network parameters in the long short-term memory neural network (LSTM) prediction model are overly dependent on empirical settings, resulting in low accuracy and long prediction time for power marketing risk prediction in complex environments, and the special relativity search algorithm (SRS) is prone to fall into local optimality and convergence speed in the late iteration, resulting in the problem that the prediction accuracy and prediction speed of the SRS-LSTM prediction model obtained by optimizing the long short-term memory neural network prediction model by the special relativity search algorithm are still poor. The present invention proposes a power marketing risk prediction optimization method, which improves the local convergence speed and the ability of the SRS algorithm to jump out of the local optimal by improving the special relativity search algorithm, thereby improving the performance of the SRS-LSTM prediction model and obtaining a βSRS-LSTM prediction model. The βSRS-LSTM prediction model is applied to power marketing risk prediction, optimizes marketing strategies, and improves the accuracy and timeliness of power marketing risk prediction in complex environments.
[0007] The technical solution adopted by the present invention to achieve the above-mentioned object is: a method for optimizing the prediction of power marketing risk, which improves the local convergence speed and the ability to jump out of the local optimum of the SRS algorithm by improving the special relativity search algorithm, thereby improving the performance of the SRS-LSTM prediction model and obtaining the βSRS-LSTM prediction model. The specific steps are:
[0008] S1. Pre-process the historical power marketing data, market factor data, social factor data, and power system data that affect power marketing risk prediction.
[0009] S2. Using the “relative convergence” strategy model as the position update mathematical model of the special relativity search algorithm in the local convergence stage, the position update strategy of the special relativity search algorithm is improved. The “relative convergence” strategy model is based on the global optimal particle position of the special relativity search algorithm. As the center, according to the current position of the particle The best particle position relative to the current iteration The distance and average position of the particle population and The difference updates the new position of the particle.
[0010] S3. Using the change in fitness value and the particle velocity of the current iteration And the best fitness value Improved particle optimization weight factor of special relativity search algorithm , further improve the position update mathematical model of the special relativity search algorithm.
[0011] S4. Use the improved special relativity search algorithm (βSRS) to adjust the number of hidden layer nodes s and the initial learning rate α parameter of the LSTM model to obtain the βSRS-LSTM model.
[0012] S5. Use the data preprocessed by S1 as input to the βSRS-LSTM model, use the βSRS-LSTM model to process the preprocessed data, and output the power marketing risk prediction data value.
[0013] Preferably, step S1 affects power marketing risk prediction data, wherein historical power marketing data includes power sales volume, power sales revenue, and the number of power users; wherein market factor data includes market share value and competitor price value; wherein social factor data includes regional population density; wherein power system data includes power generation and load demand.
[0014] Preferably, the step S1 preprocesses the data affecting the prediction of power marketing risks, and after the preprocessing, the data is divided into a training set and a test set, 70% of the data is used as the training set, and 30% of the data is used as the test set, and the LSTM model is trained using the training set, wherein the specific steps of the preprocessing are:
[0015] S11. Use the mean to fill the missing values that affect the power marketing risk prediction data, and fill the calculated mean to the position of the missing value; the mean mathematical model is:
[0016] ;
[0017] In the formula, is the mean value of the filling, is the number of non-missing values, For the non-missing values;
[0018] S12. Use maximum and minimum value normalization to scale all data affecting power marketing risk prediction to between 0 and 1; the mathematical model is:
[0019] ;
[0020] In the formula, is the normalized risk prediction data affecting power marketing, To provide the raw data that influences the prediction of power marketing risks, and are the minimum and maximum values of the data respectively.
[0021] Preferably, the "relative convergence" strategy model in step S2 is used to improve the position update strategy of the special relativity search algorithm, and the mathematical formula of the "relative convergence" strategy model is:
[0022] (1);
[0023] In formula (1), For the Iteration No. Particle No. The location of the dimension, For the Iteration No. Particle No. The position of the dimension, that is, the current position of the particle, is the global optimal particle position, is the Levy distribution function, For the problem dimension, For the The average position of the particle population in the iteration, For the The best particle position of the iteration, for and distance.
[0024] Preferably, the position update strategy of the standard special relativity search algorithm combines the global search and local development of the algorithm, and updates the algorithm particle position through a position update mathematical model. This method can improve the global search performance of the algorithm, but makes the local convergence performance of the algorithm poor. The "relative convergence" strategy model is used as the local convergence position update mathematical model of the special relativity search algorithm, thereby improving the position update strategy of the special relativity search algorithm. The "relative convergence" strategy model is added to improve the local convergence accuracy of the special relativity search algorithm. The function can enhance the ability of the special relativity algorithm to jump out of the local optimum during the local convergence phase, by using the current position of the particle Relative to the current iteration's best position The particle convergence step size is designed based on the distance to avoid the special relativity search algorithm from falling into the local optimum when adjusting the number of hidden layer nodes s and the initial learning rate α parameters of the LSTM model.
[0025] Preferably, the step S3 improves the particle optimization weight factor of the special relativity search algorithm , the specific steps are:
[0026] S31. In the global search stage, the particle optimization weight factor is large to enhance the global search capability; in the global search and local convergence balance stage, the particle optimization weight factor gradually decreases to balance the global search and local convergence; in the local convergence stage, the particle optimization weight factor is small to enhance the local convergence capability. The particle optimization weight factor is designed according to formula (2): Piecewise nonlinear adaptive mathematical model of
[0027] (2);
[0028] In formula (2), is the maximum value of the particle optimization weight factor, which is 1. is the minimum value of the particle optimization weight factor, which is 0.01. , is the parameter that controls the nonlinear decay rate. is the number of iterations in the global search phase, and its value is , is the number of iterations in the equilibrium phase, and its value is , is the number of iterations in the local convergence stage, and its value is ; is the current iteration number, For the Iteration No. Particle balance factor, the mathematical model is:
[0029] (3);
[0030] In formula (3), For the Iteration No. The fitness value of the particle position, For the The maximum fitness value of the particle position in the iteration, For the The minimum fitness value of the particle position in the iteration;
[0031] S32, using the change in fitness value and the particle velocity of the current iteration And the historical best fitness value The particle optimization weight factor is improved. The improved mathematical model of the particle optimization weight factor is:
[0032] (4);
[0033] In formula (4), is the improved particle optimization weight factor, is the adjustment coefficient of the fitness function value, and its value is 0.5. is the adjustment coefficient of particle velocity, and its value is 0.2. is the change in fitness value, that is, the difference between the current fitness of the particle and the historical best fitness. is a very small value, taking the value as 0.01. It is the maximum value of all current particle speeds.
[0034] Preferably, the step S3 further improves the position update mathematical model of the special relativity search algorithm using the improved particle optimization weight factor, wherein the position update mathematical model includes the global search phase position mathematical model and the local convergence position update mathematical model of the special relativity search algorithm;
[0035] Among them, the improved mathematical model of the global search stage position is: (5);
[0037] In formula (5), For the Iteration No. Particle No. The location of the dimension, is the improved particle optimization weight factor, For the Iteration No. The coordinates of the particles; For the Iteration No. The particle speed, that is, the particle speed of the current iteration;
[0038] Among them, the improved mathematical model of the local convergence stage position is:
[0039] (6).
[0040] Preferably, the step S4 uses an improved special relativity search algorithm to adjust the number of hidden layer nodes s and the initial learning rate α parameter of the LSTM model, and the specific steps are:
[0041] S41, encoding the number of hidden layer nodes s and the initial learning rate α parameter of the LSTM model for power marketing risk prediction into a space vector solution set, and mapping the space vector solution set to the particle position of the improved special relativity search algorithm through real number encoding;
[0042] S42. Initialize the parameters of the improved special relativity search algorithm, including: the maximum size of the particle population , maximum number of iterations , Problem Dimension and the upper bound of the particle position and the lower bound and the maximum value of the particle optimization weight factor and minimum value ;
[0043] S43, initial stage, current number of iterations , use formula (7) to randomly initialize the current positions of N particles ;
[0044] (7);
[0045] In formula (7), is a random number between 0 and 1;
[0046] S44, current iteration number implement , determine the current number of iterations and the maximum number of iterations ,like Less than If yes, execute S45 to S46, otherwise execute S47;
[0047] S45, simulating the principle of special relativity to establish a position update mathematical model of an improved special relativity search algorithm, and updating the particle position of the improved special relativity search algorithm through the position update mathematical model;
[0048] S46. Using formula (8) fitness function Calculate the fitness value of the individual particle position and retain the individual particle position with the smallest fitness value in the current iteration;
[0049] (8);
[0050] In formula (8), is the number of test set data samples, For the The true value of the validation set samples, For the The predicted value of the validation set samples;
[0051] S47. The individual particle position corresponding to the global minimum fitness value is resolved into the number of hidden layer nodes n and the initial learning rate α parameter value of the LSTM model for power marketing risk prediction, and the prediction parameter value of the optimal LSTM model is obtained.
[0052] Preferably, the principle of special theory of relativity is simulated to establish a position update mathematical model of an improved special theory of relativity search algorithm, and the specific method is as follows:
[0053] S451, using the Euclidean norm to determine the current The coordinates of a particle and a random particle in a magnetic field The distance between the coordinates , establish the mathematical model according to formula (9);
[0054] (9);
[0055] In formula (9), For the Iteration No. The coordinates of the particles, For the Iteration No. The coordinates of the particles;
[0056] S452, calculate the current magnetic field particles and a random particle The charge of is established according to formula (10);
[0057] ; (10);
[0058] In formula (10), For the The charge value of a particle, For the The charge value of a particle, For the Iteration No. The fitness value of the particle position, For the The maximum fitness value of the particle position in the iteration, For the The minimum fitness value of the particle position in the iteration; For the Iteration No. The fitness value of each particle position;
[0059] S453, simulating and calculating the moving speed of particles in the magnetic field, and establishing a mathematical model according to formula (11);
[0060] (11);
[0061] In formula (11), For the Iteration No. The speed of a particle, For the Iteration No. The speed of a particle, is the magnetic permeability coefficient, is the mass of the particle, For the Particles and particles The separation distance between
[0062] S454, simulating the calculation of the frequency of the cyclotron accelerator through the magnetic field B, the particle charge and the particle mass, and establishing a mathematical model according to formula (12);
[0063] (12);
[0064] In formula (12), is the frequency of the cyclotron;
[0065] S455. Based on the calculation of particle coordinates based on special relativity, , according to formula (13), the particle coordinate update mathematical model is established;
[0066] (13);
[0067] In formula (13), For the Iteration No. The coordinates of the particles, For the Iteration No. The coordinates of the particles;
[0068] S456. Using formula (9) to formula (13) to design a particle position update mathematical model in the global search phase, introducing a "relative convergence" strategy model as a particle position update mathematical model in the local convergence phase, and establishing an improved particle position update mathematical model according to formula (14);
[0069] (14).
[0070] In summary, due to the adoption of the technical solution, the present invention has the following effects: the present invention proposes a "relative convergence" strategy model, and uses the "relative convergence" strategy model as a position update mathematical model of the special relativity search algorithm in the local convergence stage, thereby improving the position update strategy of the special relativity search algorithm, and improving the local convergence accuracy of the special relativity search algorithm and the ability to jump out of the global suboptimal solution; improving the particle optimization weight factor of the special relativity search algorithm The improved particle optimization weight factor is integrated into the position update mathematical model of the improved special relativity search algorithm. In the global search stage, the particle optimization weight factor is large, which enhances the global search ability of the algorithm; in the global search and local convergence balance stage, the particle optimization weight factor gradually decreases to balance the global search and local convergence; in the local convergence stage, the particle optimization weight factor is small, which enhances the local convergence ability of the algorithm and avoids the algorithm from falling into the global suboptimal solution; the improved special relativity search algorithm improves the performance of the SRS-LSTM prediction model and obtains the βSRS-LSTM prediction model. The βSRS-LSTM prediction model is applied to the power marketing risk prediction, further optimizes the marketing strategy, and improves the accuracy and timeliness of the power marketing risk prediction in complex environments. BRIEF DESCRIPTION OF THE DRAWINGS
[0071] Figure 1 This is a step diagram of an optimization method for power marketing risk prediction.
[0072] Figure 2 Flowchart for tuning the number of hidden layer nodes s and initial learning rate α parameters of the LSTM model using the improved special relativity search algorithm.
[0073] Figure 3 Comparison of the fitness of the special relativity search algorithm before and after the improvement of the number of hidden layer nodes s and the initial learning rate α parameters.
[0074] Figure 4 Comparison chart of accuracy errors of power marketing risk prediction achieved by optimizing LSTM network using special relativity search algorithm before and after improvement.
[0075] Figure 5 Comparison chart of risk prediction values for power marketing achieved by optimizing LSTM network using special relativity search algorithm before and after improvement. DETAILED DESCRIPTION
[0076] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments; based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0077] See also Figure 1-Figure 5 The present invention provides a technical solution: a method for optimizing the prediction of power marketing risk, which improves the local convergence speed and the ability to jump out of the local optimum of the SRS algorithm by improving the special relativity search algorithm, thereby improving the performance of the SRS-LSTM prediction model and obtaining the βSRS-LSTM prediction model. The specific steps are as follows: Figure 1 shown.
[0078] S1. Pre-process the historical power marketing data, market factor data, social factor data, and power system data that affect power marketing risk prediction.
[0079] Furthermore, the power marketing risk prediction data is affected, wherein the historical power marketing data includes power sales volume, power sales revenue, and the number of power users; wherein the market factor data includes market share value and competitor price value; wherein the social factor data includes regional population density; wherein the power system data includes power generation and load demand.
[0080] Furthermore, the data affecting the prediction of power marketing risks are preprocessed. After preprocessing, the data are divided into a training set and a test set. 70% of the data is used as the training set and 30% of the data is used as the test set. The training set is used to train the LSTM model. The specific steps of preprocessing are as follows:
[0081] S11. Use the mean to fill the missing values that affect the power marketing risk prediction data, and fill the calculated mean to the position of the missing value; the mean mathematical model is:
[0082] ;
[0083] In the formula, is the mean value of the filling, is the number of non-missing values, For the non-missing values;
[0084] S12. Use maximum and minimum value normalization to scale all data affecting power marketing risk prediction to between 0 and 1; the mathematical model is:
[0085] ;
[0086] In the formula, is the normalized risk prediction data affecting power marketing, To provide the raw data that influences the prediction of power marketing risks, and are the minimum and maximum values of the data respectively.
[0087] S2. Using the “relative convergence” strategy model as the position update mathematical model of the special relativity search algorithm in the local convergence stage, the position update strategy of the special relativity search algorithm is improved. The “relative convergence” strategy model is based on the global optimal particle position of the special relativity search algorithm. As the center, according to the current position of the particle The best particle position relative to the current iteration The distance and average position of the particle population and The difference updates the new position of the particle.
[0088] Furthermore, the “relative convergence” strategy model is used to improve the position update strategy of the special relativity search algorithm. The mathematical formula of the “relative convergence” strategy model is:
[0089] (1);
[0090] In formula (1), For the Iteration No. Particle No. The location of the dimension, For the Iteration No. Particle No. The position of the dimension, that is, the current position of the particle, is the global optimal particle position, is the Levy distribution function, For the problem dimension, For the The average position of the particle population in the iteration, For the The best particle position of the iteration, for and distance.
[0091] S3. Using the change in fitness value and the particle velocity of the current iteration And the best fitness value Improved particle optimization weight factor of special relativity search algorithm , further improve the position update mathematical model of the special relativity search algorithm.
[0092] Furthermore, the particle optimization weight factor of the special relativity search algorithm is improved , the specific steps are:
[0093] S31. In the global search stage, the particle optimization weight factor is large to enhance the global search capability; in the global search and local convergence balance stage, the particle optimization weight factor gradually decreases to balance the global search and local convergence; in the local convergence stage, the particle optimization weight factor is small to enhance the local convergence capability. The particle optimization weight factor is designed according to formula (2): Piecewise nonlinear adaptive mathematical model of
[0094] (2);
[0095] In formula (2), is the maximum value of the particle optimization weight factor, which is 1. is the minimum value of the particle optimization weight factor, which is 0.01. , is the parameter that controls the nonlinear decay rate. is the number of iterations in the global search phase, and its value is , is the number of iterations in the equilibrium phase, and its value is , is the number of iterations in the local convergence stage, and its value is ; is the current iteration number, For the Iteration No. Particle balance factor, the mathematical model is:
[0096] (3);
[0097] In formula (3), For the Iteration No. The fitness value of the particle position, For the The maximum fitness value of the particle position in the iteration, For the The minimum fitness value of the particle position in the iteration;
[0098] S32, using the change in fitness value and the particle velocity of the current iteration And the historical best fitness value The particle optimization weight factor is improved. The improved mathematical model of the particle optimization weight factor is:
[0099] (4);
[0100] In formula (4), is the improved particle optimization weight factor, is the adjustment coefficient of the fitness function value, and its value is 0.5. is the adjustment coefficient of particle velocity, and its value is 0.2. is the change in fitness value, that is, the difference between the current fitness of the particle and the historical best fitness. is a very small value, taking the value as 0.01. It is the maximum value of all current particle speeds.
[0101] Furthermore, the improved particle optimization weight factor is used to further improve the position update mathematical model of the special relativity search algorithm, wherein the position update mathematical model includes the global search phase position mathematical model and the local convergence position update mathematical model of the special relativity search algorithm;
[0102] Among them, the improved mathematical model of the global search stage position is:
[0103] (5);
[0104] In formula (5), For the Iteration No. Particle No. The location of the dimension, is the improved particle optimization weight factor, For the Iteration No. The coordinates of the particles; For the Iteration No. The particle speed, that is, the particle speed of the current iteration;
[0105] Among them, the improved mathematical model of the local convergence stage position is:
[0106] (6).
[0107] S4. Use the improved special relativity search algorithm (βSRS) to adjust the number of hidden layer nodes s and the initial learning rate α parameter of the LSTM model to obtain the βSRS-LSTM model.
[0108] Furthermore, if Figure 2 As shown in the figure, the number of hidden layer nodes s and the initial learning rate α parameters of the LSTM model are adjusted using the improved special relativity search algorithm. The specific steps are:
[0109] S41, encoding the number of hidden layer nodes s and the initial learning rate α parameter of the LSTM model for power marketing risk prediction into a space vector solution set, and mapping the space vector solution set to the particle position of the improved special relativity search algorithm through real number encoding;
[0110] S42. Initialize the parameters of the improved special relativity search algorithm, including: the maximum size of the particle population , maximum number of iterations , Problem Dimension and the upper bound of the particle position and the lower bound and the maximum value of the particle optimization weight factor and minimum value ;
[0111] S43, initial stage, current number of iterations , use formula (7) to randomly initialize the current positions of N particles ;
[0112] (7);
[0113] In formula (7), is a random number between 0 and 1;
[0114] S44, current iteration number implement , determine the current number of iterations and the maximum number of iterations ,like Less than If yes, execute S45 to S46, otherwise execute S47;
[0115] S45, simulating the principle of special relativity to establish a position update mathematical model of an improved special relativity search algorithm, and updating the particle position of the improved special relativity search algorithm through the position update mathematical model;
[0116] S46. Using formula (8) fitness function Calculate the fitness value of the individual particle position and retain the individual particle position with the smallest fitness value in the current iteration;
[0117] (8);
[0118] In formula (8), is the number of test set data samples, For the The true value of the validation set samples, For the The predicted value of the validation set samples;
[0119] S47. The individual particle position corresponding to the global minimum fitness value is resolved into the number of hidden layer nodes n and the initial learning rate α parameter value of the LSTM model for power marketing risk prediction, and the prediction parameter value of the optimal LSTM model is obtained.
[0120] Furthermore, the principle of special relativity is simulated to establish a position update mathematical model of the improved special relativity search algorithm. The specific method is as follows:
[0121] S451, using the Euclidean norm to determine the current The coordinates of a particle and a random particle in a magnetic field The distance between the coordinates , establish the mathematical model according to formula (9);
[0122] (9);
[0123] In formula (9), For the Iteration No. The coordinates of the particles, For the Iteration No. The coordinates of the particles;
[0124] S452, calculate the current magnetic field particles and a random particle The charge of is established according to formula (10);
[0125] ; (10);
[0126] In formula (10), For the The charge value of a particle, For the The charge value of a particle, For the Iteration No. The fitness value of the particle position, For the The maximum fitness value of the particle position in the iteration, For the The minimum fitness value of the particle position in the iteration; For the Iteration No. The fitness value of each particle position;
[0127] S453, simulating and calculating the moving speed of particles in the magnetic field, and establishing a mathematical model according to formula (11);
[0128] (11);
[0129] In formula (11), For the Iteration No. The speed of a particle, For the Iteration No. The speed of a particle, is the magnetic permeability coefficient, is the mass of the particle, For the Particles and particles The separation distance between
[0130] S454, simulating the calculation of the frequency of the cyclotron accelerator through the magnetic field B, the particle charge and the particle mass, and establishing a mathematical model according to formula (12);
[0131] (12);
[0132] In formula (12), is the frequency of the cyclotron;
[0133] S455. Based on the calculation of particle coordinates based on special relativity, , according to formula (13), the particle coordinate update mathematical model is established;
[0134] (13);
[0135] In formula (13), For the Iteration No. The coordinates of the particles, For the Iteration No. The coordinates of the particles;
[0136] S456. Use formula (9) to formula (13) to design a particle position update mathematical model in the global search phase, introduce the "relative convergence" strategy model as the particle position update mathematical model in the local convergence phase, and establish an improved particle position update mathematical model according to formula (14);
[0137] (14).
[0138] S5. Use the data preprocessed by S1 as input to the βSRS-LSTM model, use the βSRS-LSTM model to process the preprocessed data, and output the power marketing risk prediction data value.
[0139] Furthermore, 120 sets of data samples affecting power marketing risk prediction are stored in the form of eight inputs and one output in an xlsx file. The standard LSTM model prediction program, the standard special relativity search algorithm (SRS) and the improved special relativity search algorithm (βSRS) are designed and written in MATLAB, and the maximum size of the particle population is set. =40, maximum number of iterations =40, problem dimension D=2 and upper bound of particle position =[150,80,0.05, 1e-3] and lower bound =[30,50,0.001, 1e-4] and the maximum value of the particle optimization weight factor =1 and minimum value =0.01; the root mean square error function is used as the fitness function, and the standard LSTM model is optimized by the standard special relativity search algorithm (SRS) and the improved special relativity search algorithm (βSRS). The obtained SRS-LSTM prediction model program and βSRS-LSTM prediction model program and the standard LSTM model prediction program are run through three files respectively. The xlsx file affecting the power marketing risk prediction data is input into the three prediction model files. The three prediction model programs are run in the order of the standard LSTM prediction model, the SRS-LSTM prediction model, and the βSRS-LSTM prediction model. The output is as follows Figure 3 , Figure 4 , Figure 5 Effect comparison chart.
[0140] Furthermore, Figure 3 The changes in the root mean square error (RMSE) fitness values of the SRS-LSTM prediction model and the βSRS-LSTM prediction model as the number of iterations changes. The smaller the fitness value, the better the performance of the algorithm in adjusting the number of hidden layer nodes s and the initial learning rate α parameters of the LSTM model, which will also reduce the error between the predicted value and the true value of the power marketing risk. Figure 3 It can be clearly seen that the SRS optimized LSTM model represented by the dotted line has a higher root mean square error value, which starts at about 0.048. As the number of iterations increases, the fitness value gradually decreases, but after reaching a certain number of iterations (about the 5th iteration), it tends to stabilize and reaches 0.034; the βSRS optimized LSTM model represented by the solid line has a lower root mean square error value, which starts at about 0.034 and quickly reaches a stable value of about 0.029 in the early iteration process, indicating that the model converges faster, and the improved special relativity search algorithm has better performance in adjusting the number of hidden layer nodes s and the initial learning rate α parameters of the LSTM model.
[0141] Furthermore, Figure 4The error of power marketing risk prediction of different models, LSTM, SRS-LSTM, and βSRS-LSTM, is shown, that is, the difference between the predicted value and the target value; the error of the LSTM model represented by the dotted line has the largest fluctuation and a large error value range of -25 to 25, indicating that the model is not stable enough for power marketing risk prediction; the error of the SRS-LSTM model represented by the dotted line has a smaller fluctuation, but there are still some large error values of -8 to 8; the error of the βSRS-LSTM model represented by the solid line has the smallest fluctuation and the smallest error value range of about -2 to 2, indicating that the βSRS-LSTM model is the most accurate and stable for power marketing risk prediction, achieving the purpose of strategy optimization.
[0142] Furthermore, Figure 5 The comparison between the predicted values and target values of power marketing risks by different models including LSTM, SRS-LSTM and βSRS-LSTM is shown. The predicted value of the standard LSTM model represented by the thick dotted line shows that there is a big gap between its predicted result and the target value. The dotted line plus sign represents the predicted value of power marketing risk by the SRS-LSTM model, which has a small fluctuation and is close to the target value, but there are still obvious errors in some data points. The solid line plus circle symbol represents the predicted value of power marketing risk by the βSRS-LSTM model, which is the most stable and closest to the target value, thus achieving strategy optimization.
Claims
1. A method for optimizing power marketing risk prediction. It is characterized in that The specific steps are: S1. Preprocess the historical power marketing data, market factor data, social factor data, and power system data that affect the prediction of power marketing risks; the historical power marketing data includes power sales volume, power sales revenue, and the number of power users; the market factor data includes market share value and competitor price value; the social factor data includes regional population density; and the power system data includes power generation and load demand; S2. Using the "relative convergence" strategy model as the position update mathematical model of the special relativity search algorithm in the local convergence stage, the position update strategy of the special relativity search algorithm is improved. The "relative convergence" strategy model is based on the global optimal particle position of the special relativity search algorithm. As the center, according to the current position of the particle The best particle position relative to the current iteration The distance and average position of the particle population and The difference between the two updates the new position of the particle; S3. Using the change in fitness value and the particle velocity of the current iteration And the best fitness value Improved particle optimization weight factor of special relativity search algorithm , further improve the position update mathematical model of the special relativity search algorithm; S4, using the improved special relativity search algorithm to adjust the number of hidden layer nodes s and the initial learning rate α parameter of the LSTM model, and obtain the βSRS-LSTM model; S5, using the data preprocessed by S1 as an input to the βSRS-LSTM model, processing the preprocessed data using the βSRS-LSTM model, and outputting a power marketing risk prediction data value; Among them, the mathematical formula of the "relative convergence" strategy model in S2 is: (1); In formula (1), For the Iteration No. Particle No. The location of the dimension, For the Iteration No. Particle No. The position of the dimension, that is, the current position of the particle, is the global optimal particle position, is the Levy distribution function, For the problem dimension, For the The average position of the particle population in the iteration, For the The best particle position of the iteration, for and The Euler distance of Weight factor for particle optimization in S3 The specific steps for improvement are: S31. In the global search stage, the particle optimization weight factor is large to enhance the global search capability; in the global search and local convergence balance stage, the particle optimization weight factor gradually decreases to balance the global search and local convergence; in the local convergence stage, the particle optimization weight factor is small to enhance the local convergence capability. The particle optimization weight factor is designed according to formula (2): Piecewise nonlinear adaptive mathematical model of (2); In formula (2), is the maximum value of the particle optimization weight factor, which is 1. is the minimum value of the particle optimization weight factor, which is 0.
01. , is the parameter that controls the nonlinear decay rate. is the number of iterations in the global search phase, and its value is , is the number of iterations in the equilibrium phase, and its value is , is the number of iterations in the local convergence stage, and its value is ; is the current iteration number, For the Iteration No. Particle balance factor, the mathematical model is: (3); In formula (3), For the Iteration No. The fitness value of the particle position, For the The maximum fitness value of the particle position in the iteration, For the The minimum fitness value of the particle position in the iteration; S32, using the change in fitness value and the particle velocity of the current iteration And the historical best fitness value The particle optimization weight factor is improved. The improved mathematical model of the particle optimization weight factor is: (4); In formula (4), is the improved particle optimization weight factor, is the adjustment coefficient of the fitness function value, and its value is 0.
5. is the adjustment coefficient of particle velocity, and its value is 0.
2. is the change in fitness value, that is, the difference between the current fitness of the particle and the historical best fitness. is a very small value, taking the value as 0.
01. It is the maximum value of all current particle speeds.
2. According to claim 1, a method for optimizing power marketing risk prediction, It is characterized in that The step S3 further improves the position update mathematical model of the special relativity search algorithm by using the improved particle optimization weight factor, wherein the position update mathematical model includes the global search phase position mathematical model and the local convergence position update mathematical model of the special relativity search algorithm; Among them, the improved mathematical model of the global search stage position is: (5); In formula (5), For the Iteration No. Particle No. The location of the dimension, is the improved particle optimization weight factor, For the Iteration No. The coordinates of the particles; For the Iteration No. The particle speed, that is, the particle speed of the current iteration; Among them, the improved mathematical model of the local convergence stage position is: (6); In formula (6), For the Iteration No. Particle No. The location of the dimension, For the Iteration No. Particle No. The position of the dimension, that is, the current position of the particle, is the global optimal particle position, is the Levy distribution function, For the problem dimension, For the The average position of the particle population in the iteration, For the The best particle position of the iteration, for and The Euler distance of .
3. According to claim 2, a method for optimizing power marketing risk prediction, It is characterized in that The principle of special relativity is simulated to establish the position update mathematical model of the improved special relativity search algorithm. The specific method is as follows: S451, using the Euclidean norm to determine the current The coordinates of a particle and a random particle in a magnetic field The distance between the coordinates , establish the mathematical model according to formula (9); (9); In formula (9), For the Iteration No. The coordinates of the particles, For the Iteration No. The coordinates of the particles; S452, calculate the current magnetic field particles and a random particle The charge of is established according to formula (10); ; (10); In formula (10), For the The charge value of a particle, For the The charge value of a particle, For the Iteration No. The fitness value of the particle position, For the The maximum fitness value of the particle position in the iteration, For the The minimum fitness value of the particle position in the iteration; For the Iteration No. The fitness value of each particle position; S453, simulating and calculating the moving speed of particles in the magnetic field, and establishing a mathematical model according to formula (11); (11); In formula (11), For the Iteration No. The speed of a particle, For the Iteration No. The speed of a particle, is the magnetic permeability coefficient, is the mass of the particle, For the Particles and particles The separation distance between S454, simulating the calculation of the frequency of the cyclotron accelerator through the magnetic field B, the particle charge and the particle mass, and establishing a mathematical model according to formula (12); (12); In formula (12), is the frequency of the cyclotron; S455. Based on the calculation of particle coordinates based on special relativity, , according to formula (13), the particle coordinate update mathematical model is established; (13); In formula (13), For the Iteration No. The coordinates of the particles, For the Iteration No. The coordinates of the particles; S456. Use formula (9) to formula (13) to design a particle position update mathematical model in the global search phase, introduce the "relative convergence" strategy model as the particle position update mathematical model in the local convergence phase, and establish an improved particle position update mathematical model according to formula (14); (14)。 4. A method for optimizing power marketing risk prediction according to any one of claims 1 to 3, It is characterized in that The step S4 uses the improved special relativity search algorithm to adjust the number of hidden layer nodes s and the initial learning rate α parameter of the LSTM model, and the specific steps are: S41, encoding the number of hidden layer nodes s and the initial learning rate α parameter of the LSTM model for power marketing risk prediction into a space vector solution set, and mapping the space vector solution set to the particle position of the improved special relativity search algorithm through real number encoding; S42. Initialize the parameters of the improved special relativity search algorithm, including: the maximum size of the particle population , maximum number of iterations , Problem Dimension and the upper bound of the particle position and the lower bound and the maximum value of the particle optimization weight factor and minimum value ; S43, initial stage, current number of iterations , use formula (7) to randomly initialize the current positions of N particles ; (7); In formula (7), is a random number between 0 and 1; S44, current iteration number implement , determine the current number of iterations and the maximum number of iterations ,like Less than If yes, execute S45 to S46, otherwise execute S47; S45, simulating the principle of special relativity to establish a position update mathematical model of an improved special relativity search algorithm, and updating the particle position of the improved special relativity search algorithm through the position update mathematical model; S46. Using formula (8) fitness function Calculate the fitness value of the individual particle position and retain the individual particle position with the smallest fitness value in the current iteration; (8); In formula (8), is the number of test set data samples, For the The true value of the validation set samples, For the The predicted value of the validation set samples; S47. The individual particle position corresponding to the global minimum fitness value is resolved into the number of hidden layer nodes n and the initial learning rate α parameter value of the LSTM model for power marketing risk prediction, and the prediction parameter value of the optimal LSTM model is obtained.
