Electricity price prediction method and system based on Stacking ensemble learning, medium and processor

By applying the Stacking integrated learning method in electricity price prediction, combining the random forest model, gradient enhancement decision tree and SVM model, the problem of low accuracy of electricity price prediction in the existing technology is solved, and higher accuracy of electricity price prediction and lower economic losses are achieved.

CN119693039APending Publication Date: 2025-03-25GUANGXI POWER GRID CORP
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411622580.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-14
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

The prior art is difficult to accurately capture the relationship between complex factors in the power market, resulting in low accuracy of electricity price prediction.

Method used

The electricity price prediction method based on Stacking integrated learning is adopted, and the relationship data set between electricity price and various influencing factors is obtained by obtaining electricity price data in the power market. The first-layer prediction model composed of a random forest model and a gradient improvement decision tree is used to perform the second-layer prediction combined with the SVM model, and finally the accurate electricity price prediction results are obtained.

Benefits of technology

It improves the accuracy of electricity price prediction, reduces economic losses caused by prediction errors, and can better capture the complex relationship between electricity price and different factors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119693039A_ABST
    Figure CN119693039A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of electricity price prediction, and discloses an electricity price prediction method and system based on Stacking ensemble learning, a medium and a processor, and the method comprises the steps: obtaining electricity price data of an electricity market, and carrying out the processing of the data, and obtaining a data set of the relation between the electricity price and various influence factors; taking the data set as sample data, inputting a Stacking-based integrated learning first-layer prediction model composed of a random forest model and a gradient boosting decision tree, and outputting an initial electricity price prediction result; and inputting the initial electricity price prediction result into an SVM (Support Vector Machine) model in a second-layer prediction model based on Stacking ensemble learning, and obtaining a final electricity price prediction result through optimization operation of the SVM model. According to the invention, through Stacking ensemble learning, advantages of different models are combined, and the prediction accuracy of the electricity price is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of electricity price prediction, and in particular to an electricity price prediction method, system, medium and processor based on Stacking ensemble learning. Background Art

[0002] With the continuous reform and deepening of the power market, power trading is gradually moving towards marketization. In this environment, accurate prediction of electricity prices is crucial for market participants. Power consumers need to formulate optimal power consumption strategies to reduce power costs; power traders need to accurately predict power price fluctuations for effective trading and risk management.

[0003] As the complexity of the electricity market continues to increase, it is affected by many factors, such as energy prices (crude oil prices, coal prices, natural gas prices, etc.), supply and demand relationships, seasonal changes, etc. The traditional single forecasting method is difficult to accurately capture the relationship between these complex factors, and the error between the predicted electricity price and the actual price is large, and the accuracy is insufficient. Summary of the invention

[0004] In view of the problem that the prediction methods in the prior art are difficult to capture the relationship between complex factors, resulting in low accuracy of electricity prices, the present invention provides an electricity price prediction method, system, medium and processor based on Stacking ensemble learning, which can accurately predict electricity prices and reduce economic losses caused by prediction errors. The specific technical solution is as follows:

[0005] A method for predicting electricity prices based on Stacking ensemble learning, comprising:

[0006] Obtain electricity price data from the power market and process it to obtain a data set showing the relationship between electricity prices and various influencing factors;

[0007] The data set is used as sample data, and is input into a first-layer prediction model based on Stacking ensemble learning composed of a random forest model and a gradient boosting decision tree, and an initial electricity price prediction result is output;

[0008] The initial electricity price prediction result is input into the SVM model in the second-layer prediction model based on Stacking ensemble learning, and the final electricity price prediction result is obtained through the optimization operation of the SVM model.

[0009] Preferably, the acquisition of electricity price data from the electricity market and processing to obtain a data set of the relationship between electricity price and various influencing factors includes:

[0010] Obtain the average price of various resource price factors that affect electricity prices within multiple identical preset periods to obtain a sequence of data points for various resource prices;

[0011] According to the relationship between the data point sequence of various resource prices and the electricity price in the power market, a data set of the relationship between the electricity price and various resource price factors is obtained.

[0012] Preferably, the data set is used as sample data, and a first-layer prediction model based on Stacking ensemble learning composed of a random forest model and a gradient boosting decision tree is input, and the output of the initial electricity price prediction result includes:

