Power prediction method, system and equipment based on group algorithm

Through the power forecasting method based on the swarm algorithm, combined with the PSO and GA optimized deep learning model, the data dependence and model complexity problems in the existing power forecasting methods are solved, and more efficient and robust power forecasting and strategy generation are achieved. Maintenance costs are reduced.

CN118643941APending Publication Date: 2024-09-13GUANGXI POWER GRID CORP
View PDF 0 Cites 7 Cited by

Patent Information

Application Number
CN202410859448.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-28
Publication Date
2024-09-13

AI Technical Summary

Technical Problem

Existing power forecasting methods have problems such as data dependence, model complexity, over-fitting and under-fitting, and high model maintenance costs, making it difficult to achieve high-accuracy power forecasting in practical applications.

Method used

A power forecasting method based on swarm algorithm is used to obtain data through the API interface for cleaning and standardization. It combines particle swarm optimization (PSO) and genetic algorithm (GA) to optimize the parameters of the deep learning model to form an integrated model, and dynamically adjust the model through a real-time forecasting system. to adapt to environmental changes.

Benefits of technology

It improves the accuracy and robustness of power forecasting, reduces model maintenance costs, avoids local optimal solutions, and achieves more efficient power forecasting and strategy generation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118643941A
    Figure CN118643941A
Patent Text Reader

Abstract

The invention is suitable for the technical field of electric power prediction, and provides an electric power prediction method, system and device based on a swarm algorithm, and the method comprises the steps: S1, obtaining electric power prediction data through an API interface, carrying out the data cleaning and standardization of the obtained prediction data, and converting the data into a data set which is consistent in structure and is suitable for analysis; s2, combining PSO (Particle Swarm Optimization) with a genetic algorithm by adopting a hybrid swarm intelligence algorithm, and optimizing a deep learning model; s3, optimizing the combination weight of the plurality of basic prediction models by using a swarm intelligence algorithm to form an integrated model; s4, performing performance prediction evaluation on the integrated model; s5, deploying the integrated model into a real-time prediction system, continuously receiving new data, performing prediction, and establishing a feedback mechanism; and S6, continuously monitoring the prediction performance of the model, and recording and analyzing the prediction deviation. The accuracy of power prediction is effectively improved through strong search capability, adaptivity, parallel processing capability and good compatibility with an integrated model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of power forecasting, and in particular to a power forecasting method, system and device based on a swarm algorithm. Background Art

[0002] Although the existing power forecasting methods have their own advantages, they also have some disadvantages in practical applications, which are mainly reflected in the following aspects:

[0003] 1. Data dependency: Many forecasting methods, especially those based on machine learning and statistical models, are highly dependent on the quality and completeness of historical data. If there are missing data, outliers or noise, it will directly affect the accuracy of the forecast.

[0004] 2. Model complexity: Although some advanced forecasting models, such as deep learning models, can capture complex time series patterns, they often require a lot of computing resources and a long training time. In addition, the model is poorly interpretable, making it difficult to intuitively understand the logic behind the forecast.

[0005] 3. Overfitting and underfitting: During model training, overfitting means that the model overlearns the noise in the training data, while underfitting means that the model is too simplified and cannot capture the complex relationships in the data. Balancing the two to achieve good generalization ability is a challenge.

[0006] 4. Model maintenance costs: With the continuous accumulation of new data and changes in the external environment, the prediction model needs to be calibrated and updated regularly, which involves continuous data processing, model optimization and verification work, increasing maintenance costs.

[0007] In view of this, a power forecasting method, system and device based on swarm algorithm are needed. Summary of the invention

[0008] The embodiments of the present application provide a method, system and device for power prediction based on a swarm algorithm, which are used to solve the problem of low power prediction accuracy.

[0009] A first aspect of an embodiment of the present application provides a power prediction method based on a swarm algorithm, comprising:

[0010] S1: Obtain power forecast data through the API interface, clean and standardize the obtained forecast data, and convert it into a structured, consistent and analysis-friendly data set;

[0011] S2: A hybrid population algorithm is used to combine PSO with genetic algorithm to optimize the parameters of deep learning models: long short-term memory network LSTM or convolutional neural network CNN to adapt to the nonlinear, periodic and seasonal characteristics in short-term load forecasting;

