Load power prediction model training method and device, equipment and program product
By using large language models to generate and correct prediction program codes, the problem of difficult to generate load power prediction models in the prior art that meet actual needs is solved, and the generation of load power prediction models suitable for different data scenarios is realized.
Patent Information
- Application Number
- CN202411532308.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-30
- Publication Date
- 2025-02-25
AI Technical Summary
The prior art is difficult to generate a load power prediction model that meets actual needs.
By obtaining model training data and model information in the load power prediction task, using a large language model to generate prediction program code, training and processing the model training data, and correcting the code through error information until the code is correctly executed, and a load power prediction model is obtained.
Based on the model training data and model information in the load power prediction task, a load power prediction model that meets the actual needs is generated, which is suitable for load power prediction in different data scenarios.
Smart Images

Figure CN119514651A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of electric load power prediction, and in particular to a training method, device, equipment and program product for a load power prediction model. Background Art
[0002] The stable and efficient operation of the power system is inseparable from accurate load forecasting technology. Power loads exhibit obvious nonlinear characteristics and are easily affected by a variety of external factors, such as climate change, holiday arrangements, and fluctuations in economic activities. The uncertainty and variability of these factors pose challenges to load forecasting. Traditional load forecasting methods usually rely on specific data mining techniques and feature engineering. Although these methods can provide relatively accurate predictions in some cases, they often require developers to customize solutions based on specific power system environments, which limits the wide applicability of these methods.
[0003] With the rapid development of artificial intelligence technology, large language models have shown strong capabilities in human interaction, code generation, and reasoning based on common sense and domain knowledge. Their performance has been demonstrated in many fields, such as medicine, education, and biology. However, large language models are generally difficult to generate load power forecasting models that meet actual needs. Summary of the invention
[0004] In view of this, the embodiments of the present application provide a method, device, equipment and program product for training a load power prediction model to solve the problem in the prior art that it is usually difficult to generate a load power prediction model that meets actual needs.
[0005] A first aspect of an embodiment of the present application provides a method for training a load power prediction model, the method comprising:
[0006] Acquire a load power forecasting task, wherein the load power forecasting task includes model training data and model information;
[0007] Generate prediction program code through a large language model according to the model information, and perform training processing on the model training data through the prediction program code;
[0008] The error information of the prediction program code during execution is obtained, and the error information is used as prompt information of the large language model to correct the prediction program code until the prediction program code is correctly executed to obtain the load power prediction model.
[0009] In combination with the first aspect, in a first possible implementation manner of the first aspect, generating a prediction program code through a large language model according to the model information, and performing training processing on the model training data through the prediction program code includes:
[0010] Determining a feature vector according to the model training data;
[0011] Determining the model structure information, optimization method, evaluation method and model interpretation method of the load power prediction model included in the model information;
[0012] The feature vector, the model structure information, the optimization method, the evaluation method and the model interpretation method are used as description information to generate the prediction program code through the large language model.
[0013] In combination with the first possible implementation manner of the first aspect, in a second possible implementation manner of the first aspect, determining a feature vector according to the model training data includes:
[0014] Determining the correlation of the parameters of the model training data by a correlation analysis method, and screening the model training data according to the correlation of the parameters;
[0015] The feature vector is determined according to the filtered model training data.
[0016] In combination with the second possible implementation manner of the first aspect, in a third possible implementation manner of the first aspect, determining the feature vector according to the screened model training data includes:
[0017] Obtaining a prediction step size of the load power prediction model;
[0018] When the prediction step length is greater than a predetermined step length threshold, searching for similar historical data according to the predicted date information;
[0019] Determining an absolute distance based on the date information of the similar historical data and the predicted date information;
[0020] Determining similar historical data for the prediction calculation according to the absolute distance;
[0021] The feature vector is determined according to the filtered similar historical data.
[0022] In combination with the first possible implementation manner of the first aspect, in a fourth possible implementation manner of the first aspect, determining an optimization method for the load power prediction model included in the model information includes:
[0023] Searching for a hyperparameter combination of the load power prediction model;
[0024] Calculating a cross validation score for the hyperparameter combination;
[0025] The hyperparameter combination is optimized according to the cross-validation score.
[0026] In combination with the first possible implementation manner of the first aspect, in a fifth possible implementation manner of the first aspect, determining an evaluation method for the load power prediction model included in the model information includes:
[0027] Determine the system load prediction deviation rate of the load power prediction model according to the system load prediction value and the system load actual value;
[0028] Determining a load forecast deviation rate root mean square according to the load forecast deviation rate;
[0029] The average load prediction accuracy is determined according to the root mean square of the prediction deviation rate as an evaluation index of the load power prediction model, and the load power prediction model is evaluated.
[0030] In combination with the first possible implementation manner of the first aspect, in a sixth possible implementation manner of the first aspect, determining a model interpretation method of the load power prediction model included in the model information includes:
[0031] Determine the predicted value corresponding to the feature subset, the predicted value corresponding to the union of the subset and the i-th eigenvalue, and determine the Shapley value corresponding to the eigenvalue, wherein the subset does not include the i-th eigenvalue;
[0032] The contribution of the i-th eigenvalue to the prediction result of the load power prediction model is explained according to the Shapley value.
[0033] A second aspect of an embodiment of the present application provides a training device for a load power prediction model, the device comprising:
[0034] A task acquisition unit, used to acquire a load power forecasting task, wherein the load power forecasting task includes model training data and model information;
[0035] A code generation unit, used to generate prediction program code through a large language model according to the model information, and perform training processing on the model training data through the prediction program code;
[0036] A correction unit is used to obtain error information during the execution of the prediction program code, use the error information as prompt information of the large language model, and correct the prediction program code until the prediction program code is correctly executed to obtain the load power prediction model.
[0037] A third aspect of an embodiment of the present application provides a training device for a load power prediction model, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the training device for the load power prediction model implements a method as described in any one of the first aspects.
[0038] A fourth aspect of the embodiments of the present application provides a computer program, which, when executed on a computer, enables the computer to execute the method in the first aspect or its various implementations.
[0039] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method described in any one of the first aspects are implemented.
[0040] The beneficial effect of the embodiments of the present application compared with the prior art is: after obtaining the load power prediction task, the embodiments of the present application generates a prediction program code through a large language model according to the model training data and model information in the load prediction task, trains the model training data in the load prediction task, and obtains error information of the prediction program code during execution, uses the error information as prompt information of the large language model, and corrects the prediction program code until the prediction program code is correctly executed. Since the method can generate the prediction program code based on the model training data and model information in the load power prediction task, and corrects the prediction program code through the error information, a load power prediction model can be obtained, which can meet the functional requirements of the load power prediction model in different data scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical solutions in the embodiments of the present application, 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 application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0042] Figure 1 It is a schematic diagram of an implementation flow of a training method for a load power prediction model provided in an embodiment of the present application;
[0043] Figure 2 This is a schematic diagram of an ultra-short-term load power prediction result provided by an embodiment of the present application;
[0044] Figure 3 It is a schematic diagram of a short-term load power prediction result provided by an embodiment of the present application;
[0045] Figure 4 It is a schematic diagram of a training device for a load power prediction model provided in an embodiment of the present application;
[0046] Figure 5 It is a schematic diagram of a training device for a load power prediction model provided in an embodiment of the present application. DETAILED DESCRIPTION
[0047] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0048] In order to illustrate the technical solution described in this application, a specific embodiment is provided below for illustration.
[0049] Figure 1 A schematic diagram of the implementation flow of a training method for a load power prediction model provided in an embodiment of the present application is described in detail as follows:
[0050] In S101, a load power prediction task is obtained, where the load power prediction task includes model training data and model information.
[0051] The load power prediction task in the embodiment of the present application can be passed to the large language model through user description. For example, the model training data and model information included in the load power prediction task can be determined according to the user's task description information.
[0052] The load power prediction task may be a task for predicting power within a certain period of time in the future. In order to realize the load power prediction, the user needs to provide relevant data, including model training data and model information.
[0053] The model training data is used to train the load power prediction model so that the load power prediction model can accurately predict power. In order to improve the prediction accuracy of the load power prediction model, the model training data may include different parameter information, including information such as climate and time. The model information may include the model structure information of the load power prediction model and the parameter information of the model during the training process.
[0054] For example, the description language of the load power forecasting task obtained may include: "I have collected power operation data in a certain area, and these data are stored in a file named "xxx.csv". Contains the following parameters: date type, temperature, relative humidity, dew point temperature, wind speed, visibility, and load power at the corresponding time node. I want to train a data-driven load power forecasting model for the area. Please write a Python code to achieve this goal." In this description language, the model training data, code output type, business scenarios, and pre-implemented effects included in the description language can be extracted through the large language model. Among them, the model training data "a file named "xxx.csv" contains the following parameters: date type, temperature, relative humidity, dew point temperature, wind speed, visibility, and load power at the corresponding time node", the code output type is "Python code", the business scenarios include "power operation data in a certain area", and the pre-implemented effects include "I want to train a data-driven load power forecasting model for the area".
[0055] In possible implementations, different load types have different influencing factors. For example, air conditioning load is greatly affected by weather factors such as temperature, and lighting load is greatly affected by day / night. Therefore, in order to summarize the influencing factors of different load types to the greatest extent and improve the generalization of the load forecasting model, the parameters included in the model training data should include as complete data as possible, such as weather, date, and load power corresponding to time nodes.
[0056] In order to generate the load power prediction model reliably, the model information may include model structure information, optimization method, evaluation method, model interpretation method, etc. of the load power prediction model, but is not limited thereto, and may also include information such as data preprocessing method, etc.
[0057] Among them, data preprocessing can be used to clean the original outlier data points, perform nonlinear interpolation on missing data, etc. Among them, the interpolation formula can be expressed as:
[0058] p generate (t) = p 0 (t)·(1+L 1 );
[0059] Where: p 0 (t) represents the original data at time t-1; L 1 ~iidN(0,0.1) is used to simulate random disturbances, L 1 Follows independent distribution and standard normal distribution; p generate(t) represents the data finally generated at time t. In a possible implementation, the interpolated data can be further normalized to scale the interpolated data to a range of 0-1. The scaling formula can be expressed as: Where: x is the original value, min(x) is the minimum value in the data set, max(x) is the maximum value in the data set, and x' is the normalized data.
[0060] The embodiment of the present application can determine the feature vector according to the model training data, and when determining the feature vector, the steps of feature screening and constructing the feature vector can be included.
[0061] When performing feature screening, a Pearson correlation analysis can be performed on the input parameters, and parameters with correlations greater than a predetermined correlation threshold are selected as input features for prediction. The calculation method of the Pearson correlation can be expressed as:
[0062]
[0063] Among them, cov(X,Y) represents the covariance of X and Y; σ(X) and σ(Y) represent the standard deviations of parameters X and Y respectively; the value range of ρ is between -1 and 1; when the ρ value is close to 1, it means that X and Y are positively correlated, when the ρ value is close to -1, it means that X and Y are negatively correlated, and when the ρ value is close to 0, it means that there is no linear relationship between X and Y. By setting the correlation threshold, the parameters above the correlation threshold are screened out as input features.
[0064] In a possible implementation, the correlation threshold may be set to any value between 0.4 and 0.6, such as 0.5, so that the input parameters have better correlation.
[0065] Among them, the feature vector construction can determine different feature vector construction methods according to different prediction step lengths. For example, the prediction step length can include ultra short-term and short-term, wherein the ultra short-term is less than the predetermined first step length threshold, and the short-term is greater than the first step length threshold and less than the second step length threshold. The first step length threshold can be any value between 10-300 minutes, such as 15 minutes.
[0066] For ultra-short-term power load prediction, since the prediction step is short, the future ultra-short-term load change trend can be inferred based on the historical load change law. Therefore, when performing ultra-short-term load power prediction, the sliding module can be used to determine the data used for model training. The sliding module includes an input window and an output window. The size of the output window is determined according to the required prediction step. The input of the load power prediction model is: in represents different characteristic factors at time t; the output of the model is in It represents the load power at different times in the ultra-short term predicted at time t.
[0067] In a possible implementation, similar historical data can be searched based on the prediction step. For example, the relative relationship between the input window and the output window of the sliding window can be set, and the relative relationship can be expressed by a ratio, such as any ratio between 5:1 and 2:1. For example, when performing an ultra-short-term load power forecast with a time scale of 15 minutes, the ratio of the input window of historical data to the output window of predicted data can be 3:1; when performing an ultra-short-term load power forecast with a time scale of 4 hours, the ratio of the input window of historical data to the output window of predicted data can be 60:16. The time granularity of the prediction can be 15 minutes.
[0068] For short-term power load forecasting, since the forecast time scale is long, it is difficult to infer the future load change trend based solely on the historical load change pattern. Therefore, it is necessary to find similar historical data, such as finding similar days to obtain similar loads on the forecast day as one of the elements of the input feature matrix.
[0069] Among them, the method of finding similar days can parse the date according to the date type in the input data to determine the date type. The determined date type may include factors such as year, month, day, day of the month, hour of the day, day of the week, and whether it is a holiday.
[0070] After parsing and determining the date type, similar historical data can be found based on the prediction step. For example, similar days can be found in historical data based on the date type of the prediction day. For example, if the prediction day is the 10th day of a month, similar days can include the 10th day of each month in the historical data.
[0071] In possible implementations, holiday types can usually be determined based on statutory holidays. However, when the load type is a special type, such as factories rushing to work on holidays, schools having winter and summer vacations, and hospitals being open all year round, it is necessary to change whether the corresponding date is a holiday based on the actual situation corresponding to the load type. For example, the school's winter and summer vacations can be changed to statutory holidays.
[0072] The absolute distance can be determined based on the date information of similar historical data and the date information of the prediction step. Specifically, for the prediction date included in the prediction step, the similarity between the prediction date and any date can be expressed by the absolute distance. For example, for two given dates d 1 (prediction date) and d2 (Any given date), calculate their absolute distance in year, month and day. The absolute distance can be expressed as:
[0073] Distance(d 1 ,d 2 )=|h 1 -h 2 |+|m 1 -m 2 |+|dm 1 -dm 2 |+|dw 1 -dw 2 |
[0074] Among them, h, m, dm, and dw represent whether it is a holiday, the month, the day of the month, and the day of the week respectively.
[0075] Considering the significant impact of holidays on load, it is necessary to weight holidays. By introducing the holiday impact coefficient α and adjusting the distance between holidays. For example, assuming h 1 and h 2 If both are holidays or working days, the holiday impact coefficient is 1; if one is a holiday and the other is not, the holiday impact coefficient α>1. The calculation formula for the adjusted absolute distance can be as follows:
[0076] Adjusted Distance(d 1 ,d 2 )
[0077] =α×|h 1 -h 2 |+|m 1 -m 2 |+|dm 1 -dm 2 |+|dw 1 -dw 2 |
[0078] For example, when setting the α coefficient, if d 1 and d 2 If both are holidays or working days, the holiday impact coefficient is 1; if one is a holiday and the other is not, the holiday impact coefficient α = 100. By increasing the discrimination of the impact coefficient α, the accuracy of similar days can be better increased.
[0079] By traversing all possible date combinations, calculating the adjusted absolute distance between each pair of date combinations, and determining similar historical data for prediction calculations based on the absolute distance or the adjusted absolute distance. For example, the date with the smallest absolute distance can be selected as the most similar date:
[0080] d similar =arg min Adjusted Distance(d 1 ,d 2 )
[0081] Alternatively, a date whose absolute distance is less than a predetermined distance threshold may be selected as the most similar date.
[0082] After obtaining the date most similar to the forecast date, historical data of the most similar date may be obtained as similar historical data, including the historical load of the most similar date as one of the elements of the feature vector.
[0083] After determining the historical load of the most similar date, the historical load of the most similar date and the original features corresponding to the historical load (including features such as temperature, humidity, visibility, etc.) can be combined as input features, and the output is the corresponding actual load. The feature vector includes input features and output features. The feature vector set is determined based on multiple prediction points, that is, the feature vector can include the filtered historical data of the first predetermined step length, and can also include the filtered similar historical data.
[0084] After the feature vector is constructed, the feature vector set can be divided, and the division results may include a training set, a validation set, and a test set. In a possible implementation, in order to improve the training effect of the model and reduce the probability of overfitting, the ratio of the data in the training set, the validation set, and the test set can be 7:1:2.
[0085] In an embodiment of the present application, the model structure information may include information such as model type, model depth, number of unit nodes in each layer, etc. Multiple sequence prediction models can be constructed to implement a neural network based on a Transformer. The structural information of the neural network may include: an input layer, a dense time distribution layer, an attention layer, a flattening layer, a fully connected layer, and an output layer of different nodes set according to different prediction scales.
[0086] In a possible implementation, one can design and build a 36-node input layer, a 64-node dense time distribution layer, an 8-head attention layer, a flattening layer, 2 fully connected layers containing 64 nodes, and an output layer of different nodes set according to different prediction scales.
[0087] The activation function used in all cases except the output layer can be the Rectified Linear Unit (ReLU):
[0088] f(x)=max(0,x)
[0089] The output layer can use a linear activation function:
[0090] f(x)=x
[0091] The model uses a multi-head attention mechanism to operate on different parts of the input sequence at the same time to improve performance. A normalization layer can be introduced to compress different data into the same range to make the model robust. This reduces the possibility of the model being too dependent on specific features, thereby reducing the chance of overfitting.
[0092] The output of the attention layer is connected through the flattening layer, and the output is reconstructed from 3D to 2D tensor. The output of the flattening layer is passed to the output layer through two fully connected layers, each of which includes 64 nodes. These fully connected layers can enable the model to capture more complex patterns and relationships in the data.
[0093] The output layer can select different time scales according to different task types. The customized Transformer model architecture can be used to handle load forecasting tasks of different time scales.
[0094] In a possible implementation, since the constructed Transformer neural network contains a large number of hyperparameters, and parameter optimization has a great influence on the performance of the neural network, the embodiment of the present application can search for the hyperparameter combination of the load power prediction model, and calculate the cross-validation score of the hyperparameter combination, and optimize the hyperparameter combination according to the cross-validation score.
[0095] For example, the embodiment of the present application can use the Girid search method to optimize the hyperparameters of the model. The Girid search method traverses all possible parameter combinations and selects the optimal parameter configuration to improve the performance of the model. The core of this method combines all possible values of each hyperparameter, trains the neural network and evaluates its performance on the validation set. Cross-validation is used to evaluate model performance. For each hyperparameter combination, the cross-validation score can be calculated by the following formula:
[0096]
[0097] Among them, n is the number of cross-validation folds, Score is the performance evaluation indicator, is the hyperparameter combination (η) used in the mth fold i ,B j ,O k ,D l ) trained model.
[0098] Specifically, the process of optimizing the hyperparameters of the load power prediction model using the Girid search method may include:
[0099] Step 1: Define the hyperparameter grid, candidate values for learning rate, batch size, optimizer, dropout ratio, etc.
[0100] Step 2: Initialize the best score to negative infinity.
[0101] Step 3: Initialize the optimal parameters to null values.
[0102] Step 4: For each hyperparameter combination in the hyperparameter network, create a new model for the current parameter combination by traversing every possible parameter combination in the hyperparameter grid, use cross-validation to evaluate the performance of the model, and calculate the average validation score. If the validation score of the current model is greater than the best score recorded previously, update the best score to the validation score of the current model and update the best parameters to the current parameter combination.
[0103] Step 5: Output the best score and the best parameters.
[0104] In the embodiments of the present application, in order to compare different models, in addition to the customized main model, different models can also be constructed, including data-driven models such as support vector regression, LSTM, random forest and extreme gradient enhancement, to verify the superiority of the proposed model.
[0105] In the embodiment of the present application, the model information may further include a model evaluation method. The model evaluation method may evaluate the prediction effect of the model through evaluation indicators. The evaluation indicators may include indicators such as prediction accuracy, which are used to evaluate the performance of the model. For example, the prediction accuracy may include the daily average load prediction accuracy, and the calculation method of the daily average accuracy may be:
[0106]
[0107] A d =(1-RMSE)×100%
[0108] Where: E i is the system load forecast deviation rate at time i; L i,f is the system load forecast value at time i; L i is the actual value of the system load at time i; RMSE is the root mean square of the load forecast deviation rate, i = 1...96; A d is the daily average load forecast accuracy.
[0109] The embodiment of the present application can generate a comparison chart of actual load power and predicted load power for each model through result visualization to visualize the predicted load power and error of the optimal model.
[0110] The model information in the embodiment of the present application may also include a model interpretation method for the load power prediction model, which can use the SHAP (SHapley Additive Planations in English, Shapley Additive Interpretations in Chinese, or Shapley Value) method to interpret the best model. The SHAP method is a method for interpreting the output of a machine learning model. It is based on the Shapley value in cooperative game theory and explains the model's decisions by calculating the contribution of each feature to the prediction results. The SHAP method can help understand how the model uses features to make predictions and reveal the black box part of the model. For the Shapley value φ of feature i i The calculation formula is:
[0111]
[0112] Where: N is the set of all features; S is a subset of N, excluding feature i; |S| is the size of subset S; f(S) is the predicted value of the model when it only contains the features of subset S; f(S∪{i}) is the predicted value of the model after adding feature i to subset S. By considering all possible feature combinations S (excluding feature i), and calculating the marginal contribution of feature i to these combinations. The predicted value corresponding to the feature subset and the predicted value corresponding to the union of the subset and the i-th eigenvalue can be determined to determine the Shapley value corresponding to the eigenvalue, where the subset does not include the i-th eigenvalue; the contribution of the i-th eigenvalue to the prediction result of the load power prediction model is explained based on the Shapley value.
[0113] Specifically, the calculation process of the Shapley value of different features by the SHAP method is as follows:
[0114] Step 1: Calculate the model's predictions without any features
[0115] Step 2: Compute the model with only feature x 1 The predicted value f({x 1});
[0116] Step 3: Compute the model with only feature x 2 The predicted value f({x 2});
[0117] Step 4: Calculate the model's predicted value f({x 1 ,x 2});
[0118] Step 5: Calculate x 1 The Shapley value of:
[0119]
[0120] Similarly, calculate x 2 The Shapley value of:
[0121]
[0122] By calculating the Shapley value corresponding to the feature, the marginal contribution of the feature to the portfolio can be determined.
[0123] In S102, a prediction program code is generated by a large language model according to the model information, and the model training data is trained by the prediction program code.
[0124] The feature vector can be determined based on the model training data, and the model feature information including the model structure information, optimization method, evaluation method and model interpretation method can be determined. The feature vector, model structure information, optimization method, evaluation method and model interpretation method can be used as descriptive information to generate prediction program code through a large language model.
[0125] For each generated prediction program code, the version information corresponding to the prediction program code can be marked. In the subsequent revision process, the version information can be updated accordingly to facilitate the management of prediction program codes of different versions.
[0126] In S103, error information of the prediction program code during execution is obtained, and the error information is used as prompt information of the large language model to correct the prediction program code until the prediction program code is correctly executed to obtain the load power prediction model.
[0127] The generated program prediction code can be configured to execute in the corresponding operating environment. For example, the generated Python code can be executed in the PyCharm editor. When the code does not work properly, the information returned by PyCharm can be directly used as the prompt input for the next interaction, and the corresponding code can be automatically modified using the large language model.
[0128] In a possible implementation, the returned information can also be error-calibrated to reduce the number of interactions and improve the generation efficiency of the large language model.
[0129] In an embodiment of the present application, after the load power prediction model training is completed, the description of the business scenario can be subsequently replaced to generate a new load power prediction program.
[0130] The business scenarios that can be replaced may include: changing equipment types, such as cooling load, air conditioning load, power load, etc.; changing input data types, adding or removing weather factors; electricity usage patterns: whether there is a production plan, etc. The large language model can modify the data processing method based on the description of the business scenario and generate a load power prediction program for the new scenario.
[0131] In order to better illustrate the technical solution of this embodiment, the present application embodiment uses the building power load in a certain area as an object for illustration, specifically:
[0132] The available data for a certain region is data every 15 minutes from January 2023 to July 2024. In order to ensure sufficient training data, the data before June 2024 is used for training, and the data in July 2024 is used for prediction. The data types include: date type, temperature, relative humidity, dew point temperature, wind speed, visibility, and load power at the corresponding time node.
[0133] When performing ultra-short-term training, all training data are trained and the input and output data are divided using a sliding window.
[0134] When performing short-term day-ahead training, the data from January to June 2024 is used as training data, and the data from January to December 2023 is used as the historical database. That is, the date closest to 2024 is found from the 2023 data, and the load power on similar days is used as a feature, together with other weather and other features as input, to train the 2024 data.
[0135] The business scenario description corresponding to this embodiment is input into the trained large language model, and the load power prediction program is output and executed. The ultra-short-term 15-minute load power prediction result is as follows: Figure 2 As shown in the figure, the comparison between the cumulative rolling forecast load value (dashed line) and the actual load power value (solid line) for one day is shown. After analysis, the prediction accuracy of the Transformer model is 94.87%, and compared with the prediction accuracy of the LSTM model, the prediction accuracy of the LSTM is 93.83%. The results show that the accuracy of the customized Transformer model can be improved by 1.04% over the automatically generated model.
[0136] Similarly, the short-term 1-day load power forecast results are as follows: Figure 3As shown in the figure, the comparison between the predicted load value and the actual load power value for one day is shown. After analysis, the prediction accuracy of the Transformer model is 91.94%, and compared with the prediction results of the LSTM model, the prediction accuracy of the LSTM model is 88.82%. Similarly, the accuracy of the customized Transformer model is 3.12% higher than that of the non-customized LSTM model in the short-term 1-day time scale.
[0137] The above experimental comparisons have proven the effectiveness of the load power prediction model training method based on a large language model. The trained model can perform multi-time scale load power prediction for different business scenarios, greatly reducing the development cost. In addition, the custom Transformer model proposed during the training process has higher prediction accuracy than the non-customized LSTM model.
[0138] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0139] Figure 4 A schematic diagram of a training device for a load power prediction model provided in an embodiment of the present application, the device comprising:
[0140] A task acquisition unit 401 is used to acquire a load power prediction task, wherein the load power prediction task includes model training data and model information;
[0141] A code generating unit 402 is used to generate a prediction program code through a large language model according to the model information, and to perform training processing on the model training data through the prediction program code;
[0142] The correction unit 403 is used to obtain error information during the execution of the prediction program code, use the error information as prompt information of the large language model, and correct the prediction program code until the prediction program code is correctly executed to obtain the load power prediction model.
[0143] Figure 4 The training device of the load power prediction model shown in FIG. Figure 1 The training method of the load power prediction model shown corresponds to.
[0144] Figure 5 Schematic diagram of a training device for a load power prediction model provided in an embodiment of the present application. Figure 5As shown, the training device 5 for the load power prediction model of this embodiment includes: a processor 50, a memory 51, and a computer program 52 stored in the memory 51 and executable on the processor 50, such as a training program for the load power prediction model. When the processor 50 executes the computer program 52, the steps in the above-mentioned training method embodiments of the load power prediction model are implemented. Alternatively, when the processor 50 executes the computer program 52, the functions of the modules / units in the above-mentioned device embodiments are implemented.
[0145] Exemplarily, the computer program 52 may be divided into one or more modules / units, which are stored in the memory 51 and executed by the processor 50 to complete the present application. The one or more modules / units may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program 52 in the training device 5 of the load power prediction model.
[0146] The training device 5 of the load power prediction model can be a computing device such as a desktop computer, a notebook, a PDA, and a cloud server. The training device of the load power prediction model can include, but is not limited to, a processor 50 and a memory 51. Those skilled in the art can understand that Figure 5 It is only an example of a training device 5 for a load power prediction model and does not constitute a limitation on the training device 5 for a load power prediction model. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the training device for the load power prediction model may also include input and output devices, network access devices, buses, etc.
[0147] The processor 50 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0148] The memory 51 may be an internal storage unit of the training device 5 for the load power prediction model, such as a hard disk or memory of the training device 5 for the load power prediction model. The memory 51 may also be an external storage device of the training device 5 for the load power prediction model, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the training device 5 for the load power prediction model. Further, the memory 51 may also include both an internal storage unit and an external storage device of the training device 5 for the load power prediction model. The memory 51 is used to store the computer program and other programs and data required by the training device for the load power prediction model. The memory 51 may also be used to temporarily store data that has been output or is to be output.
[0149] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0150] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0151] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. 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 this application.
[0152] In the embodiments provided in the present application, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0153] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0154] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0155] If the integrated module / 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 present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by hardware related to computer program instructions. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0156] In addition, an embodiment of the present application also provides a computer program product, which, when executed on a computer, enables the computer to execute the methods in the above-mentioned implementation modes.
[0157] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A training method for a load power prediction model, characterized in that: The method comprises: Acquire a load power forecasting task, wherein the load power forecasting task includes model training data and model information; Generate prediction program code through a large language model according to the model information, and perform training processing on the model training data through the prediction program code; The error information of the prediction program code during execution is obtained, and the error information is used as prompt information of the large language model to correct the prediction program code until the prediction program code is correctly executed to obtain the load power prediction model.
2. The method according to claim 1, characterized in that According to the model information, a prediction program code is generated by a large language model, and the model training data is trained by the prediction program code, including: Determining a feature vector according to the model training data; Determining the model structure information, optimization method, evaluation method and model interpretation method of the load power prediction model included in the model information; The feature vector, the model structure information, the optimization method, the evaluation method and the model interpretation method are used as description information to generate the prediction program code through the large language model.
3. The method according to claim 2, characterized in that Determining a feature vector according to the model training data includes: Determining the correlation of the parameters of the model training data by a correlation analysis method, and screening the model training data according to the correlation of the parameters; The feature vector is determined according to the filtered model training data.
4. The method according to claim 3, characterized in that: Determining the feature vector according to the filtered model training data includes: Obtaining a prediction step size of the load power prediction model; When the prediction step length is greater than a predetermined step length threshold, searching for similar historical data according to the predicted date information; Determining an absolute distance based on the date information of the similar historical data and the predicted date information; Determining similar historical data for the prediction calculation according to the absolute distance; The feature vector is determined according to the filtered similar historical data.
5. The method according to claim 2, characterized in that: Determining an optimization method for the load power prediction model included in the model information comprises: Searching for a hyperparameter combination of the load power prediction model; Calculating a cross validation score for the hyperparameter combination; The hyperparameter combination is optimized according to the cross-validation score.
6. The method according to claim 2, characterized in that Determining an evaluation method of the load power prediction model included in the model information comprises: Determine the system load prediction deviation rate of the load power prediction model according to the system load prediction value and the system load actual value; Determining a load forecast deviation rate root mean square according to the load forecast deviation rate; The average load prediction accuracy is determined according to the root mean square of the prediction deviation rate as an evaluation index of the load power prediction model, and the load power prediction model is evaluated.
7. The method according to claim 2, characterized in that The method for determining a model interpretation of the load power prediction model included in the model information comprises: Determine the predicted value corresponding to the feature subset, the predicted value corresponding to the union of the subset and the i-th eigenvalue, and determine the Shapley value corresponding to the eigenvalue, wherein the subset does not include the i-th eigenvalue; The contribution of the i-th eigenvalue to the prediction result of the load power prediction model is explained according to the Shapley value.
8. A training device for a load power prediction model, characterized in that: The device comprises: A task acquisition unit, used to acquire a load power forecasting task, wherein the load power forecasting task includes model training data and model information; A code generation unit, configured to generate a prediction program code through a large language model according to the model information, and to perform training processing on the model training data through the prediction program code; A correction unit is used to obtain error information during the execution of the prediction program code, use the error information as prompt information of the large language model, and correct the prediction program code until the prediction program code is correctly executed to obtain the load power prediction model.
9. A training device for a load power prediction model, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the training device of the load power prediction model implements the method as described in any one of claims 1-7.
10. A computer program product comprising computer program instructions, characterized in that The computer program instructions enable a computer to execute the method according to any one of claims 11-12.