[0013] After the data set is input as sample data into the random forest model, a decision tree classifier of the random forest model is used to make a voting decision and output a first electricity price prediction result;

[0014] After the data set is input as sample data into the gradient boosting decision tree, the gradient boosting decision tree is used to perform iterative calculation using the CART regression tree to output a second electricity price prediction result;

[0015] An initial electricity price prediction result based on the output of the first layer prediction model of Stacking ensemble learning is obtained according to the first electricity price prediction result and the second electricity price prediction result.

[0016] Preferably, after inputting the data set as sample data into the gradient boosting decision tree, performing iterative calculations using the CART regression tree through the gradient boosting decision tree, and outputting the second electricity price prediction result comprises:

[0017] After the sample data is input into the random forest model, the constant value that minimizes the loss function is calculated through the CART regression tree, and the constant value is used as the initial prediction value of the weak learner;

[0018] Calculating the residual of the loss function according to the initial prediction value and the sample data;

[0019] The sample data and the residual of the previous step are used as the training data of the next lesson tree to obtain a new regression tree;

[0020] The above steps are repeated according to a preset number of iterations to obtain a strong learner consisting of corresponding trees, and the second electricity price prediction result is obtained by weighted summing the prediction results of each tree.

[0021] Preferably, the inputting of the initial electricity price prediction result into the SVM model in the second-layer prediction model based on Stacking ensemble learning, and obtaining the final electricity price prediction result through the optimization operation of the SVM model includes:

[0022] Input the data set as sample data into the SVM model for training, and use the Bayesian optimization algorithm to adjust parameters to obtain a trained SVM model based on Bayesian optimization;

[0023] The initial electricity price prediction result is input into the trained SVM model based on Bayesian optimization to obtain the final electricity price prediction result.

[0024] Preferably, the method of using the Bayesian optimization algorithm to adjust parameters to obtain a trained SVM model based on Bayesian optimization includes:

[0025] Use the tree structure probability density estimation as a probability proxy model to construct the corresponding model loss function;

[0026] Construct sampling function by using expected improvement as sampling function to estimate probability density;

[0027] Simplifying the sampling function and calculating new hyperparameter values ​​under preset conditions;

[0028] Substitute the new hyperparameter value into the SVM model, fit and again, select the hyperparameter value corresponding to the maximum value of the sampling function, and obtain the trained SVM model based on Bayesian optimization.

[0029] A system for predicting electricity prices based on Stacking ensemble learning, applied to the aforementioned method for predicting electricity prices based on Stacking ensemble learning, comprising:

[0030] A data acquisition unit, which acquires electricity price data from the electricity market and processes it to obtain a data set of the relationship between electricity price and various influencing factors;

[0031] An initial electricity price prediction unit, used to use the data set as sample data, and input a first-layer prediction model based on Stacking ensemble learning composed of a random forest model and a gradient boosting decision tree, and output an initial electricity price prediction result;

[0032] The final electricity price prediction unit is used to input the initial electricity price prediction result into the SVM model in the second-layer prediction model based on Stacking ensemble learning, and obtain the final electricity price prediction result through the optimization operation of the SVM model.

[0033] A computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute the aforementioned electricity price prediction method based on Stacking ensemble learning.

[0034] A processor is used to run a program, wherein the program executes the aforementioned electricity price prediction method based on Stacking ensemble learning when running.

[0035] Compared with the prior art, the present invention has the following beneficial effects:

[0036] The electricity price prediction method based on Stacking ensemble learning of the present invention obtains the electricity price data of the electricity market, and processes it to obtain a data set of the relationship between the electricity price and various influencing factors; the data set is used as sample data, and input into the first-layer prediction model based on Stacking ensemble learning composed of a random forest model and a gradient boosting decision tree, and the initial electricity price prediction result is output; the initial electricity price prediction result is input into the SVM model in the second-layer prediction model based on Stacking ensemble learning, and the final electricity price prediction result is obtained through the optimization operation of the SVM model. The present invention combines two different base learners, the random forest model and the gradient boosting decision tree, through Stacking ensemble learning. Random forest has good anti-overfitting ability and robustness to noise, and can learn data from different angles; the gradient boosting decision tree can effectively handle complex nonlinear relationships and improve the prediction accuracy through continuous iterative optimization. By combining the advantages of different models, the prediction accuracy of electricity prices is improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following is a brief introduction to the drawings required for the specific embodiments or the description of the prior art. In all the drawings, similar elements or parts are generally identified by similar reference numerals. In the drawings, the elements or parts are not necessarily drawn according to the actual scale.