[0012] S3: Use swarm algorithms to optimize the combined weights of multiple basic prediction models to form an integrated model;

[0013] S4: Input the data set in step S1 into the integrated model obtained in step S3 to perform performance prediction evaluation of the integrated model;

[0014] S5: Deploy the integrated model to the real-time prediction system, continuously receive new data and make predictions, and establish a feedback mechanism to dynamically adjust model parameters or retrain the model according to the deviation between the actual load and the predicted value to cope with changes in the environment or load pattern;

[0015] S6: Continuously monitor the model prediction performance, record and analyze prediction deviations, iterate and upgrade the algorithm based on new data and business needs, and generate target power forecasting strategies.

[0016] Furthermore, platforms connected to the API interface include power system operators, public data platforms, smart meters and IoT systems. Ways to obtain power forecast data also include calling academic research and shared databases.

[0017] Furthermore, in step S1, the process of data cleaning and standardization specifically includes the following steps:

[0018] S11: Perform data consistency check to ensure that the timestamps of time series data are consistent and resolve mismatches caused by time zone differences or recording errors;

[0019] S12: Perform data missing value processing and outlier detection and processing. For missing values ​​in historical data, interpolation, average value or nearest neighbor value filling are used for processing; outliers are identified and processed through statistical methods. The processing methods include elimination, correction or use of model prediction substitution. Statistical methods include Z-score and IQR;

[0020] S13: Data formats are standardized and all data are converted into a unified format. Timestamps are standardized into the ISO standard format to ensure consistent numerical units.

[0021] Furthermore, in step S1, the data from different sources are merged into a unified database or data frame, the overlapping time intervals between different data sets are handled, all time series data are ensured to be aligned at the same time interval, the data with different sampling frequencies are resampled or aggregated, and the sorted data set is divided into training set, validation set and test set in a ratio of 70%:15%:15% for subsequent training, tuning and performance evaluation of the integrated model.

[0022] Furthermore, in step S2, the parameters of a deep learning model such as a long short-term memory network LSTM or a convolutional neural network CNN are optimized by GA-PSO, and the steps are as follows:

[0023] S21: Initialize a population consisting of multiple individuals or particles, each of which represents a set of model parameter settings. For LSTM or CNN, the parameter settings include learning rate, regularization coefficient, number of hidden layer units, and convolution kernel size, and define a fitness function;

[0024] S22: PSO is used to update particles in some iterations, while GA is used to update the population in other iterations, or both are used simultaneously in each iteration. The excellent individuals in GA are used as gBest of PSO, and pBest in PSO is used by GA for selection or crossover. The linear decreasing method is used to dynamically adjust the strategy to adjust the inertia weight in PSO.

[0025] A high inertia weight is set at the beginning. As the number of iterations increases, the inertia weight gradually decreases. The formula is:

[0026] w=w_{start}-(w_{start}-w_{end})\times(\text{current number of iterations} / \text{maximum number of iterations})

[0027] Adjust the crossover rate and mutation rate in GA through time- or generation-dependent strategies:

[0028] Initially set a high crossover rate and a low mutation rate to exploit existing information, and gradually reduce the crossover rate and increase the mutation rate over time or generations;

[0029] S23: When the preset number of iterations is reached, the fitness value reaches a threshold, or the algorithm converges, the iteration is stopped.

[0030] Furthermore, in step S3, the following steps are specifically included:

[0031] S31: Define a fitness function, which quantifies the prediction performance of the model combination as the optimization target in the swarm intelligence algorithm;

[0032] S32: Create an initial population of model weights, where each individual represents a set of model weights, and the weights are initialized randomly or set based on heuristic rules;

[0033] S33: Apply the selection mechanism in the swarm intelligence algorithm to select individuals with good performance from the group in step S32;

[0034] S34: Generate new individuals through crossover and mutation operations;

[0035] S35: Use the training set to evaluate the performance of the ensemble model under different weight configurations for each individual, and score it according to the fitness function;

[0036] S36: Use the GA-PSO optimization algorithm to evaluate the fitness of all particles or individuals, determine the pros and cons, and update the individual best position pBest and the global best position gBest;

[0037] S37: Repeat the above steps S33-S35 until a stop condition is met, where the stop condition includes reaching a preset number of iterations, the fitness improvement is lower than a threshold, or reaching an ideal performance indicator;

