Electricity price prediction method and device, equipment, storage medium and program product
By determining the target attributes and selecting a matching electricity price forecasting model, combined with data cleaning and neural network optimization, the problem of insufficient accuracy of existing electricity price forecasting methods is solved and higher electricity price forecasting accuracy is achieved.
Patent Information
- Application Number
- CN202510809431.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-17
- Publication Date
- 2025-09-19
AI Technical Summary
Existing electricity price forecasting methods have shortcomings in accuracy, especially physical methods are complex to calculate and have a large impact from outliers, linear methods have low prediction accuracy in high-dimensional nonlinear electricity price series, and machine learning methods are prone to overfitting and gradient disappearance, resulting in low electricity price forecast accuracy.
By determining the target attributes associated with the forecast day, selecting the corresponding target historical electricity price data from the historical electricity price data set, and selecting a matching target electricity price forecast model from multiple electricity price forecast models, the target electricity price forecast model is called to perform electricity price forecasting, including data cleaning, normalization processing, and training and optimization of multiple neural network models.
The accuracy of electricity price forecasting is improved, and more accurate electricity price forecasting is achieved through highly matching target historical electricity price data and model selection.
Smart Images

Figure CN120672374A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of electricity price prediction, and in particular to an electricity price prediction method, apparatus, device, storage medium and program product. Background Art
[0002] Accurate electricity price forecasts are increasingly important for market participants' bidding strategies and uncertainty risk management. Having accurate price forecasts enables market participants to develop optimized bidding strategies and maximize revenue. However, price forecasts exhibit typical nonlinearity and high volatility due to the influence of competitor bidding behavior and power system operating conditions, making them a challenging task.
[0003] Currently, electricity price forecasting methods are mainly divided into three categories: physical methods, statistical methods, and machine learning methods. Physical methods, based on safety-constrained unit commitment and safety-constrained economic dispatch models, simulate the future electricity market clearing process based on boundary conditions and physical theory. However, this method requires a large amount of real-time operating data, resulting in high computational complexity and low accuracy of electricity price forecasts due to the presence of outliers. Linear methods, as they are mainly based on linear models to predict electricity prices, have low accuracy in predicting electricity prices for high-dimensional and nonlinear electricity price series. Machine learning methods are generally based on shallow learning models that minimize errors, which are prone to overfitting and gradient vanishing problems, resulting in low accuracy in electricity price forecasts.
[0004] Therefore, how to improve the accuracy of electricity price forecasting has become an urgent problem to be solved. Summary of the Invention
[0005] The embodiments of the present application provide an electricity price prediction method, apparatus, device, storage medium, and program product, which can improve the accuracy of electricity price prediction.
[0006] In a first aspect, an embodiment of the present application provides a method for predicting electricity prices, the method comprising:
[0007] Determining a target attribute associated with the forecast day; the target attribute represents a data feature of the electricity price data corresponding to the forecast day;
[0008] Selecting target historical electricity price data corresponding to the target attribute from a historical electricity price data set; and selecting a target electricity price prediction model that matches the target attribute from a plurality of predetermined electricity price prediction models;
[0009] The target electricity price prediction model is called to obtain the electricity price on the predicted day based on the target historical electricity price data.
[0010] In one embodiment, target historical electricity price data corresponding to a target attribute is selected from a historical electricity price data set, including: normalizing the data in the historical electricity price data set to obtain a normalized historical electricity price data set; using a least absolute shrinkage and selection operator regression method, based on the target attribute, removing historical electricity price data with a weight of 0 from the normalized historical electricity price data set to obtain the target historical electricity price data corresponding to the target attribute.
[0011] In one embodiment, before normalizing the data in the historical electricity price data set to obtain the normalized historical electricity price data set, the method also includes: determining an abnormality score corresponding to each data in the historical electricity price data set; determining abnormal data in the historical electricity price data set based on the abnormality score corresponding to each data; removing and replacing the abnormal data to obtain a processed historical electricity price data set; normalizing the data in the historical electricity price data set to obtain a normalized historical electricity price data set, including: normalizing the data in the processed historical electricity price data set to obtain a normalized historical electricity price data set.
[0012] In one embodiment, the method further includes: obtaining multiple sample data sets; each sample data set is used to determine the electricity price on different sample prediction days, and the attributes of the sample data sets corresponding to each sample prediction day are different; determining an initial electricity price prediction model that matches each sample data set, and based on the training sample data set and back propagation algorithm included in each sample data set, training and optimizing the initial electricity price prediction model that matches each sample data set to obtain a trained electricity price prediction model that matches each sample data set; inputting the verification data set included in each sample data set into the trained electricity price prediction model that matches each sample data set to obtain a first predicted electricity price for each sample prediction day, and determining the error between the first predicted electricity price for each sample prediction day and the actual electricity price for each sample prediction day; based on the error and the data characteristics of each data in each sample data set, optimizing the trained electricity price prediction model that matches each sample data set again to obtain multiple electricity price prediction models.
[0013] In one embodiment, the method further includes: inputting the validation data set included in each sample data set into an electricity price prediction model that matches each sample data set to obtain a second predicted electricity price for each sample prediction day; determining the residual between the second predicted electricity price and the actual electricity price for each sample prediction day; determining the optimal solution of a preset piecewise linear loss function based on the second predicted electricity price, the actual electricity price and the residual for each prediction day, the optimal solution including a first parameter vector and a second parameter vector for each sample prediction day; determining the confidence level of the second predicted electricity price for each sample prediction day based on the first parameter vector, the second parameter vector and the actual electricity price for each sample prediction day; the confidence level is used to indicate the degree of credibility of the second predicted electricity price.
[0014] In one of the embodiments, an initial electricity price prediction model matching each sample data set is determined separately, including: for each sample data set, when the attribute associated with the sample prediction day corresponding to the sample data set is a first-category attribute, determining that the initial electricity price prediction model matching the sample data set is a deep belief network model; the first-category attribute is used to indicate that the sample data set is related to human factors; when the attribute associated with the sample prediction day corresponding to the sample data set is a second-category attribute, determining that the initial electricity price prediction model matching the sample data set is a long short-term memory network model; the second-category attribute is used to indicate that the sample data set is related to time; when the attribute associated with the sample prediction day corresponding to the sample data set is a third-category attribute, determining that the initial electricity price prediction model matching the sample data set is a convolutional neural network model; the third-category attribute is used to indicate that the sample data set is related to mutation information.
[0015] In a second aspect, the present application provides an electricity price prediction device, which includes:
[0016] A determination module, configured to determine a target attribute associated with a forecast day; the target attribute represents a data feature of the electricity price data corresponding to the forecast day;
[0017] A selection module is configured to select target historical electricity price data corresponding to a target attribute from a historical electricity price data set; and to select a target electricity price prediction model that matches the target attribute from a plurality of predetermined electricity price prediction models;
[0018] The processing module is used to call the target electricity price prediction model and obtain the electricity price on the prediction day based on the target historical electricity price data.
[0019] In a third aspect, the present application provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are performed:
[0020] Determining a target attribute associated with the forecast day; the target attribute represents a data feature of the electricity price data corresponding to the forecast day;
[0021] Selecting target historical electricity price data corresponding to the target attribute from a historical electricity price data set; and selecting a target electricity price prediction model that matches the target attribute from a plurality of predetermined electricity price prediction models;
[0022] The target electricity price prediction model is called to obtain the electricity price on the predicted day based on the target historical electricity price data.
[0023] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the following steps:
[0024] Determining a target attribute associated with the forecast day; the target attribute represents a data feature of the electricity price data corresponding to the forecast day;
[0025] Selecting target historical electricity price data corresponding to the target attribute from a historical electricity price data set; and selecting a target electricity price prediction model that matches the target attribute from a plurality of predetermined electricity price prediction models;
[0026] The target electricity price prediction model is called to obtain the electricity price on the predicted day based on the target historical electricity price data.
[0027] In a fifth aspect, the present application further provides a computer program product, comprising a computer program, which, when executed by a processor, implements the following steps:
[0028] Determining a target attribute associated with the forecast day; the target attribute represents a data feature of the electricity price data corresponding to the forecast day;
[0029] Selecting target historical electricity price data corresponding to the target attribute from a historical electricity price data set; and selecting a target electricity price prediction model that matches the target attribute from a plurality of predetermined electricity price prediction models;
[0030] The target electricity price prediction model is called to obtain the electricity price on the predicted day based on the target historical electricity price data.
[0031] In the above-mentioned electricity price forecasting method, apparatus, device, storage medium, and program product, a computer device can determine a target attribute associated with a forecast date; the target attribute represents a data feature of the electricity price data corresponding to the forecast date; target historical electricity price data corresponding to the target attribute is selected from a historical electricity price data set; and a target electricity price forecasting model that matches the target attribute is selected from a plurality of predetermined electricity price forecasting models; the target electricity price forecasting model is called to obtain the electricity price on the forecast date based on the target historical electricity price data. Using this method, since the target historical electricity price data and the target electricity price forecasting model used to determine the forecasted electricity price are both selected based on the target attribute associated with the forecast date, there is a high degree of matching between the target historical electricity price data, the target electricity price forecasting model, and the forecast date. Therefore, by calling the target electricity price forecasting model and forecasting the electricity price on the forecast date based on the target historical electricity price data, a more accurate electricity price on the forecast date can be obtained, thereby improving the accuracy of the electricity price forecast. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following briefly introduces the drawings required for use in the embodiments of the present application or related technical descriptions. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying any creative work.
[0033] Figure 1 This is a schematic diagram of an application scenario of an electricity price prediction method provided in an embodiment of the present application;
[0034] Figure 2 This is a flow chart of an electricity price prediction method provided in an embodiment of the present application;
[0035] Figure 3 This is a flow chart of another electricity price prediction method provided by an embodiment of the present application;
[0036] Figure 4 This is a schematic diagram of the structure of an electricity price prediction device provided in an embodiment of the present application;
[0037] Figure 5 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0038] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0039] The following introduces the application scenarios of the electricity price prediction method provided in the embodiments of the present application.
[0040] See Figure 1 , Figure 1 This is a schematic diagram of an application scenario of an electricity price prediction method provided by an embodiment of the present application. Figure 1 As shown, it includes a computer device 101 and a database server 102. The computer device 101 and the database server 102 perform data transmission via a network.
[0041] The computer device 101 may first determine a target attribute associated with the forecast date; the target attribute represents a data feature of the electricity price data corresponding to the forecast date; then, obtain a historical electricity price data set and multiple electricity price prediction models from the database server 102; select target historical electricity price data corresponding to the target attribute from the historical electricity price data set; and select a target electricity price prediction model that matches the target attribute from multiple predetermined electricity price prediction models; call the target electricity price prediction model, and obtain the electricity price on the forecast date based on the target historical electricity price data. Using this method, since the target historical electricity price data and the target electricity price prediction model used to determine the forecast electricity price are both selected based on the target attribute associated with the forecast date, there is a high degree of matching between the target historical electricity price data, the target electricity price prediction model, and the forecast date. Therefore, calling the target electricity price prediction model and predicting the electricity price on the forecast date based on the target historical electricity price data can obtain a more accurate electricity price on the forecast date, thereby improving the accuracy of the electricity price prediction.
[0042] Optionally, the computer device 101 may be a terminal device or a server. The terminal devices mentioned herein may include, but are not limited to, smartphones, tablet computers, laptop computers, desktop computers, smart watches, smart TVs, and smart car terminals. The server mentioned herein may be an independent physical server, or a server cluster or distributed system consisting of multiple physical servers.
[0043] The database server 102 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, etc., which is not limited here.
[0044] See Figure 2 , Figure 2 This is a flow chart of a method for predicting electricity prices provided by an embodiment of the present application. Figure 1 The computer device 101 in the embodiment is executed. Figure 2 As shown, the electricity price prediction method may include but is not limited to the following steps:
[0045] S201. Determine a target attribute associated with a forecast day; the target attribute represents a data feature of electricity price data corresponding to the forecast day.
[0046] There is a one-to-one correspondence between any two of the forecast day, the electricity price data corresponding to the forecast day, and the target attribute associated with the forecast day.
[0047] Optionally, the target attribute can be a first-category attribute, a second-category attribute, or a third-category attribute; wherein, the first-category attribute is used to indicate that the electricity price data corresponding to the forecast day is related to human factors; the second-category attribute is used to indicate that the electricity price data corresponding to the forecast day is related to time; and the third-category attribute is used to indicate that the electricity price data corresponding to the forecast day is related to mutation information.
[0048] Exemplarily, the electricity price data corresponding to the forecast day is related to human factors, for example, the electricity price data corresponding to the forecast day is related to the decision-making behavior of the participants, energy policies, etc.; the electricity price data corresponding to the forecast day is related to time, for example, the electricity price data corresponding to the forecast day has periodic, seasonal and other changes, that is, the electricity price data corresponding to the forecast day has autocorrelation in the time series; the electricity price data corresponding to the forecast day is related to mutation information, for example, the electricity price data corresponding to the forecast day has nonlinear abnormal data fluctuations caused by emergencies or transient changes in supply and demand.
[0049] The following is an example of a process in which a computer device determines a target attribute associated with a forecast day.
[0050] For example, suppose the computer device has determined that a meeting related to energy policy will be held on the forecast date. In this case, the computer device may determine that the target attribute associated with the forecast date is a first-category attribute. For another example, suppose the computer device has determined that the forecast date is summer. In this case, the computer device may determine that the target attribute associated with the forecast date is a second-category attribute. For another example, suppose the computer device has determined that a power outage is likely on the forecast date. In this case, the computer device may determine that the target attribute associated with the forecast date is a third-category attribute.
[0051] S202 : Select target historical electricity price data corresponding to a target attribute from a historical electricity price data set; and select a target electricity price prediction model that matches the target attribute from a plurality of predetermined electricity price prediction models.
[0052] In an optional embodiment, the computer device selects target historical electricity price data corresponding to the target attribute from the historical electricity price data set, including: when the target attribute is a first type of attribute, selecting the target historical electricity price data corresponding to the first type of attribute from the historical electricity price data set; when the target attribute is a second type of attribute, selecting the target historical electricity price data corresponding to the second type of attribute from the historical electricity price data set; when the target attribute is a third type of attribute, selecting the target historical electricity price data corresponding to the third type of attribute from the historical electricity price data set.
[0053] For example, if the target attribute is that the electricity price data for the forecasted day is related to the results of an energy policy meeting, the computer device may select all historical electricity price data related to human factors from the historical electricity price dataset as the target historical electricity price data. For another example, if the target attribute is that the electricity price data for the forecasted day is related to the summer season, the computer device may select all historical electricity price data for the summer season from the historical electricity price dataset as the target historical electricity price data. For another example, if the target attribute is that a power outage is likely on the forecasted day, the computer device may select all historical electricity price data related to mutation information from the historical electricity price dataset as the target historical electricity price data.
[0054] In an optional implementation, before step S202 , the computer device may first train different electricity price prediction models based on historical electricity price data of different attributes, wherein one electricity price prediction model corresponds to historical electricity price data of one attribute.
[0055] S203: Call the target electricity price prediction model and obtain the electricity price on the prediction day based on the target historical electricity price data.
[0056] In an optional embodiment, a computer device calls a target electricity price prediction model to obtain the electricity price on the prediction day based on the target historical electricity price data, which may include: performing data cleaning processing on the target historical electricity price to obtain the processed target historical electricity price; inputting the processed target historical electricity price into the target electricity price prediction model to obtain the electricity price on the prediction day.
[0057] In an embodiment of the present application, a computer device can determine a target attribute associated with a forecast day; the target attribute represents a data feature of the electricity price data corresponding to the forecast day; target historical electricity price data corresponding to the target attribute is selected from a historical electricity price data set; and a target electricity price prediction model that matches the target attribute is selected from a plurality of predetermined electricity price prediction models; the target electricity price prediction model is called to obtain the electricity price on the forecast day based on the target historical electricity price data. Using this method, since the target historical electricity price data and the target electricity price prediction model used to determine the forecast electricity price are both selected based on the target attribute associated with the forecast day, there is a high degree of matching between the target historical electricity price data, and thus, by calling the target electricity price prediction model and predicting the electricity price on the forecast day based on the target historical electricity price data, a more accurate electricity price on the forecast day can be obtained, i.e., the accuracy of the electricity price prediction can be improved.
[0058] See Figure 3 , Figure 3 This is a flow chart of another electricity price prediction method provided by the embodiment of the present application. Figure 2 The electricity price forecasting method shown differs in that Figure 3 The electricity price prediction method shown in FIG specifically describes how a computer device selects target historical electricity price data corresponding to a target attribute from a historical electricity price data set. Figure 3 As shown, the electricity price prediction method may include but is not limited to the following steps:
[0059] S301. Determine a target attribute associated with a forecast day; the target attribute represents a data feature of electricity price data corresponding to the forecast day.
[0060] In an optional implementation, the relevant description of step S301 can be found in the description of the aforementioned step S201, and will not be repeated here.
[0061] S302 : Determine an abnormality score corresponding to each data in the historical electricity price data set, and determine abnormal data in the historical electricity price data set based on the abnormality score corresponding to each data.
[0062] In an optional embodiment, the computer device may use an isolation forest (IF) algorithm to determine an anomaly score corresponding to each data in the historical electricity price data set, and determine abnormal data in the historical electricity price data set based on the anomaly score corresponding to each data.
[0063] The Isolation Forest algorithm, also known as the Isolated Forest algorithm, is a tree-based anomaly detection algorithm. It starts with an outlier, divides it into groups using specified rules, and then makes judgments based on the number of divisions. The Isolation Forest algorithm does not rely on any prior assumptions and detects anomaly scores and identifies outliers by identifying isolated trees (including those with no or only two children).
[0064] Among them, when the computer device uses the isolation forest algorithm to determine the anomaly score corresponding to each data in the historical electricity price data set, the following formula (1) can be used.
[0065] (1)
[0066] In formula (1), s(x,n) represents the anomaly score of the historical electricity price data x in the historical electricity price data set composed of n historical electricity price data, where the value range of s(x,n) is [0,1]; h(x) represents the path length corresponding to the historical electricity price data x; E(h(x)) represents the expectation of the path length of the historical electricity price data x in a batch of isolated trees; c(n) represents the average value of the path lengths corresponding to the n historical electricity price data in the historical electricity price data set, which is used to standardize the path length h(x) of the historical electricity price data x.
[0067] S303: Eliminate and replace abnormal data to obtain a processed historical electricity price data set.
[0068] S304 : normalizing the data in the processed historical electricity price dataset to obtain a normalized historical electricity price dataset.
[0069] In an optional embodiment, when the computer device normalizes the data in the processed historical electricity price dataset, a linear normalization method, a z-score normalization method, etc. may be used, which is not limited here.
[0070] S305 , using the least absolute shrinkage and selection operator regression method, based on the target attribute, remove the historical electricity price data with a weight of 0 from the normalized historical electricity price data set to obtain the target historical electricity price data corresponding to the target attribute.
[0071] The Least Absolute Shrinkage and Selection Operator (Lasso) is a linear regression method primarily used for variable selection and feature sparsification. Its basic idea is to add an L1-norm penalty term to the objective function of minimizing the sum of squared residuals, thereby constraining computational complexity.
[0072] The calculation formula of Lasso is shown in the following formula (2).
[0073] (2)
[0074] In formula (2), x ij It represents the time-of-use load or historical electricity price of the jth feature in the i-th time series; It represents the overall regression coefficient; represents the regression coefficient of the jth feature; n represents the total number of time series; p represents the total number of features; y represents the response variable, the electricity price or load at a certain point in the future; r represents the offset; It represents the adjustment parameter, which is controlled to adjust the overall regression coefficient.
[0075] S306 : Select a target electricity price prediction model that matches the target attribute from a plurality of predetermined electricity price prediction models.
[0076] S307: Call the target electricity price prediction model and obtain the electricity price on the prediction day based on the target historical electricity price data.
[0077] In an optional implementation, the relevant description of step S307 can be found in the description of the aforementioned step S203, which will not be repeated here.
[0078] In an embodiment of the present application, a computer device can determine an abnormality score corresponding to each data in a historical electricity price data set, and determine the abnormal data in the historical electricity price data set based on the abnormality score corresponding to each data; remove and replace the abnormal data to obtain a processed historical electricity price data set; normalize the data in the processed historical electricity price data set to obtain a normalized historical electricity price data set; adopt the minimum absolute shrinkage and selection operator regression method, based on the target attribute, remove the historical electricity price data with a weight of 0 from the normalized historical electricity price data set to obtain the target historical electricity price data corresponding to the target attribute. In this way, the accuracy of the target historical electricity price data corresponding to the target attribute can be improved, thereby calling the target electricity price prediction model, and predicting the electricity price on the prediction day based on the target historical electricity price data, so as to further obtain a more accurate electricity price on the prediction day, that is, further improve the accuracy of the electricity price prediction.
[0079] In an optional embodiment, Figure 2 and Figure 3 In the electricity price prediction method shown, multiple electricity price prediction models are determined by a computer device through the following steps:
[0080] Step 1: Acquire multiple sample data sets; each sample data set is used to determine the electricity price on a different sample prediction day, and the attributes of the sample data sets corresponding to each sample prediction day are different.
[0081] The attributes of the sample dataset corresponding to the sample prediction day can also be referred to as attributes associated with the sample prediction day. The attributes of the sample dataset corresponding to each sample prediction day are different. In other words, there is a one-to-one correspondence between any two of the sample prediction day, the sample dataset corresponding to the sample prediction day, and the attributes of the sample dataset.
[0082] For example, assume that there are three sample data sets, recorded as sample data set 1, sample data set 2 and sample data set 3, then sample data set 1 is used to determine the electricity price of sample prediction day A, and the attribute of sample data set 1 is attribute X. In this case, the attribute associated with sample prediction day A is attribute X; sample data set 2 is used to determine the electricity price of sample prediction day B, and the attribute of sample data set 2 is attribute Y. In this case, the attribute associated with sample prediction day B is attribute Y; sample data set 3 is used to determine the electricity price of sample prediction day C, and the attribute of sample data set 3 is attribute Z. In this case, the attribute associated with sample prediction day C is attribute Z.
[0083] Step 2: Determine the initial electricity price prediction model that matches each sample data set.
[0084] In an optional embodiment, the computer device separately determines the initial electricity price prediction model that matches each sample data set, including: for each sample data set, when the attribute corresponding to the sample data set is a first type of attribute, determining that the initial electricity price prediction model that matches the sample data set is a deep belief network model; the first type of attribute is used to indicate that the sample data set is related to human factors; when the attribute corresponding to the sample data set is a second type of attribute, determining that the initial electricity price prediction model that matches the sample data set is a long short-term memory network model; the second type of attribute is used to indicate that the sample data set is related to time; when the attribute corresponding to the sample data set is a third type of attribute, determining that the initial electricity price prediction model that matches the sample data set is a convolutional neural network model; the third type of attribute is used to indicate that the sample data set is related to mutation information.
[0085] Deep Belief Networks (DBNs) consist of stacked Restricted Boltzmann Machines (RBMs) for unsupervised pre-training and logistic regression layers for predicting outputs. RBMs are a simple binary network model and an important component of DBNs.
[0086] Convolutional Neural Networks (CNNs) are feedforward neural networks that incorporate a feature extractor consisting of convolutional layers and subsampling layers (pooling layers). In a convolutional layer of a CNN, a neuron is connected only to a subset of neurons in adjacent layers. A convolutional layer typically contains several feature maps, each composed of a rectangular array of neurons. Neurons in the same feature map share weights, known as the convolution kernel. The convolution kernel is typically initialized with a random decimal matrix. During network training, the kernel learns appropriate weights.
[0087] Among them, the Long Short Term Memory Network (LSTM) is an improved Recurrent Neural Network (RNN), which solves the problem of the original RNN in processing long-distance dependencies by introducing unit states and three control switches.
[0088] Step 3: Based on the training sample data set and the back propagation algorithm included in each sample data set, the initial electricity price prediction model matching each sample data set is trained and optimized to obtain a trained electricity price prediction model matching each sample data set.
[0089] In an optional embodiment, the computer device trains and optimizes the initial electricity price prediction model that matches each sample data set based on the training sample data set and the back propagation algorithm included in each sample data set, thereby obtaining a trained electricity price prediction model that matches each sample data set. This can be based on the training sample data set included in each sample data set, and on the basis of the back propagation algorithm, a small-batch gradient descent method is used to train and optimize the initial electricity price prediction model that matches each sample data set, thereby obtaining a trained electricity price prediction model that matches each sample data set. In this way, since the small-batch processing method can reduce the number of computational iterations and has better convergence and stability, this embodiment can, on the one hand, quickly complete the training and obtain the trained electricity price prediction model, and on the other hand, it can be beneficial to improve the stability of the trained electricity price prediction model and the accuracy of the prediction.
[0090] Step 4: Input the validation data set included in each sample data set into the trained electricity price prediction model that matches each sample data set to obtain the first predicted electricity price for each sample prediction day, and determine the error between the first predicted electricity price for each sample prediction day and the actual electricity price for each sample prediction day.
[0091] The error between the first predicted electricity price on each sample prediction day and the actual electricity price on each sample prediction day can also be called the validation set error.
[0092] Step 5: Based on the error and the data features of each data in each sample data set, the trained electricity price prediction model matching each sample data set is optimized again to obtain multiple electricity price prediction models.
[0093] Since the error (i.e., the validation set error) contains the deviation information between the predicted value (the first predicted electricity price on each sample prediction day) and the actual value (the actual electricity price on each sample prediction day) of the trained electricity price prediction model in the validation stage, it can provide an adjustment basis for error correction. Therefore, based on the error and the data characteristics of each data in each sample data set, the trained electricity price prediction model matching each sample data set is optimized again, and multiple electricity price prediction models with higher prediction performance can be obtained, which is conducive to improving the accuracy of electricity price prediction.
[0094] By adopting this embodiment, the computer device can determine the electricity price prediction model that matches each sample data set based on the sample data sets of different attributes corresponding to different prediction days. This is conducive to selecting the electricity price prediction model that matches the target attribute associated with the prediction day in the actual application process, and predicting the electricity price on the prediction day, thereby helping to improve the accuracy of electricity price prediction.
[0095] In an optional embodiment, the computer device may also input the verification data set included in each sample data set into an electricity price prediction model that matches each sample data set to obtain a second predicted electricity price for each sample prediction day; determine the residual between the second predicted electricity price and the actual electricity price for each sample prediction day; determine the optimal solution of a preset piecewise linear loss function based on the second predicted electricity price, the actual electricity price and the residual for each prediction day, the optimal solution including a first parameter vector and a second parameter vector for each sample prediction day; determine the confidence level of the second predicted electricity price for each sample prediction day based on the first parameter vector, the second parameter vector and the actual electricity price for each sample prediction day; the confidence level is used to indicate the degree of credibility of the second predicted electricity price.
[0096] Optionally, the preset piecewise linear loss function can be shown as the following formula (3).
[0097] (3)
[0098] In formula (3), It represents the predicted value of the j-th sample in the validation set, that is, the second predicted electricity price on the j-th sample prediction day; represents the actual value of the j-th sample in the validation set, that is, the actual electricity price on the j-th sample prediction day; r represents the residual, that is, the difference between the predicted value and the actual value; represents the parameter vector, including (first parameter vector) and (Second parameter vector) for the quantiles in The model prediction under It represents the piecewise linear loss function, which can be expressed as the following formula (4).
[0099] (4)
[0100] In formula (4), the physical meaning of each parameter can be found in the description of formula (3) above and will not be repeated here.
[0101] Optionally, when determining the confidence level of the second predicted electricity price for each sample prediction day based on the first parameter vector, the second parameter vector and the actual electricity price for each sample prediction day, the computer device may use the following formula (5).
[0102] (5)
[0103] In formula (5), It represents the confidence of the second predicted electricity price on the jth sample prediction day; It represents the uncertainty of the second predicted electricity price on the jth sample forecast day; It represents the actual value of the jth sample in the validation set; represents the first parameter vector; represents the second parameter vector.
[0104] In an optional implementation, the computer device may also use Average Coverage Rate (Average Coverage Rate, ACP) and Interval Sharpness (IS) to evaluate the confidence.
[0105] The average coverage is the coverage value of the observations within the prediction interval under the given nominal confidence level of the prediction interval (1-α) (that is, the aforementioned η). The interval sharpness is a comprehensive measure of the deviation between the prediction interval and the out-of-range observation value, as well as the width of the prediction interval, given the nominal confidence level of the prediction interval (1-α).
[0106] The expressions of ACP and IS are shown in formulas (6) and (7) below, respectively.
[0107] (6)
[0108] (7)
[0109] In formulas (6) and (7), T represents the total number of time points; It represents the probability of making a type I error and is used to describe the uncertainty and risk in interval estimation; It represents the confidence level; It represents the width of the prediction interval. They represent the lower and upper bounds of the prediction interval at time t, respectively.
[0110] With this implementation, the computer device can determine the confidence level of the second predicted electricity price for each sample prediction day by using the quantile regression method, thereby facilitating the user to determine the credibility of the predicted electricity price.
[0111] In an optional embodiment, the computer device may also evaluate the performance of multiple electricity price prediction models using mean absolute percentage error (MAPE), mean absolute error (MAE), and root mean square error (RMSE). A smaller error index value indicates a higher accuracy of the electricity price prediction model.
[0112] The expressions of MAPE, MAE, and RMSE are shown in the following formulas (8) to (10), respectively.
[0113] (8)
[0114] (9)
[0115] (10)
[0116] In formulas (8) to (10), r t It represents the true value at time t, p t It represents the predicted value of the electricity price prediction model at time t; T represents the time period.
[0117] By adopting this embodiment, the computer device can evaluate the performance of multiple electricity price prediction models respectively, thereby determining the accuracy of each electricity price prediction model.
[0118] It should be understood that, although the various steps in the flowcharts involved in the various embodiments described above are displayed in sequence according to the instructions of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowcharts involved in the various embodiments described above can include multiple steps or multiple stages, and these steps or stages are not necessarily executed and completed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of steps or stages in other steps.
[0119] Based on the same inventive concept, the present application also provides an electricity price forecasting device for implementing the electricity price forecasting method described above. The solution provided by this device is similar to the solution described in the method described above. Therefore, the specific limitations of one or more of the following electricity price forecasting device embodiments can be found in the above-mentioned limitations of the electricity price forecasting method and will not be repeated here.
[0120] See Figure 4 , Figure 4 This is a schematic diagram of the structure of an electricity price prediction device provided in an embodiment of the present application. Figure 4 As shown, the electricity price prediction device may include but is not limited to:
[0121] Determination module 401, for determining a target attribute associated with a forecast day; the target attribute represents a data feature of the electricity price data corresponding to the forecast day;
[0122] The selection module 402 is configured to select target historical electricity price data corresponding to a target attribute from a historical electricity price data set; and select a target electricity price prediction model that matches the target attribute from a plurality of predetermined electricity price prediction models;
[0123] The processing module 403 is used to call the target electricity price prediction model and obtain the electricity price on the prediction day based on the target historical electricity price data.
[0124] In one embodiment, when the selection module 402 is used to select target historical electricity price data corresponding to the target attribute from the historical electricity price data set, it is specifically used to: normalize the data in the historical electricity price data set to obtain a normalized historical electricity price data set; use the least absolute shrinkage and selection operator regression method, based on the target attribute, to eliminate the historical electricity price data with a weight of 0 from the normalized historical electricity price data set to obtain the target historical electricity price data corresponding to the target attribute.
[0125] In one embodiment, before the selection module 402 is used to normalize the data in the historical electricity price data set to obtain the normalized historical electricity price data set, the determination module 401 is also used to: determine the anomaly score corresponding to each data in the historical electricity price data set; determine the abnormal data in the historical electricity price data set based on the anomaly score corresponding to each data; the processing module 403 is also used to eliminate and replace the abnormal data to obtain a processed historical electricity price data set; normalize the data in the historical electricity price data set to obtain a normalized historical electricity price data set, including: normalizing the data in the processed historical electricity price data set to obtain a normalized historical electricity price data set.
[0126] In one embodiment, the device may further include a training module. The training module is used to obtain multiple sample data sets; each sample data set is used to determine the electricity price of different sample prediction days, and the attributes of the sample data sets corresponding to each sample prediction day are different; an initial electricity price prediction model matching each sample data set is determined respectively, and based on the training sample data set included in each sample data set and the back propagation algorithm, the initial electricity price prediction model matching each sample data set is trained and optimized to obtain a trained electricity price prediction model matching each sample data set; the validation data set included in each sample data set is input into the trained electricity price prediction model matching each sample data set to obtain a first predicted electricity price for each sample prediction day, and the error between the first predicted electricity price for each sample prediction day and the actual electricity price for each sample prediction day is determined; based on the error and the data characteristics of each data in each sample data set, the trained electricity price prediction model matching each sample data set is optimized again to obtain multiple electricity price prediction models.
[0127] In one embodiment, the device also includes a verification module, which is used to input the verification data set included in each sample data set into an electricity price prediction model that matches each sample data set to obtain a second predicted electricity price for each sample prediction day; determine the residual between the second predicted electricity price and the actual electricity price for each sample prediction day; based on the second predicted electricity price, the actual electricity price and the residual for each prediction day, determine the optimal solution of a preset piecewise linear loss function, the optimal solution including a first parameter vector and a second parameter vector for each sample prediction day; based on the first parameter vector, the second parameter vector and the actual electricity price for each sample prediction day, determine the confidence level of the second predicted electricity price for each sample prediction day; the confidence level is used to indicate the degree of credibility of the second predicted electricity price.
[0128] In one embodiment, when the training module is used to determine the initial electricity price prediction model that matches each sample data set respectively, it is specifically used to: for each sample data set, when the attribute associated with the sample prediction day corresponding to the sample data set is a first-class attribute, determine that the initial electricity price prediction model that matches the sample data set is a deep belief network model; the first-class attribute is used to indicate that the sample data set is related to human factors; when the attribute associated with the sample prediction day corresponding to the sample data set is a second-class attribute, determine that the initial electricity price prediction model that matches the sample data set is a long short-term memory network model; the second-class attribute is used to indicate that the sample data set is related to time; when the attribute associated with the sample prediction day corresponding to the sample data set is a third-class attribute, determine that the initial electricity price prediction model that matches the sample data set is a convolutional neural network model; the third-class attribute is used to indicate that the sample data set is related to mutation information.
[0129] Each module in the above-mentioned electricity price prediction device can be implemented in whole or in part through software, hardware, or a combination thereof. Each module can be embedded in or independent of the processor in the terminal device in hardware form, or can be stored in the memory of the terminal device in software form, so that the processor can call and execute the corresponding operations of each module.
[0130] In an exemplary embodiment, the present application provides a computer device, which may be a terminal device, and its internal structure diagram may be as follows: Figure 5As shown. The computer device includes a processor, memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals via wired or wireless means, and the wireless means can be implemented via Wi-Fi, a mobile cellular network, near field communication (NFC), or other technologies. When executed by the processor, the computer program implements an electricity price prediction method. The display unit of the computer device is used to form a visually visible image, and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device casing, or an external keyboard, touchpad or mouse.
[0131] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0132] In an exemplary embodiment, the present application provides a computer device including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned electricity price prediction method when executing the computer program.
[0133] In an exemplary embodiment, the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps in the above-mentioned electricity price prediction method are implemented.
[0134] In an exemplary embodiment, the present application provides a computer program product, including a computer program, which implements the steps in the above-mentioned electricity price prediction method when executed by a processor.
[0135] It should be noted that the data involved in this application (including but not limited to target historical electricity price data, multiple electricity price forecast models, etc.) are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0136] Those skilled in the art will understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. In particular, any reference to memory, database, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The databases involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the various embodiments provided herein may be, but are not limited to, general-purpose processors, central processing units (CPUs), graphics processing units (GPUs), digital signal processors (DSPs), programmable logic devices (PLDs), quantum computing-based data processing logic devices, artificial intelligence (AI) processors, and the like.
[0137] The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0138] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.
Claims
1. A method for predicting electricity prices, characterized in that: The method comprises: Determining a target attribute associated with a forecast day; the target attribute represents a data feature of the electricity price data corresponding to the forecast day; Selecting target historical electricity price data corresponding to the target attribute from a historical electricity price data set; and selecting a target electricity price prediction model that matches the target attribute from a plurality of predetermined electricity price prediction models; The target electricity price prediction model is called to obtain the electricity price on the predicted day based on the target historical electricity price data.
2. The method according to claim 1, characterized in that The step of selecting target historical electricity price data corresponding to the target attribute from the historical electricity price data set includes: Normalizing the data in the historical electricity price data set to obtain a normalized historical electricity price data set; The least absolute shrinkage and selection operator regression method is adopted, and based on the target attribute, the historical electricity price data with a weight of 0 is removed from the normalized historical electricity price data set to obtain target historical electricity price data corresponding to the target attribute.
3. The method according to claim 2, characterized in that Before normalizing the data in the historical electricity price dataset to obtain the normalized historical electricity price dataset, the method further includes: Determine an anomaly score corresponding to each data in the historical electricity price data set; Determining abnormal data in the historical electricity price dataset based on anomaly scores corresponding to each data; Eliminating and replacing the abnormal data to obtain a processed historical electricity price data set; Normalizing the data in the historical electricity price data set to obtain a normalized historical electricity price data set includes: Normalization is performed on the data in the processed historical electricity price data set to obtain a normalized historical electricity price data set.
4. The method according to claim 1, wherein The method further comprises: Acquire multiple sample data sets; each of the sample data sets is used to determine the electricity price on a different sample prediction day, and the attributes of the sample data sets corresponding to each sample prediction day are different; Determining an initial electricity price prediction model that matches each of the sample data sets respectively, and training and optimizing the initial electricity price prediction model that matches each of the sample data sets based on a training sample data set and a back propagation algorithm included in each of the sample data sets, to obtain a trained electricity price prediction model that matches each of the sample data sets; Inputting the validation data set included in each of the sample data sets into a trained electricity price prediction model that matches each of the sample data sets to obtain a first predicted electricity price for each sample prediction day, and determining an error between the first predicted electricity price for each of the sample prediction days and the actual electricity price for each of the sample prediction days; Based on the error and the data features of each data in each sample data set, the trained electricity price prediction model matching each sample data set is optimized again to obtain a plurality of electricity price prediction models.
5. The method according to claim 4, characterized in that The method further comprises: Inputting the verification data set included in each sample data set into the electricity price prediction model matched with each sample data set to obtain a second predicted electricity price for each sample prediction day; determining a residual between the second predicted electricity price and the actual electricity price for each of the sample prediction days; Determining an optimal solution of a preset piecewise linear loss function based on the second predicted electricity price, the actual electricity price, and the residual for each of the predicted days, the optimal solution comprising a first parameter vector and a second parameter vector for each of the sample predicted days; Based on the first parameter vector, the second parameter vector and the actual electricity price described in each of the sample prediction days, the confidence level of the second predicted electricity price for each of the sample prediction days is determined; the confidence level is used to represent the credibility of the second predicted electricity price.
6. The method according to claim 4, characterized in that The step of respectively determining an initial electricity price prediction model that matches each of the sample data sets includes: For each of the sample data sets, when the attribute corresponding to the sample data set is a first type of attribute, determining that the initial electricity price prediction model matching the sample data set is a deep belief network model; the first type of attribute is used to indicate that the sample data set is related to human factors; In a case where the attribute corresponding to the sample data set is a second type of attribute, determining that the initial electricity price prediction model matching the sample data set is a long short-term memory network model; the second type of attribute is used to indicate that the sample data set is time-related; When the attribute corresponding to the sample data set is a third type of attribute, it is determined that the initial electricity price prediction model matching the sample data set is a convolutional neural network model; the third type of attribute is used to indicate that the sample data set is related to mutation information.
7. An electricity price prediction device, characterized in that: The device comprises: A determination module, configured to determine a target attribute associated with a forecast day; the target attribute represents a data feature of the electricity price data corresponding to the forecast day; a selection module configured to select target historical electricity price data corresponding to the target attribute from a historical electricity price data set; and select a target electricity price prediction model matching the target attribute from a plurality of predetermined electricity price prediction models; The processing module is used to call the target electricity price prediction model and obtain the electricity price on the predicted day based on the target historical electricity price data.
8. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method according to any one of claims 1 to 6 when executing the computer program.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.