[0038] Figure 1 This is a flow chart of an electricity price prediction method based on Stacking ensemble learning of the present invention.

[0039] Figure 2 This is a flow chart of an embodiment of an electricity price prediction method based on Stacking ensemble learning of the present invention.

[0040] Figure 3 This is a flow chart of another embodiment of an electricity price prediction method based on Stacking ensemble learning of the present invention.

[0041] Figure 4 This is a schematic diagram of an electricity price prediction system based on Stacking ensemble learning according to the present invention. DETAILED DESCRIPTION

[0042] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0043] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.

[0044] It should also be understood that the terms used in the present specification are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the present specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0045] It should be further understood that the term "and / or" used in the present description and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0046] See the following examples Figures 1 to 4 .

[0047] The present application embodiment provides an electricity price prediction method based on Stacking ensemble learning, including:

[0048] Step S01, obtaining electricity price data of the electricity market, and processing to obtain a data set of the relationship between electricity price and various influencing factors;

[0049] By collecting electricity price data from the power market, we sort out the influencing factors such as crude oil price, coal price, natural gas price, carbon price, etc., obtain the original data, and clean the obtained original data to obtain the data set D = {X1, X2, ... Xn, Y};

[0050] Specifically, the electricity price data of the electricity market is obtained, and the data set of the relationship between the electricity price and various influencing factors is obtained by processing, including:

[0051] Obtain the average price of various resource price factors that affect electricity prices within multiple identical preset periods to obtain a sequence of data points for various resource prices;

[0052] "X1, X2..." represents the data of various influencing factors, such as crude oil price, coal price, natural gas price, carbon price and other data point sequences of different influencing factors at different time points or states.

[0053] According to the relationship between the data point sequence of various resource prices and the electricity price in the power market, a data set of the relationship between the electricity price Y and various resource price factors (X1, X2...Xn) is obtained.

[0054] “Y” represents electricity price data from the electricity market.

[0055] The set D as a whole combines different variable data together to form a data set for analyzing the relationship between electricity market prices and various influencing factors, so as to carry out subsequent data processing, analysis and modeling.

[0056] Step S02: using the data set as sample data, and inputting a first-layer prediction model based on Stacking ensemble learning composed of a random forest model and a gradient boosting decision tree, and outputting an initial electricity price prediction result;

[0057] Stacking is a combination of several machine learning methods. It is essentially a hierarchical structure that generates a series of base learners and then uses a certain strategy to combine the learners. Therefore, in order to obtain a Stacking ensemble learning prediction model with excellent performance, it is necessary to select appropriate base learners and meta learners. In this embodiment, two common regression algorithms based on decision tree models, random forest (RF) and gradient boosting decision tree (GBDT), are selected as the first layer of base learners.

[0058] Step S03: input the initial electricity price prediction result into the SVM model in the second-layer prediction model based on Stacking ensemble learning, and obtain the final electricity price prediction result through the optimization operation of the SVM model.

[0059] The second layer of ensemble learning should select a model with strong generalization ability, which can summarize and correct the bias of the first layer of multiple base learners for the training model, and further improve the prediction performance by making a secondary prediction on the data generated by the first layer base model. In this embodiment, a support vector machine (SVM) is selected as the second layer prediction model.