[0038] S38: Use the validation set or test set to evaluate the final integrated model to ensure that the model has strong generalization ability and avoid overfitting;

[0039] S39: Apply the best model weights obtained in the optimization process of step S36 to each basic model to form a final integrated model, and apply it in actual tasks.

[0040] Furthermore, in step S5, the integrated model is deployed into the real-time prediction system, which specifically includes the following steps:

[0041] S51: Export the integrated model to a format suitable for deployment;

[0042] S52: Use Docker containerization technology to package the model and its dependent environment;

[0043] S53: Develop a RESTful API so that external systems can call the model for predictions through HTTP requests. Use Python web frameworks such as Flask and Django, or Java frameworks such as Spring Boot to quickly build API services.

[0044] S54: receiving data through API calls;

[0045] S55: Use real-time computing engines, including Apache Flink, Spark Streaming, or Kafka Streams, to process real-time data streams, trigger model predictions, and return prediction results instantly;

[0046] S56: Integrate prediction services into existing business processes and implement monitoring and logging mechanisms to track model performance and system health.

[0047] S57: Load balance, auto-scale, and optimize the performance of services based on actual needs;

[0048] S58: Set up an automated testing and deployment process. After deployment, collect user feedback, monitor the model prediction effect, and adjust the model parameters or algorithms based on actual business performance to form a closed-loop iteration.

[0049] A second aspect of an embodiment of the present application provides a power forecasting system based on a swarm algorithm, comprising:

[0050] A prediction data acquisition unit is used to acquire power prediction data through an API interface, and to clean and standardize the acquired prediction data and convert it into a data set that is consistent in structure and suitable for analysis;

[0051] The learning model optimization unit is used to optimize the parameters of the deep learning model: long short-term memory network LSTM or convolutional neural network CNN by using a hybrid population algorithm to adapt to the nonlinear, periodic and seasonal characteristics in short-term load forecasting;

[0052] An integrated model forming unit, used to optimize the combined weights of multiple basic prediction models using a swarm algorithm to form an integrated model;

[0053] A performance prediction and evaluation unit, used to input the data set in step S1 into the integrated model obtained in step S3 to perform performance prediction and evaluation of the integrated model;

[0054] The model training unit is used to deploy the integrated model into the real-time prediction system, continuously receive new data and make predictions, and establish a feedback mechanism to dynamically adjust the model parameters or retrain the model according to the deviation between the actual load and the predicted value to cope with changes in the environment or load pattern;

[0055] The target power forecasting strategy generation unit is used to continuously monitor the model prediction performance, record and analyze prediction deviations, iteratively upgrade the algorithm according to new data and business needs, and generate a target power forecasting strategy.

[0056] A third aspect of an embodiment of the present application provides a computer device, comprising a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor, wherein when the processor executes the computer-readable instructions, the steps of the power forecasting method based on the swarm algorithm as described in any one of the above are implemented.

[0057] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:

[0058] 1. The GA-PSO hybrid algorithm in the present invention can show superior performance in complex optimization problems by integrating the diversity and global search capability of genetic algorithm with the fast convergence characteristics of particle swarm optimization, especially in scenarios where both search efficiency and solution quality need to be taken into account.

[0059] 2. The swarm intelligence algorithm in the present invention can more effectively avoid local optimal solutions and find global or near-global optimal solutions by searching the solution space simultaneously through multiple agents. This is particularly beneficial for dealing with complex and non-intuitive load patterns in power systems.

[0060] 3. The diversity of individuals in the group in the present invention makes the algorithm more robust. Even if some individuals perform poorly, the entire group can still maintain good prediction performance. This feature is especially important when facing actual situations with missing data or large noise. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] Figure 1 It is a schematic diagram of an embodiment of a power prediction method based on a swarm algorithm in the present invention;

[0062] Figure 2 It is a structural block diagram of an embodiment of a power forecasting system based on a swarm algorithm in the present invention;

[0063] Figure 3 The figure is a structural block diagram of a computer device in the present invention. DETAILED DESCRIPTION

[0064] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0065] In this embodiment, the power prediction method based on the swarm algorithm is used to improve the prediction accuracy. In this embodiment, the implementation method can be implemented in the system, can be implemented in the server, and can also be implemented in the terminal, and the specific details are not clearly limited.

[0066] Embodiment 1

