ZOA-TEMPO-based load prediction method and device for electric power spot transaction
Through the ZOA-TEMPO method, combined with the TEMPO model and the zebra optimization algorithm, the problems of complex factors and hyperparameter optimization in power load prediction are solved, the prediction accuracy and efficiency are improved, and more accurate power load prediction is achieved.
Patent Information
- Application Number
- CN202410792410.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-19
- Publication Date
- 2024-12-10
AI Technical Summary
Existing power load prediction methods are difficult to effectively capture complex seasonal, trend and uncertain factors, resulting in insufficient prediction accuracy, and hyperparameter optimization depends on manual experience, which is complex and time-consuming.
Using the ZOA-TEMPO-based method, the seasonality, trend and residuals are decomposed through the TEMPO model, combined with the large language model and the zebra optimization algorithm, the hyperparameters are automatically tuned to improve the accuracy of power load prediction.
It improves the accuracy and efficiency of power load prediction, can better handle complex time series data and uncertain factors, and simplifies the hyperparameter optimization process.
Smart Images

Figure CN119109003A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of electric load forecasting, and in particular to a load forecasting method and device for electric power spot trading based on ZOA-TEMPO. Background Art
[0002] With the continuous development of the energy market and the continuous transformation of the power industry, energy Internet has become an important trend in the current global energy development. As a real-time power trading platform, the power spot trading market not only plays a key role in the efficiency and flexibility of the power supply chain, but also has a profound impact on the overall operation and sustainable development of the energy market. Power load forecasting plays a vital role in this dynamic market. Accurate power load forecasting can help power companies formulate reasonable operation plans and appropriate scheduling plans to ensure the stability of the power system. On the other hand, it also helps market participants predict market trends and price fluctuations, make more informed decisions, and deal with market uncertainties. Therefore, load forecasting plays a positive role in improving the efficiency of the power market, stabilizing the energy supply chain, and promoting sustainable development.
[0003] At present, power load forecasting is mainly based on traditional mathematical modeling methods and probability-based artificial intelligence algorithms. Although traditional mathematical modeling methods can accurately predict, their modeling process is extremely challenging and requires consideration of various complex factors. Artificial intelligence methods include neural networks represented by RNN, LSTM, and Transformer, support vector machines, and regression analysis. Although the above methods can predict power load and capture time dependencies, they ignore a series of complex patterns in time series data, such as seasonality and trends. In addition, power load is also greatly affected by external factors such as energy policies, environment, technological development, and economic situation. Such uncertain factors exist objectively and can break the laws of power load, posing a major challenge to the above power load forecasting methods. Therefore, there is still room for further improvement in the accuracy of power load forecasting.
[0004] Large models usually have stronger learning and generalization capabilities, which enable them to adapt to different scenarios and data changes more flexibly, thereby handling complex prediction tasks more effectively. During the training process, large models are often able to discover external factors and associations hidden in the data, providing solutions to the impact of uncertain factors such as energy policies, environment and economic situation on power load forecasting. The introduction of large models is expected to further improve the accuracy of power load forecasting. However, the application of large models in power load forecasting is not yet common.
[0005] In the process of model training, hyperparameters are crucial to the problem-solving error, loss, convergence speed, etc. Reasonable hyperparameters are conducive to obtaining a better model. Therefore, optimizing the model by adjusting the hyperparameters is an essential step. However, the current selection and adjustment of hyperparameters is based on human experience and trial and error. This manual debugging method is relatively complex and time-consuming. In order to further improve the performance of the model, it is necessary to further optimize the hyperparameter selection process. Summary of the invention
[0006] The purpose of the present invention is to propose a load forecasting method and device for power spot trading based on ZOA-TEMPO in view of the shortcomings of the prior art. The method fully considers the impact of complex factors such as seasonal fluctuations, long-term trends and residuals on power load forecasting, and adopts a large model prompt pool to solve the interference of uncertain external factors such as energy policy, environment and economic situation on power load. At the same time, the zebra optimization algorithm is introduced to realize the hyperparameter optimization of the model, which further improves the accuracy of power load forecasting.
[0007] The purpose of the present invention is achieved through the following technical solutions: mainly including:
[0008] Step 1: Collect power load data through power load monitoring equipment and perform preprocessing operations to obtain training sets and test sets.
[0009] Step 2: Use the preprocessed training set and test set to train the TEMPO model to obtain the TEMPO pre-trained model.
[0010] Step 3: Optimize TEMPO based on the zebra optimization algorithm to obtain the suboptimal TEMPO model.
[0011] Step 4: Use the TEMPO pre-trained model to obtain prediction results for a period of time in the future.
[0012] Preferably, the specific steps in step 1 are as follows:
[0013] (a) Through the power load monitoring equipment, the system continuously receives power load data.
[0014] (b) Use the ARIMA (Autoregressive Integrated Moving Average) model to detect outliers and eliminate them.
[0015] (e) Use the rolling window method to divide the training set and the test set. Use the earlier window as the training set and the newer window as the test set to ensure that the model is trained only with past data and its generalization ability to future data is evaluated in the test.
[0016] Preferably, the TEMPO model training process in step 2 is as follows:
[0017] (a) Obtain the trend component X based on the input time series T , Seasonal Component X S , residual component X R ;
[0018] (b) X T , X S , X R The normalization operations are respectively performed to facilitate knowledge transfer and minimize the loss caused by distribution changes.
[0019] (c) Obtain X through Patching T , X S , X R Corresponding Embedding.
[0020] (d) Trend component X T , Seasonal Component X S , residual component X R The corresponding Embedding gets the Prompt according to the prompt word.
[0021] (e) Combine Embedding with Prompt, add position encoding and put it into Transformer module;
[0022] (f) Decode and merge the Transformer output to obtain the predicted power load;
[0023] (g) Evaluation results: The mean absolute percentage error (SMAPE) is particularly sensitive to outliers. When the difference between the predicted result and the real data is large, the SMAPE value is high. Therefore, the present invention selects the mean absolute percentage error (SMAPE) as our evaluation indicator to evaluate our results.
[0024] (h) Loop through (a) to (g) until the exit condition is met.
[0025] ZOA performs optimization by simulating zebra behavior, and has the characteristics of strong optimization ability and fast convergence speed. In step 3, the parameters that need to be optimized in TEMPO include the size of the prompt word, the optimal number of prompts k, the length of the prompt word, and the length of the predicted sequence. The fitness function of ZOA is the SMAPE value after TEMPO training. The process of ZOA training TEMPO is as follows:
[0026] (a) Define the encoding: The encoding is used to represent zebras, where each zebra represents a solution.
[0027] (a) Initialization: Randomly initialize the ZOA population. Each individual in the population is a solution.
[0028] (b) Foraging behavior: The best individual in a zebra population is the pioneer zebra, which guides other zebras to forage and update their positions. That is, the individuals in the population are optimized towards the optimal solution. If the optimization result is good, it will be retained.
[0029] (c) Defense strategy against predators: Zebras choose different strategies against predators, which are divided into escape strategy and attack strategy. That is, the population is optimized through two strategies, and those with better optimization results are retained.
[0030] The fitness function of ZOA is the SMAPE value after TEMPO training, and the optimization goal is to minimize SMAPE.
[0031] The power load forecasting part of the power spot trading system in the system application module continuously receives power load data through power load monitoring equipment and inputs these data into the model to update the data in the model. The system calls the model in real time to predict future power loads, namely:
[0032]
[0033] Beneficial effects of the present invention:
[0034] (1) The present invention adopts the TEMPO architecture to predict the power load in the power spot trading market. By sharing the prompt pool, the large language model is applied to the power load forecasting scenario, so that the model can selectively input the most representative prompts of a single time series instance.
[0035] (2) The present invention integrates seasonality, trend and residual decomposition into the pre-trained model. The decomposition can clearly identify unusual observations and changes in seasonal patterns or trends, further improving the accuracy of power load forecasting.
[0036] (3) The present invention introduces the zebra optimization algorithm, which is used to tune multiple hyperparameters of the TEMPO architecture, so that TEMPO can automatically tune its hyperparameters. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0038] Figure 1 This is the flow chart of the TEMPO model architecture.
[0039] Figure 2Flowchart of the combination of Zebra optimization algorithm and TEMPO.
[0040] Figure 3 Schematic diagram of the overall architecture of the system's power load forecasting.
[0041] Figure 4 It is a structural diagram of a load forecasting device for power spot trading based on ZOA-TEMPO of the present invention. DETAILED DESCRIPTION
[0042] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described below in conjunction with the accompanying drawings and implementation examples. It should be understood that the specific implementation examples described herein are only used to explain the present invention and are not used to limit the present invention.
[0043] The present invention provides a load forecasting method for power spot trading based on ZOA-TEMPO, and the specific steps are as follows:
[0044] 1. Data Collection and Processing
[0045] (a) Obtain power load data through power load monitoring equipment at an interval of 30 seconds.
[0046] (b) Use the ARIMA (Autoregressive Integrated Moving Average) model for outlier detection. First, fit the ARIMA model to the original data to obtain the predicted sequence. Then, subtract the observed value from the ARIMA model predicted value to obtain the residual sequence. Determine the outliers based on the residual sequence and remove them.
[0047] (c) Use the rolling window method to divide the training set and the test set. Starting from the starting point of the time series data, the window is slid with a fixed step size, moving one time step at a time, to generate a series of overlapping windows. These windows contain historical data over a period of time as features and contain the power load of the next time step. Then, the earlier windows are used as training sets and the newer windows are used as test sets to ensure that the model is trained only with past data and its generalization ability to future data is evaluated in the test.
[0048] 2. Model evaluation indicators
[0049] The present invention selects the mean absolute percentage error SMAPE as the evaluation indicator, which is a percentage-based accuracy measure. The calculation formula is as follows, where n represents the number of samples, Y t represents the true value of the tth sample, Represents the predicted value of the tth sample.
[0050]
[0051] 3. Model training
[0052] Figure 1 The TEMPO model training process is demonstrated and will be described in detail below.
[0053] (a) Decomposition operation: The input time series type i-th power load data X i Decomposed into: Trend component Seasonal Components Residual Components Right now This decomposition can clearly identify unusual observations and changes in seasonal patterns or trends, where: the trend component Used to capture the medium- and long-term patterns in the data, m = 2k + 1, k represents the average step length; seasonal component Encapsulates repetitive short-term cycles; residual components The remaining data after extracting the trend and seasonal factors, where n represents the number of samples and L represents the length of the time series.
[0054] (b) Normalization operation: After decomposition, X T , X S , X R Normalize, the normalization formula is as follows:
[0055]
[0056] in represents the i-th time component of the component, γ C represents the affine parameter vector of the component, β C Represents an offset or constant ε C A very small positive number to prevent the denominator from being zero. and Respectively represent specific instances C t The mean and standard deviation of .
[0057] (c) Time series patching: by normalizing the i-th trend component Seasonal Components Residual Components Get patch tags Where L represents the fixed patch length, Indicates the number of patches, L P represents the patch length and S represents the step size.
[0058] (d) Word embedding: label the patch Input them into the word embedding layer respectively to obtain the corresponding word vector Where L E Represents the word embedding size.
[0059] (e) Prompt pool query: based on word vector Query the prompt pool and select the k highest ranked prompt vectors v1, v2, ..., v returned k , thus obtaining Among them, x T 、x S and x R The query results of the prompt pool represent the trend component, seasonal component and residual component respectively. The score matching function used in the score matching process in the prompt pool is:
[0060]
[0061] In the formula, Represents the word vector corresponding to the component, k m represents the mth hint vector in the hint pool.
[0062] (f) TEMPO model calculation: x T , x S , x R And the position vector is input into the Transformer module to obtain the predicted
[0063] (g) Obtaining prediction results: The overall prediction result is the sum of the predictions of each component. Send to the fully connected layer for decoding and generate prediction results The decoding operation formula is as follows:
[0064]
[0065] (h) Evaluation results: Substitute the prediction results into the SMAPE formula to obtain the evaluation results;
[0066] (i) Repeat (a) to (h) until the SMAPE value reaches within the threshold or the maximum number of cycles is reached.
[0067] 4. Model Optimization
[0068] In order to obtain the optimal hyperparameters of the TEMPO model and improve the effect of power load prediction, the present invention automatically optimizes the hyperparameters of the TEMPO model based on the zebra optimization algorithm. Figure 2 This is a flowchart of the hyperparameter optimization of the TEMPO model by the zebra optimization algorithm. The following is a detailed description:
[0069] (a) Definition of encoding: The encoding is defined as [Ls, K, S, Lp] to represent individuals, where Ls represents the size of the prompt word, K represents the optimal number of prompts, S represents the prediction sequence step size, and Lp represents the length of the prompt word.
[0070] (b) Initialize the population: randomly generate n individuals, that is, n hyperparameter sets.
[0071] (c) Fitness function calculation: Perform the corresponding TEMPO training on each individual to obtain SMAPE, and the fitness function fitness = SMAPE.
[0072] (d) Update the pioneer zebra: The pioneer zebra is the individual with the minimum fitness value. The pioneer zebra O is obtained by traversing the entire population.
[0073] (f) Foraging behavior: Common zebras are optimized towards pioneer zebras, i.e., according to Get the updated individual, where i represents the i-th zebra and j represents the j-th parameter in the zebra encoding, i.e. x ij represents the value of the jth parameter of the i-th zebra, r represents a random number between [0, 1], and I is a random value belonging to the set {1, 2}. The optimized zebra value is:
[0074]
[0075] (e) Defense strategy: The present invention selects the defense strategy in a random manner, that is, randomly obtains a random number r in the range of [0, 1], selects the escape strategy when r < 0.5, and selects the attack strategy when r ≥ 0.5. The attack strategy update formula is: Where t is the current iteration number, T is the maximum iteration number, r is a random number [0, 1], R is a constant, and the escape strategy update formula is: Among them A j Represents the jth parameter of a random zebra.
[0076] (f) Loop through (d)-(e) until the fitness is less than the set threshold or the maximum number of evolutions is reached.
[0077] (g) Output the pioneer zebra to obtain the optimized TEMPO hyperparameters.
[0078] 5. System Application
[0079] After the model is trained and optimized, the system inputs real-time data into the model, obtains H future power forecast load values, and visualizes the data through the front end. The following introduces the overall process of the system, such as Figure 3 .
[0080] (a) The system reads K real-time power load data pushed by the power load monitoring equipment.
[0081] (b) Input K data into the model and predict the power load for the next H time periods, that is:
[0082]
[0083] Among them, V i represents the prompt word, and Φ represents the model parameter.
[0084] (b) Push the latest H power load forecast values to the front end for visual display.
[0085] Corresponding to the aforementioned embodiment of a load forecasting method for electricity spot trading based on ZOA-TEMPO, the present invention also provides an embodiment of a load forecasting device for electricity spot trading based on ZOA-TEMPO.
[0086] See also Figure 4 A load forecasting device for electricity spot trading based on ZOA-TEMPO provided in an embodiment of the present invention includes a memory and one or more processors, wherein the memory stores executable code, and when the processor executes the executable code, it is used to implement a load forecasting method for electricity spot trading based on ZOA-TEMPO in the above embodiment.
[0087] The embodiment of a load forecasting device for electricity spot trading based on ZOA-TEMPO provided by the present invention can be applied to any device with data processing capability, and the device with data processing capability can be a device or apparatus such as a computer. The device embodiment can be implemented through software, or through hardware or a combination of software and hardware. Taking software implementation as an example, as a device in a logical sense, it is formed by the processor of any device with data processing capability in which it is located reading the corresponding computer program instructions in the non-volatile memory into the internal memory for execution. From the hardware level, if Figure 4 As shown, it is a hardware structure diagram of a load forecasting device based on ZOA-TEMPO power spot trading provided by the present invention, in which any device with data processing capability is located, except Figure 4 In addition to the processor, memory, network interface, and non-volatile memory shown, any device with data processing capabilities in which the apparatus in the embodiments is located may also include other hardware, generally based on the actual functions of the device with data processing capabilities, which will not be described in detail.
[0088] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.
[0089] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of the present invention. Ordinary technicians in this field can understand and implement it without paying creative work.
[0090] An embodiment of the present invention further provides a computer-readable storage medium having a program stored thereon. When the program is executed by a processor, a load forecasting method for electricity spot trading based on ZOA-TEMPO in the above embodiment is implemented.
[0091] The computer-readable storage medium may be an internal storage unit of any device with data processing capability described in any of the aforementioned embodiments, such as a hard disk or a memory. The computer-readable storage medium may also be an external storage device of any device with data processing capability, such as a plug-in hard disk, a smart media card (SMC), an SD card, a flash card, etc. equipped on the device. Furthermore, the computer-readable storage medium may also include both an internal storage unit and an external storage device of any device with data processing capability. The computer-readable storage medium is used to store the computer program and other programs and data required by any device with data processing capability, and may also be used to temporarily store data that has been output or is to be output.
[0092] The present invention also provides a computer program product, including a computer program, and when the computer program is executed by a processor, it implements the load forecasting method for power spot trading based on ZOA-TEMPO.
[0093] The above is only a specific implementation of the present invention, and no specific optimization algorithm or optimization operator is required, that is, the present invention is not limited to the contents described in the drawings and the above specific implementation. Any transformation that does not deviate from the technical architecture and logic of the present invention will fall within the protection scope of the claims of the present invention.
Claims
1. A load forecasting method for power spot trading based on ZOA-TEMPO, characterized in that: The following steps are involved: (1) Obtain historical power load data from power spot transactions and use the rolling window method to divide the historical data into a training set and a test set; (2) Based on the TEMPO model, the mean absolute percentage error SMAPE is used as the evaluation indicator to obtain a pre-trained model through training; (3) The zebra optimization algorithm (ZOA) is used to automatically tune the hyperparameters of the TEMPO model, and the TEMPO model is trained based on multiple automatically obtained hyperparameters to obtain the final trained TEMPO model. (4) Obtain real-time power load data from spot electricity transactions and predict future power load based on the trained TEMPO model.
2. According to a load forecasting method for power spot trading based on ZOA-TEMPO according to claim 1, it is characterized in that: After obtaining the power load data, the autoregressive integrated moving average model is used for outlier detection, and the anomalies recorded are manually judged.
3. The load forecasting method for power spot trading based on ZOA-TEMPO according to claim 1 is characterized in that: The TEMPO model processes power load data in the following steps: (a) The input time series is decomposed into trend components X T , Seasonal Component X S , residual component X R ; (b)X T , X S , X R Perform normalization operations separately; (c) Time series patching and obtaining X T , X S , X R Corresponding word vector Embedding; (d) Using the trend component X T , Seasonal Component X S , residual component X R The corresponding Embeddings query the prompt pool respectively and get (e) x T 、x S 、x R And the position vector is input into the Transformer module to obtain the predicted (f) Input to the fully connected layer according to Decode and generate prediction results 4. The load forecasting method for power spot trading based on ZOA-TEMPO according to claim 3 is characterized in that: Decomposition of time series into trend component X T , Seasonal Component X S , residual component X R ,Right now in: Capture medium- to long-term patterns in data; Encapsulates repetitive short-term cycles; Extract the residuals.
5. A load forecasting method for power spot trading based on ZOA-TEMPO according to claim 2, characterized in that: The prompts in the prompt pool include the policy releases corresponding to the time series and the external factors of the natural environment. The score matching function used in the score matching process in the prompt pool is 6. A load forecasting method for power spot trading based on ZOA-TEMPO according to claim 1, characterized in that: The TEMPO model hyperparameter optimization is performed using the zebra optimization algorithm ZOA, which includes the following steps: (a) Initialization: Randomly initialize the ZOA population. Each zebra in the population is a solution to the TEMPO hyperparameters. (b) Fitness function: Perform the corresponding TEMPO training on each zebra to obtain SMAPE, and the fitness function fitness = SMAPE; (c) Update the pioneer zebra: The pioneer zebra is the individual with the minimum fitness value; (d) The population is renewed through two stages: foraging behavior and defensive behavior; (e) (b)-(d) is executed cyclically, and the fitness is less than the set threshold or the maximum number of evolutions is reached; (f) Output the pioneer zebra to obtain the final TEMPO model.
7. A load forecasting method for power spot trading based on ZOA-TEMPO according to claim 1, characterized in that: The real-time power load sequence data is input into the TEMPO model to obtain the predicted future power load, that is, The predicted future power load data is input to the front end in real time for visual display.
8. A load forecasting device for electric power spot trading based on ZOA-TEMPO, comprising a memory and one or more processors, wherein the memory stores executable code, characterized in that: When the processor executes the executable code, a load forecasting method for electricity spot trading based on ZOA-TEMPO is implemented as described in any one of claims 1-6.
9. A computer-readable storage medium having a program stored thereon, characterized in that: When the program is executed by a processor, a load forecasting method for power spot trading based on ZOA-TEMPO as described in any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, a load forecasting method for electricity spot trading based on ZOA-TEMPO is implemented as described in any one of claims 1 to 6.