[0060] The present invention discloses a method for predicting electricity prices based on Stacking ensemble learning. The method combines two different base learners, namely, a random forest model and a gradient boosting decision tree, through Stacking ensemble learning. Random forest has good anti-overfitting ability and robustness to noise, and can learn data from different angles; the gradient boosting decision tree can effectively handle complex nonlinear relationships and improve prediction accuracy through continuous iterative optimization. By combining the advantages of different models, the prediction accuracy of electricity prices is improved. At the same time, by obtaining electricity price data from the power market and processing a data set of the relationship between electricity prices and various influencing factors (such as crude oil prices, coal prices, natural gas prices, carbon prices, etc.), the complex relationship between electricity prices and different factors can be better captured, and the reliability of prediction can be improved. The Stacking ensemble learning method can effectively process high-dimensional, nonlinear data. In the power market, electricity price data is often affected by many factors, and the data is complex and diverse. The method of the present invention can better adapt to such complex data characteristics and dig out potential patterns and laws in the data.

[0061] Specifically, in a preferred implementation of the present application, the data set is used as sample data, and a first-layer prediction model based on Stacking ensemble learning composed of a random forest model and a gradient boosting decision tree is input, and the output of the initial electricity price prediction result includes:

[0062] 1) Random forest model construction: After the data set is input into the random forest model as sample data, a voting decision is made through the decision tree classifier of the random forest model to output the first electricity price prediction result;

[0063] Random forest is an extended variant of bagging, which consists of a set of decision tree classifiers. Here, K represents the number of decision trees in the random forest, θ k Represents a random vector that obeys independent and identical distribution. Given an independent variable, the characteristic data of the sample data X1, X2, ..., X n After the input, the decision tree classifier can decide by voting, and finally adopt the strategy with more votes as the final method for the test data, and decide and output its prediction result Y1.

[0064] 2) Gradient boosting decision tree construction: After the data set is input as sample data into the gradient boosting decision tree, the gradient boosting decision tree is used to perform iterative calculations using the CART regression tree to output the second electricity price prediction result;

[0065] GBDT is an additive model composed of M trees. The base learner used is the decision tree, and the CART regression tree is used.

[0066] Specifically, after the data set is input as sample data into the gradient boosting decision tree, the gradient boosting decision tree is used to perform iterative calculation using the CART regression tree, and the output of the second electricity price prediction result includes:

[0067] Step S21, after the sample data is input into the random forest model, the constant value that minimizes the loss function is calculated by the CART regression tree, and the constant value is used as the initial prediction value of the weak learner;

[0068] Initialize the weak learner and estimate the constant value that minimizes the loss function as follows:

[0069]

[0070] In the formula, m = 1, 2, ..., M trees are iteratively trained; for each sample i = 1, 2, ..., N (N represents the number of samples); y i represents the true value of the i-th sample; L(y i ,γ) represents the loss function, which measures the difference between the predicted value γ and the true value y i The goal is to find a γ that minimizes the loss function. The meaning of the whole formula is to find a constant value, which will be used as the initial weak learner prediction value, so that the sum of the loss functions of all samples is minimized, thereby determining the initial weak learner f o (x).

[0071] Step S22, calculating the residual of the loss function according to the initial prediction value and the sample data;

[0072] Calculate the value of the negative gradient of the loss function in the current model, that is, the residual, and the formula is as follows:

[0073]

[0074] In the formula, x i represents the i-th sample; f(x i ) indicates that the current model is i The predicted value when L(y i ,f(x i )) is the loss function, which measures the predicted value f(x i ) and the true value y i The difference between m-1 It is the model obtained in the previous iteration.

[0075] By calculating the negative gradient (residual) of the loss function to the current model prediction value, the residual of the i-th sample in the m-th iteration is obtained. This residual will be used as the target for building a new tree in the next iteration to gradually improve the prediction performance of the model.

[0076] Step S23, using the sample data and the residual of the previous step as the training data of the next lesson tree to obtain a new regression tree;

[0077] The residual r obtained in step S22 is im As the new true value of the sample, and the data (x i ,rim), i=1, 2, ...N as the training data for the next tree, and a new regression tree f is obtained. m (x), the corresponding leaf node area is R jm j=1,2,...,J m . Where j is the number of leaf nodes in the regression tree. Calculate the best fitting value γ for the leaf region j=1,2,...,J jm , the specific formula is as follows:

[0078]

[0079] In the formula, γ is a parameter to be determined, and the loss function is minimized by optimizing this parameter; f m-1 (x i ) indicates that the model obtained in the previous iteration is i The predicted value when L(y i ,f m-1 (x i )+γ) is the loss function, which measures the predicted value f m-1 (x i )+γ and the true value y i The difference between.