[0067] See also Figure 1 , an embodiment of a power forecasting method based on a swarm algorithm in the present invention comprises the following steps:

[0068] S1: Obtain power forecast data through the API interface, clean and standardize the obtained forecast data, and convert it into a structured, consistent and analysis-friendly data set;

[0069] The ratio of training set-validation set-test set in the data set is: 70%:15%:15% or 60%:20%:20%;

[0070] Platforms that connect to the API interface include power system operators, public data platforms, smart meters and IoT systems. Ways to obtain power forecast data also include calling academic research and shared databases.

[0071] In step S1, the process of data cleaning and standardization specifically includes the following steps:

[0072] S11: Perform data consistency check to ensure that the timestamps of time series data are consistent and resolve mismatches caused by time zone differences or recording errors;

[0073] S12: Data missing value processing and outlier detection and processing are performed. Missing values ​​in historical data are processed by interpolation, average value or nearest neighbor value filling. Outliers are identified and processed by statistical methods, including elimination, correction or use of model prediction substitution. Statistical methods include Z-score and IQR.

[0074] S13: Data formats are standardized and all data are converted into a unified format. Timestamps are standardized into the ISO standard format to ensure consistent numerical units.

[0075] In step S1, the data from different sources are merged into a unified database or data frame, the overlapping time intervals between different data sets are handled properly, all time series data are aligned at the same time interval, data with different sampling frequencies are resampled or aggregated, and the sorted data set is divided into training set, validation set and test set in a ratio of 70%:15%:15% for subsequent training, tuning and performance evaluation of the integrated model.

[0076] S2: A hybrid population algorithm is used to combine PSO with genetic algorithm to optimize the parameters of deep learning models: long short-term memory network LSTM or convolutional neural network CNN to adapt to the nonlinear, periodic and seasonal characteristics in short-term load forecasting;

[0077] In step S2, the parameters of a deep learning model such as a long short-term memory network (LSTM) or a convolutional neural network (CNN) are optimized by GA-PSO, and the steps are as follows:

[0078] S21: Initialize a population consisting of multiple individuals or particles. Each individual represents a set of model parameter settings. For LSTM or CNN, the parameter settings include learning rate, regularization coefficient, number of hidden layer units, and convolution kernel size, and define a fitness function. The fitness function is usually the performance indicator of the model on the validation set. The performance indicators include accuracy, F1 score, or loss value.

[0079] S22: PSO is used to update particles in some iterations, while GA is used to update the population in other iterations, or both are used simultaneously in each iteration. The excellent individuals in GA are used as the historical best position gBest of the PSO group, and the historical best position pBest of the particles in PSO is used by GA for selection or crossover. The validation set is used to evaluate the model performance under the corresponding parameter configuration of each particle.

[0080] The linear decreasing method is used to dynamically adjust the strategy to adjust the inertia weight in PSO;

[0081] At the beginning, a high inertia weight is set. As the number of iterations increases, the inertia weight gradually decreases. The formula is generally:

[0082] w=w_{start}-(w_{start}-w_{end})\times(\text{current number of iterations} / \text{maximum number of iterations})

[0083] Adjust the crossover rate and mutation rate in GA through time- or generation-dependent strategies:

[0084] Initially set a high crossover rate and a low mutation rate to exploit existing information, and gradually reduce the crossover rate and increase the mutation rate over time or generations;

[0085] S23: When the preset number of iterations is reached, the fitness value reaches a threshold, or the algorithm converges, the iteration is stopped.

[0086] S3: Use swarm algorithms to optimize the combined weights of multiple basic prediction models to form an integrated model;

[0087] In step S3, the following steps are specifically included:

[0088] S31: Define a fitness function, which quantifies the prediction performance of the model combination as the optimization target in the swarm intelligence algorithm;

[0089] S32: Create an initial population of model weights, where each individual represents a set of model weights, and the weights are initialized randomly or set based on heuristic rules;

[0090] S33: Apply the selection mechanism in the swarm intelligence algorithm to select individuals with good performance from the group in step S32; this step ensures that excellent characteristics can be inherited.

[0091] S34: Generate new individuals through crossover and mutation. In the context of model weight optimization, crossover may mean exchanging some weights of two individuals, while mutation introduces small random changes in a certain weight to increase population diversity.