[0080] γ jm The loss function can be minimized to update the prediction results of the model and gradually improve the accuracy of the model. jm YesR jm The new regression tree is constructed to better fit the residuals. The residuals are used as the basis for determining the leaf node area of ​​the new tree and calculating the best fit value. By continuously adjusting the structure of the new tree and the values ​​of the leaf nodes, the new tree can more accurately predict the residuals, thereby reducing the overall loss function.

[0081] Step S24, repeat the above steps according to a preset number of iterations to obtain a strong learner consisting of a corresponding number of trees, and obtain a second electricity price prediction result by weighted summing the prediction results of each tree.

[0082] Update the strong learner, I is the indicator function, if x∈R jm Then I=1, otherwise I=0, and the calculation formula is as follows:

[0083]

[0084] After inputting the characteristic data X1, X2, ..., Xn into the above formula, the second electricity price prediction result Y2 is calculated.

[0085] In this embodiment, in each iteration, the prediction results of the new tree are added to the current strong learner by updating the strong learner. The updating method is to perform a weighted summation of the prediction results of the previous round of strong learner and the new tree.

[0086] is the strong learner of the previous round, and is the prediction result of the new regression tree. By continuously updating the strong learner, the model gradually approaches the optimal solution. As the iteration proceeds, each new tree strives to correct the errors of the previous round of models, making the overall prediction results better and better. Finally, after M iterations, a strong learner composed of M trees is obtained, which can accurately predict new samples.

[0087] In summary, initializing the weak learner provides the starting point for the whole process. Iterative training of M trees gradually optimizes the model by continuously fitting the residuals. Updating the strong learner integrates the improvement results of each round together, thus achieving a gradual improvement of the model.

[0088] An initial electricity price prediction result based on the output of the first layer prediction model of Stacking ensemble learning is obtained according to the first electricity price prediction result and the second electricity price prediction result.

[0089] Specifically, in a preferred embodiment of the present application, the initial electricity price prediction result is input into the SVM model in the second-layer prediction model based on Stacking ensemble learning, and the final electricity price prediction result is obtained through the optimization operation of the SVM model, including:

[0090] Step S31, inputting the data set as sample data into the SVM model for training, and using the Bayesian optimization algorithm to adjust parameters to obtain a trained SVM model based on Bayesian optimization;

[0091] Assume that the training data set T = {(x1,y1),(x2,y2),…,(x t ,y t )} is composed of t training samples x i Composition, where x i ∈R d is the feature vector of the sample, i∈1,2,...,t, x i The corresponding category label is y i ∈{-1,+1}, the optimal hyperplane is defined as f(x)=w T x+b

[0092] SVM introduces the concept of Gaussian kernel function, maps the original low-dimensional sample space to the high-dimensional feature space, and uses nonlinear transformation to achieve linear separability of samples. Its mathematical function expression is as follows:

[0093]

[0094] Where exp is the natural exponential function; ‖xx i ‖ 2 Represents sample points x and x i σ is the square of the Euclidean distance between them; σ is the width parameter of the kernel function, which controls the range of the Gaussian kernel function. A larger σ value will make the kernel function have a wider range and reduce the sensitivity to the differences between sample points; a smaller σ value will make the kernel function have a narrower range and be more sensitive to the differences between sample points.

[0095] The SVM objective optimization function is as follows:

[0096]

[0097] w represents the weight vector, which is used to determine the direction of the hyperplane in the high-dimensional feature space;

[0098] C represents a parameter that controls the trade-off between the boundary and the relaxation penalty. A larger C value means that more emphasis is placed on the penalty for misclassified samples, making the model more inclined to find a hyperplane that can correctly classify all samples, which may lead to overfitting. A smaller C value means that the penalty for misclassified samples is lighter, and more emphasis is placed on finding a hyperplane with a larger interval, which may lead to underfitting.

[0099] ξ i Represents a slack variable, which allows a certain degree of misclassification when a sample point cannot be correctly classified. i Indicates the degree of misclassification of the i-th sample point;

[0100] b represents the bias term, which is used to determine the relative position of the hyperplane and the origin;

[0101] s·t· represents the constraint condition, that is, the following conditions are met;

[0102] y i (w T K(x i ,x j )+b)≥1-ξ i Represents a constraint condition, requiring that the sample point can be correctly classified or within a certain degree of misclassification in the high-dimensional feature space. If the sample point can be correctly classified, then y i (w T K(x i ,x j)+b) is greater than or equal to 1; if the sample point cannot be correctly classified, then by introducing the relaxation variable ξ i , so that the value is greater than or equal to 1-ξ i .

[0103] In order to solve the above SVM optimization problem, the Lagrangian function is introduced to transform the above optimization problem into the following dual optimization problem:

[0104]

[0105] Among them, α i ≥0 is the Lagrange multiplier, which is used to transform the original problem into a dual problem for solution. i Corresponding to different sample points, by adjusting α i The value of is used to find the optimal solution;

[0106] t represents the number of samples;

[0107] K(x i ,x j ) represents the kernel function, which is used to transform two sample points x in the original low-dimensional sample space i and x j The inner product after mapping to a high-dimensional feature space.

[0108] After solving the above problem, we get the corresponding decision function:

[0109]

[0110] Among them, sgn is the sign function, which returns +1 when the value in the brackets is greater than 0 and returns -1 when it is less than 0;

[0111] Represents the linear combination of the new sample point x and the training sample point in the high-dimensional feature space. i Lagrange multiplier, y i is the class label of the sample, x i are training sample points.

[0112] In this embodiment, the goal of the global optimization algorithm is to find the global optimal solution or a sufficiently good solution by exploring the entire solution space. Bayesian optimization is selected.

[0113] A set of parameters is randomly selected, the training data set is substituted into the model for training, and the parameters are adjusted using the Bayesian optimization algorithm. The trained SVM model based on Bayesian optimization includes:

[0114] By using the tree structure probability density estimation as a probability proxy model, the corresponding model loss function is constructed, which is expressed as:

[0115]

[0116] Among them, p(c|q) is the conditional probability that the hyperparameter is c when the model loss function is q, that is, the posterior probability. First, a loss function threshold c is selected based on the existing data. * ; Then, for data greater than the threshold and less than the threshold, two probability density estimates t(c) and u(c) are learned respectively.

[0117] The expected improvement is used as the sampling function to estimate the probability density and construct the sampling function, which is expressed as:

[0118]

[0119] Where: q * =min{(c1,f(c1)),...,(c1,f(c1))}; p(c) is the prior probability of c; p(q|c) is the likelihood probability of c.

[0120] Simplifying the sampling function and calculating new hyperparameter values ​​under preset conditions;

[0121] Construct α=p(q<q * ) and p(c) = ∫ R p(cq)p(q)dq=αt(c)+(1-α)u(c) simplifies EI. When u(c) / t(c) is minimized, a new hyperparameter value c is obtained.

[0122] Step S32: input the initial electricity price prediction result into the trained SVM model based on Bayesian optimization to obtain the final electricity price prediction result.

[0123] Substitute the new hyperparameter value c into the SVM model again, fit t(c) and u(c) again, and select the hyperparameter value corresponding to the maximum EI value until the iteration ends. In this embodiment, the number of iterations is set to 50, and finally select R in the SVM in 50 iterations. 2 The highest parameter combination is used to obtain the trained SVM model based on Bayesian optimization. The results of Y1 and Y2 are input into the trained SVM model based on Bayesian optimization to obtain the final prediction result Y3.

[0124] In this embodiment, parameter adjustment is performed by using a Bayesian optimization algorithm: by finely adjusting the parameters of the SVM model using a Bayesian optimization algorithm, a better combination of parameters can be found, so that the model can better adapt to the characteristics of the electricity price data, thereby improving the accuracy of electricity price prediction. At the same time, Bayesian optimization is a global optimization algorithm that finds the global optimal solution or a sufficiently good solution. Compared with traditional parameter adjustment methods, it is more likely to find parameter settings that optimize the performance of the SVM model. Through multiple iterations, the probability density estimate is continuously refitted and the hyperparameter value corresponding to the maximum EI value is selected, so that the model gradually converges to a more optimal state, and the highest parameter combination in the SVM model is selected to ensure that the final model has good fitting ability and prediction performance, thereby improving the accuracy of electricity price prediction.