[0092] S35: Use the training set to evaluate the performance of the ensemble model under different weight configurations for each individual, and score it according to the fitness function;

[0093] S36: Use the GA-PSO optimization algorithm to evaluate the fitness of all particles or individuals, determine the pros and cons, and update the individual best position pBest and the global best position gBest;

[0094] S37: Repeat the above steps S33-S35 until a stop condition is met, where the stop condition includes reaching a preset number of iterations, the fitness improvement is lower than a threshold, or reaching an ideal performance indicator;

[0095] S38: Use the validation set or test set to evaluate the final integrated model to ensure that the model has strong generalization ability and avoid overfitting;

[0096] S39: Apply the best model weights obtained in the optimization process of step S36 to each basic model to form a final integrated model, and apply it in actual tasks.

[0097] S4: Input the data set in step S1 into the integrated model obtained in step S3 to perform performance prediction evaluation of the integrated model;

[0098] S5: Deploy the integrated model to the real-time prediction system, continuously receive new data and make predictions, and establish a feedback mechanism to dynamically adjust model parameters or retrain the model according to the deviation between the actual load and the predicted value to cope with changes in the environment or load pattern;

[0099] In step S5, the integrated model is deployed into the real-time prediction system, which specifically includes the following steps:

[0100] S51: Ensure that the integrated model has been fully trained and verified, and performs well on the test set, and export the integrated model to a format suitable for deployment, PMML or ONNX format;

[0101] S52: Use Docker containerization technology to package the model and its dependent environments; this way, the model can be run on any server that supports Docker without worrying about environmental differences.

[0102] S53: Develop a RESTful API so that external systems can call the model for predictions through HTTP requests. Use Python web frameworks such as Flask and Django, or Java frameworks such as Spring Boot to quickly build API services.

[0103] S54: receiving data through API calls;

[0104] S55: Use real-time computing engines, including Apache Flink, Spark Streaming, or Kafka Streams, to process real-time data streams, trigger model predictions, and return prediction results instantly; ensure low latency of the system to meet real-time requirements.

[0105] S56: Integrate prediction services into existing business processes and implement monitoring and logging mechanisms to track model performance and system health.

[0106] S57: Load balance, auto-scale, and optimize the performance of services based on actual needs to ensure stable operation even under high concurrent requests.

[0107] S58: Set up automated testing and deployment processes so that models can be quickly and safely deployed to production environments when they are updated or the system changes. After deployment, collect user feedback, monitor the model prediction effect, and adjust model parameters or algorithms based on actual business performance to form a closed-loop iteration.

[0108] S6: Continuously monitor the model prediction performance, record and analyze prediction deviations, iterate and upgrade the algorithm based on new data and business needs, and generate target power forecasting strategies.

[0109] In summary, the present invention provides a more accurate, efficient and flexible means for power system load forecasting through powerful search capability, adaptability, parallel processing capability and good compatibility with integrated models.

[0110] Embodiment 2

[0111] See also Figure 2 , an embodiment of a power forecasting system based on a swarm algorithm in the present invention comprises the following steps:

[0112] The prediction data acquisition unit 101 is used to acquire power prediction data through an API interface, and convert the acquired prediction data into a data set with consistent structure and suitable for analysis after data cleaning and standardization;

[0113] The learning model optimization unit 102 is used to use a hybrid population algorithm to combine PSO with a genetic algorithm to optimize the parameters of a deep learning model: a long short-term memory network LSTM or a convolutional neural network CNN to adapt to nonlinear, periodic and seasonal characteristics in short-term load forecasting;

[0114] An integrated model forming unit 103, used to optimize the combined weights of multiple basic prediction models using a swarm algorithm to form an integrated model;

[0115] The performance prediction and evaluation unit 104 is used to input the data set in step S1 into the integrated model obtained in step S3 to perform performance prediction and evaluation on the integrated model;

[0116] The model training unit 105 is used to deploy the integrated model into the real-time prediction system, continuously receive new data and make predictions, and establish a feedback mechanism to dynamically adjust the model parameters or retrain the model according to the deviation between the actual load and the predicted value to cope with changes in the environment or load pattern;

[0117] The target power forecasting strategy generating unit 106 is used to continuously monitor the model forecasting performance, record and analyze the forecasting deviation, iteratively upgrade the algorithm according to new data and business needs, and generate the target power forecasting strategy.

[0118] Embodiment 3

[0119] See also Figure 3 The present invention provides a computer device, including a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor. When the processor executes the computer-readable instructions, the steps of the above method are implemented.

[0120] Those of ordinary skill in the art will appreciate that the units of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition of each example has been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0121] In the embodiments provided by the present invention, it should be understood that the division of units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units can be combined into one unit, one unit can be split into multiple units, or some features can be ignored. In addition, each functional unit in each embodiment of the present invention can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units.

[0122] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-0nlyMemory), random access memory (RAM, RandomAccessMemory), mobile hard disk, magnetic disk or optical disk, etc., which can store program code.

[0123] It can be understood that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or replace some or all of the technical features therein by equivalents. These modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present invention, and they should all be included in the scope of the claims and specification of the present invention.

Claims

1. A power forecasting method based on a swarm algorithm, characterized in that: include: S1: Obtain power forecast data through the API interface, clean and standardize the obtained forecast data, and convert it into a structured, consistent and analysis-friendly data set; S2: A hybrid population algorithm is used to combine PSO with genetic algorithm to optimize the parameters of deep learning models: long short-term memory network LSTM or convolutional neural network CNN to adapt to the nonlinear, periodic and seasonal characteristics in short-term load forecasting; S3: Use swarm algorithms to optimize the combined weights of multiple basic prediction models to form an integrated model; S4: Input the data set in step S1 into the integrated model obtained in step S3 to perform performance prediction evaluation of the integrated model; S5: Deploy the integrated model to the real-time prediction system, continuously receive new data and make predictions, and establish a feedback mechanism to dynamically adjust model parameters or retrain the model according to the deviation between the actual load and the predicted value to cope with changes in the environment or load pattern; S6: Continuously monitor the model prediction performance, record and analyze prediction deviations, iterate and upgrade the algorithm based on new data and business needs, and generate target power forecasting strategies.

2. The power forecasting method based on swarm algorithm according to claim 1, characterized in that: Platforms that connect to the API interface include power system operators, public data platforms, smart meters and IoT systems. Ways to obtain power forecast data also include calling academic research and shared databases.

3. The power forecasting method based on swarm algorithm according to claim 1, characterized in that: In step S1, the process of data cleaning and standardization specifically includes the following steps: S11: Perform data consistency check to ensure that the timestamps of time series data are consistent and resolve mismatches caused by time zone differences or recording errors; S12: Data missing value processing and outlier detection and processing are performed. Missing values ​​in historical data are processed by interpolation, average value or nearest neighbor value filling. Outliers are identified and processed by statistical methods, including elimination, correction or use of model prediction substitution. Statistical methods include Z-score and IQR. S13: Data formats are standardized and all data are converted into a unified format. Timestamps are standardized into the ISO standard format to ensure consistent numerical units.

4. The power forecasting method based on swarm algorithm according to claim 3 is characterized in that: In step S1, the data from different sources are merged into a unified database or data frame, the overlapping time intervals between different data sets are handled properly, all time series data are aligned at the same time interval, data with different sampling frequencies are resampled or aggregated, and the sorted data set is divided into training set, validation set and test set in a ratio of 70%:15%:15% for subsequent training, tuning and performance evaluation of the integrated model.

5. The power forecasting method based on swarm algorithm according to claim 1, characterized in that: In step S2, the parameters of a deep learning model such as a long short-term memory network (LSTM) or a convolutional neural network (CNN) are optimized by GA-PSO, and the steps are as follows: S21: Initialize a population consisting of multiple individuals or particles, each of which represents a set of model parameter settings. For LSTM or CNN, the parameter settings include learning rate, regularization coefficient, number of hidden layer units, and convolution kernel size, and define a fitness function; S22: PSO is used to update particles in some iterations, while GA is used to update the population in other iterations, or both are used simultaneously in each iteration. The excellent individuals in GA are used as gBest of PSO, and pBest in PSO is used by GA for selection or crossover. The linear decreasing method is used to dynamically adjust the strategy to adjust the inertia weight in PSO. A high inertia weight is set at the beginning. As the number of iterations increases, the inertia weight gradually decreases. The formula is: w=w_{start}-(w_{start}-w_{end})\times(\text{current number of iterations} / \text{maximum number of iterations}) Adjust the crossover rate and mutation rate in GA through time- or generation-dependent strategies: Initially set a high crossover rate and a low mutation rate to exploit existing information, and gradually reduce the crossover rate and increase the mutation rate over time or generations; S23: When the preset number of iterations is reached, the fitness value reaches a threshold, or the algorithm converges, the iteration is stopped.