[0125] In order to verify the practicality of the electricity price prediction method based on Stacking ensemble learning proposed in this application, a case analysis was conducted by collecting price data of a local electricity market. In order to evaluate the prediction performance of the model, this method selects Mean Absolute Error (MAE), Mean Squared Error (MSE), Root Mean Square Error (RMSE), and Mean Absolute Percentage Error (MAPE) as evaluation indicators, and the calculation formula is as follows:

[0126]

[0127]

[0128] Among them, y i represents the true value, Represents the predicted value of the true value, i = 1, 2, ..., n, n is the number of samples. The result analysis is shown in Table 1. As can be seen from Table 1, the model average absolute percentile error of the electricity price prediction method based on Stacking ensemble learning proposed in this application is the smallest, so the method of this application can improve the calculation accuracy, thereby improving the accuracy of electricity price prediction, and the electricity price prediction method proposed in this application has a good application prospect.

[0129] Table 1 Comparison of model results

[0130] Evaluation indicators The present application embodiment method RF GBDT SVM MAE 12.21 25.24 29.53 42.85 RMSE 21.53 38.52 43.97 58.52 MAPE 14.15% 28.41% 32.75% 46.14%

[0131] The embodiment of the present application further provides an electricity price prediction system based on Stacking ensemble learning, which is applied to the aforementioned electricity price prediction method based on Stacking ensemble learning, including:

[0132] A data acquisition unit, which acquires electricity price data from the electricity market and processes it to obtain a data set of the relationship between electricity price and various influencing factors;

[0133] An initial electricity price prediction unit, used to use the data set as sample data, and input a first-layer prediction model based on Stacking ensemble learning composed of a random forest model and a gradient boosting decision tree, and output an initial electricity price prediction result;

[0134] The final electricity price prediction unit is used to input the initial electricity price prediction result into the SVM model in the second-layer prediction model based on Stacking ensemble learning, and obtain the final electricity price prediction result through the optimization operation of the SVM model.

[0135] The functions of each unit of the electricity price prediction system based on Stacking ensemble learning in this embodiment are the same as those in an embodiment of an electricity price prediction method based on Stacking ensemble learning, and the technical effects are also the same, so they will not be repeated here.

[0136] An embodiment of the present application also provides a computer-readable storage medium, which includes a stored program, wherein when the program is running, the device where the computer-readable storage medium is located is controlled to execute the aforementioned electricity price prediction method based on Stacking ensemble learning.

[0137] The technical effect of this embodiment is the same as the technical effect of an electricity price prediction method based on Stacking ensemble learning, and will not be repeated here.

[0138] The present invention can be used in many general or special computer system environments or configurations, such as personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, and the like.

[0139] An embodiment of the present application further provides a processor, which is used to run a program, wherein the program executes the aforementioned electricity price prediction method based on Stacking ensemble learning when running.

[0140] The technical effect of this embodiment is the same as the technical effect of an electricity price prediction method based on Stacking ensemble learning, and will not be repeated here.

[0141] The processor in this embodiment may be a central processing unit (CPU), a controller, a microcontroller, or other data processing chips.

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

[0143] In the embodiments provided by the present invention, it should be understood that the division of units is only a logical function division, and there may be other division methods in actual implementation, for example, multiple units can be combined into one unit, one unit can be split into multiple units, or some features can be ignored, etc.

[0144] In addition, each functional unit in each embodiment of the present invention 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.

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

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

Claims

1. A method for predicting electricity prices based on Stacking ensemble learning, characterized in that: include: Obtain electricity price data from the power market and process it to obtain a data set showing the relationship between electricity prices and various influencing factors; The data set is used as sample data, and is input into a first-layer prediction model based on Stacking ensemble learning composed of a random forest model and a gradient boosting decision tree, and an initial electricity price prediction result is output; The initial electricity price prediction result is input into the SVM model in the second-layer prediction model based on Stacking ensemble learning, and the final electricity price prediction result is obtained through the optimization operation of the SVM model.

2. According to claim 1, a method for predicting electricity prices based on Stacking ensemble learning is characterized in that: The data set of obtaining the electricity price data of the electricity market and processing to obtain the relationship between the electricity price and various influencing factors includes: Obtain the average price of various resource price factors that affect electricity prices within multiple identical preset periods to obtain a sequence of data points for various resource prices; According to the relationship between the data point sequence of various resource prices and the electricity price in the power market, a data set of the relationship between the electricity price and various resource price factors is obtained.

3. The method for predicting electricity prices based on Stacking ensemble learning according to claim 2, characterized in that: The data set is used as sample data, and input into the first-layer prediction model based on Stacking ensemble learning composed of random forest model and gradient boosting decision tree, and the output of the initial electricity price prediction results includes: After the data set is input as sample data into the random forest model, a decision tree classifier of the random forest model is used to make a voting decision and output a first electricity price prediction result; After the data set is input as sample data into the gradient boosting decision tree, the gradient boosting decision tree is used to perform iterative calculation using the CART regression tree to output a second electricity price prediction result; An initial electricity price prediction result based on the output of the first layer prediction model of Stacking ensemble learning is obtained according to the first electricity price prediction result and the second electricity price prediction result.

4. The method for predicting electricity prices based on Stacking ensemble learning according to claim 3, characterized in that: After the data set is input as sample data into the gradient boosting decision tree, the gradient boosting decision tree is used to perform iterative calculation using the CART regression tree, and the second electricity price prediction result is output, including: After the sample data is input into the random forest model, the constant value that minimizes the loss function is calculated through the CART regression tree, and the constant value is used as the initial prediction value of the weak learner; Calculating the residual of the loss function according to the initial prediction value and the sample data; The sample data and the residual of the previous step are used as the training data of the next lesson tree to obtain a new regression tree; and the above steps are repeated according to the preset number of iterations to obtain a strong learner composed of corresponding trees, and the second electricity price prediction result is obtained by weighted summing the prediction results of each tree.

5. The electricity price prediction method based on Stacking ensemble learning according to claim 3 is characterized in that: The inputting of the initial electricity price prediction result into the SVM model in the second-layer prediction model based on Stacking ensemble learning, and obtaining the final electricity price prediction result through the optimization operation of the SVM model includes: Input the data set as sample data into the SVM model for training, and use the Bayesian optimization algorithm to adjust parameters to obtain a trained SVM model based on Bayesian optimization; The initial electricity price prediction result is input into the trained SVM model based on Bayesian optimization to obtain the final electricity price prediction result.

6. The method for predicting electricity prices based on Stacking ensemble learning according to claim 5, characterized in that: The Bayesian optimization algorithm is used to adjust parameters to obtain a trained SVM model based on Bayesian optimization, including: Use the tree structure probability density estimation as a probability proxy model to construct the corresponding model loss function; Construct sampling function by using expected improvement as sampling function to estimate probability density; Simplifying the sampling function and calculating new hyperparameter values ​​under preset conditions; Substitute the new hyperparameter value into the SVM model, fit and again, select the hyperparameter value corresponding to the maximum value of the sampling function, and obtain the trained SVM model based on Bayesian optimization.

7. An electricity price prediction system based on Stacking ensemble learning, characterized in that: A method for predicting electricity prices based on Stacking ensemble learning applied to any one of claims 1 to 6, comprising: A data acquisition unit, which acquires electricity price data from the electricity market and processes it to obtain a data set of the relationship between electricity price and various influencing factors; An initial electricity price prediction unit, used to use the data set as sample data, and input a first-layer prediction model based on Stacking ensemble learning composed of a random forest model and a gradient boosting decision tree, and output an initial electricity price prediction result; The final electricity price prediction unit is used to input the initial electricity price prediction result into the SVM model in the second-layer prediction model based on Stacking ensemble learning, and obtain the final electricity price prediction result through the optimization operation of the SVM model.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute the electricity price prediction method based on Stacking ensemble learning as described in any one of claims 1 to 6.

9. A processor, characterized in that: The processor is used to run a program, wherein when the program is run, the method for predicting electricity prices based on Stacking ensemble learning described in any one of claims 1 to 6 is executed.

Citation Information

Cited By

  • Data prediction method and device based on multi-angle model complementary integration

    CN120807018A