6. The power forecasting method based on swarm algorithm according to claim 1, characterized in that: In step S3, the following steps are specifically included: S31: Define a fitness function, which quantifies the prediction performance of the model combination as the optimization target in the swarm intelligence algorithm; S32: Create an initial population of model weights, where each individual represents a set of model weights, and the weights are initialized randomly or set based on heuristic rules; S33: Apply the selection mechanism in the swarm intelligence algorithm to select individuals with good performance from the group in step S32; S34: Generate new individuals through crossover and mutation operations; S35: Use the training set to evaluate the performance of the ensemble model under different weight configurations for each individual, and score it according to the fitness function; S36: Use the GA-PSO optimization algorithm to evaluate the fitness of all particles or individuals, determine the pros and cons, and update the individual best position pBest and the global best position gBest; S37: Repeat the above steps S33-S35 until a stop condition is met, where the stop condition includes reaching a preset number of iterations, the fitness improvement is lower than a threshold, or reaching an ideal performance indicator; S38: Use the validation set or test set to evaluate the final integrated model to ensure that the model has strong generalization ability and avoid overfitting; S39: Apply the best model weights obtained in the optimization process of step S36 to each basic model to form a final integrated model, and apply it in actual tasks.

7. The power forecasting method based on swarm algorithm according to claim 1, characterized in that: In step S5, the integrated model is deployed into the real-time prediction system, which specifically includes the following steps: S51: Export the integrated model to a format suitable for deployment; S52: Use Docker containerization technology to package the model and its dependent environment; S53: Develop a RESTful API so that external systems can call the model for predictions through HTTP requests. Use Python web frameworks such as Flask and Django, or Java frameworks such as Spring Boot to quickly build API services. S54: receiving data through API calls; S55: Use real-time computing engines, including Apache Flink, Spark Streaming, or Kafka Streams, to process real-time data streams, trigger model predictions, and return prediction results instantly; S56: Integrate prediction services into existing business processes and implement monitoring and logging mechanisms to track model performance and system health. S57: Load balance, auto-scale, and optimize the performance of services based on actual needs; S58: Set up an automated testing and deployment process. After deployment, collect user feedback, monitor the model prediction effect, and adjust the model parameters or algorithms based on actual business performance to form a closed-loop iteration.

8. A power forecasting system based on a swarm algorithm, characterized in that: include: A prediction data acquisition unit is used to acquire power prediction data through an API interface, and to clean and standardize the acquired prediction data and convert it into a data set that is consistent in structure and suitable for analysis; The learning model optimization unit is used to optimize the parameters of the deep learning model: long short-term memory network LSTM or convolutional neural network CNN by using a hybrid population algorithm to adapt to the nonlinear, periodic and seasonal characteristics in short-term load forecasting; An integrated model forming unit, used to optimize the combined weights of multiple basic prediction models using a swarm algorithm to form an integrated model; A performance prediction and evaluation unit, used to input the data set in step S1 into the integrated model obtained in step S3 to perform performance prediction and evaluation of the integrated model; The model training unit is used to deploy the integrated model into the real-time prediction system, continuously receive new data and make predictions, and establish a feedback mechanism to dynamically adjust the model parameters or retrain the model according to the deviation between the actual load and the predicted value to cope with changes in the environment or load pattern; The target power forecasting strategy generation unit is used to continuously monitor the model prediction performance, record and analyze prediction deviations, iteratively upgrade the algorithm according to new data and business needs, and generate a target power forecasting strategy.

9. A computer device comprising a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor, characterized in that: When the processor executes the computer-readable instructions, the steps of the power forecasting method based on the swarm algorithm as described in any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Electrical load prediction method and system based on Transfomer decoder

    CN119448207A

  • Metering and checking method and system for grouped power consumers

    CN119624702A

  • Intelligent electricity utilization information management system

    CN119671056A

  • Generative artificial intelligence model optimization updating method and device and medium

    CN119961682A

  • A Model Optimization and Update Method, Device, and Medium for Generative Artificial Intelligence

    CN119961682B