A method for electricity price prediction based on weighted K nearest neighbor and Gaussian process regression
Through the electricity price prediction method based on weighted K nearest neighbor and Gaussian process regression, combined with multiple operating indicators, the problems of electricity price fluctuation complexity and spike randomness are solved, and more accurate electricity price spike detection and prediction are achieved, simplifying the electricity price prediction process .
Patent Information
- Application Number
- CN202210506161.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-10
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2042-05-10
AI Technical Summary
The fluctuation complexity and spike randomness of electricity prices make it difficult for the existing technology to accurately predict electricity prices, affecting the grid scheduling and user electricity rationality.
Using the electricity price prediction method based on weighted K nearest neighbor (WKNN) and Gaussian process regression (GPR), the electricity price peak detection and prediction are performed by extracting multiple operating indicators related to electricity price spikes, and using WKNN classifier and GPR to detect and predict electricity price spikes, combined with the index core Functions improve prediction accuracy.
More accurate electricity price spike detection and future electricity price prediction are achieved, reducing prediction errors, simplifying the prediction process, and improving the accuracy of electricity price prediction.
Smart Images

Figure CN114782111B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of electric power systems, and in particular to an electricity price prediction method based on weighted K nearest neighbors and Gaussian process regression. Background Art
[0002] The fluctuation of electricity prices depends on the combined effect of many subjective and objective factors, and its evolution process has complex randomness. In addition, the random occurrence of electricity price spikes brings great challenges to the prediction of electricity prices, because in this case, the change of electricity prices does not follow normal rules, which brings more difficulties to the accurate prediction of electricity prices. Accurately predicting electricity prices is conducive to the grid dispatching agency to reasonably arrange the start and stop plan of the unit and the purchase and sale plan of electricity, which is conducive to the stable operation of the grid and the reasonable use of electricity by users. Therefore, accurately predicting the arrival of electricity price spikes is of great significance to electricity price prediction, and it is necessary to propose an electricity price prediction algorithm with high accuracy. Summary of the invention
[0003] Based on this, the present invention proposes an electricity price prediction method based on weighted K nearest neighbors and Gaussian process regression.
[0004] A method for predicting electricity prices based on weighted K nearest neighbors and Gaussian process regression includes the following steps:
[0005] 1) Extracting operational indicators from statistical data;
[0006] 2) Use the weighted K nearest neighbor (WKNN) algorithm to predict future electricity price spikes;
[0007] 3) Use Gaussian process regression (GPR) to predict future electricity prices.
[0008] In the above technical solution, in step 1), the operating indicators are extracted from the statistical data:
[0009] Based on the information disclosed in the electricity market, several operating indicators related to the occurrence of electricity price spikes are proposed. The operating indicators can be divided into two categories, namely, the prior knowledge indicators related to the forecast days and the recorded historical indicators. The operating indicators of both power generation and consumption have a certain impact on the emergence of electricity prices. The selection ideas of operating indicators are summarized as follows: Considering the relationship between power supply and demand, the forecast load (h FL ) and planned total output (h FSG ) index. In order to consider the cost of power generation and spinning reserve, the maximum economic power generation capacity (h EC ) and maximum emergency generating capacity (h EM Considering the weather changes in different months and the daily electricity consumption behavior of users, the monthly (current month electricity price index, h M ) and time (current electricity price index, h T) indicator. In order to reflect the risk of power outage, the expected power generation interruption (h FGO ) indicator. In fact, the electricity price series contains several non-stationary characteristics such as trend, level and slope changes, seasonality, etc. It has an impact on the price signal, which should be considered. On the one hand, h M and h T It can partially characterize non-stationary characteristics and changes in trends and seasonality. On the other hand, the recorded historical indicators (i.e., h AL,d-7 ,h AL,d-1 ,h LG,d-7 ,h LG,d-1 ,h TL,d-7 ,h TL,d-1 ) can also provide periodic and actual information that helps detect price spikes. The values of the above indicators can be obtained from PJM's official online database (https: / / dataminer2.pjm.com / ).
[0010] It should be noted that extreme weather, transmission congestion, forced outage of generators or lines, tight reserve capacity, and high concentration of reserve capacity can all lead to peak electricity prices. Extreme weather and forced outage of generators or lines can be measured through the indicator h EM and h FGO Similarly, through h FSG and h EC Indicators can reflect transmission congestion, spare capacity constraints, etc.
[0011] Therefore, these operating indicators can be used as input data for the WKNN classifier. The features of the i-th price data can be represented by the indicator vector x i Expressed as
[0012]
[0013] In the above technical solution, in step 2), the weighted K nearest neighbor (WKNN) algorithm is used to predict future electricity price peaks, as follows:
[0014] WKNN classifier for price spikes f WKNN It can be expressed as
[0015]
[0016] In the formula, y new ∈{0,1} and x new are the labels and indicator vectors of the data points to be classified, N train is the number of training data. In fact, the WKNN method classifies samples (i.e., prices at different times) by measuring the distances between their several features (i.e., operating indicators related to price spikes).
[0017] The idea of the WKNN method to detect price spikes is:
[0018] The first step is to find the price data whose categories are unknown and the price data whose category labels are known (i.e., y i =0 or y i =1) position in the feature space.
[0019] The second step is to sequentially determine the distance between the unclassified price data and all other classified data.
[0020] The third step is to convert the classified points to the unclassified data points x new Sort the distances in ascending order, find the neighboring points of the unclassified data points, and get x new The K nearest neighbors of K .
[0021] The fourth step is to perform a weighted majority vote on the unclassified data points. The closer the price data is, the larger the weight is set, and vice versa. In WKNN, the weights w1, w2, …, w K is determined by the kernel function. Therefore, x new The class label of can be determined as
[0022]
[0023] Where I(·) is the indicator function. If θ = y i True, its value is equal to 1, if θ = y i If false, its value is equal to 0.
[0024] In the above technical solution, Gaussian process regression (GPR) is used in step 3) to predict future electricity prices, as follows:
[0025] Electricity price prediction can be expressed as a regression analysis problem, expressed as
[0026]
[0027] v i =(x i ,y i )
[0028] In the formula, z new ∈R is the predicted price, v new It is the input vector data, which is composed of the operation index and peak electricity price indicator factor obtained in the first two steps. train is the number of training data samples.
[0029] To measure the predicted price z newThe relationship between the Gaussian distribution and the exponential kernel function (i.e., covariance function) is introduced.
[0030]
[0031] In the formula, σ f is the maximum allowed covariance, σ l is the length parameter. Therefore, the kernel function matrices of the training data, test data, and the entire data set (including training data and test data) are expressed as
[0032]
[0033]
[0034]
[0035] In Gaussian processes (GPs), the generated data is distributed over the entire domain. Thus, any finite subset of the electricity price range follows a multivariate Gaussian distribution. Therefore, the observations in the electricity price dataset can always be viewed as samples of a multivariate Gaussian distribution, i.e.:
[0036]
[0037] Furthermore, given z new The conditional probability of follows a Gaussian distribution and can be derived as
[0038]
[0039] It can be seen that z new The mathematical meaning of |z is exactly the price prediction result of a given training set. The best estimate of the electricity price is the mean of the distribution, that is:
[0040]
[0041] In the formula, f GPR Represents an electricity price predictor based on Gaussian process regression.
[0042] The beneficial effects of the present invention are:
[0043] (1) Compared with previous studies, this paper proposes several new operating indicators and combines them with the WKNN-based method to detect the occurrence of electricity price spikes in advance. In addition, by considering the importance of data (i.e., weight) according to the characteristics of electricity price changes, electricity price spikes can be detected more accurately.
[0044] (2) Considering the characteristics of electricity price data, Gaussian process regression based on exponential kernel function is applied to electricity price forecasting for the first time. The example analysis also shows that the prediction error of this method is smaller than that of other price forecasting methods.
[0045] (3) The two-step electricity price prediction algorithm no longer requires separate predictions for normal and peak electricity prices. Whether a price spike will occur is already recorded as one of the input parameters and used together with the proposed operating indicators in the second step, thus simplifying the prediction process. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 An embodiment of an electricity price prediction method based on weighted K nearest neighbors and Gaussian process regression. DETAILED DESCRIPTION
[0047] In order to better understand the purpose, technical scheme and technical effect of the present invention, the present invention is further explained below in conjunction with the accompanying drawings.
[0048] refer to Figure 1 , Figure 1 The figure shows a method for predicting electricity prices based on weighted K nearest neighbors and Gaussian process regression, which includes the following steps:
[0049] S10, extracting operating indicators from statistical data; in one embodiment:
[0050] Based on the information disclosed in the electricity market, several operating indicators related to the occurrence of electricity price spikes are proposed. The operating indicators can be divided into two categories, namely, the prior knowledge indicators related to the forecast days and the recorded historical indicators. The operating indicators of both power generation and consumption have a certain impact on the emergence of electricity prices. The selection ideas of operating indicators are summarized as follows: Considering the relationship between power supply and demand, the forecast load (h FL ) and planned total output (h FSG ) index. In order to consider the cost of power generation and spinning reserve, the maximum economic power generation capacity (h EC ) and maximum emergency generating capacity (h EM Considering the weather changes in different months and the daily electricity consumption behavior of users, the monthly (current month electricity price index, h M ) and time (current electricity price index, h T ) indicator. In order to reflect the risk of power outage, the expected power generation interruption (h FGO ) indicator. In fact, the electricity price series contains several non-stationary characteristics such as trend, level and slope changes, seasonality, etc. It has an impact on the price signal, which should be considered. On the one hand, h M and h T It can partially characterize non-stationary characteristics and changes in trends and seasonality. On the other hand, the recorded historical indicators (i.e., h AL,d-7 ,h AL,d-1 ,h LG,d-7 ,h LG,d-1 ,h TL,d-7 ,h TL,d-1) can also provide periodic and actual information that helps detect price spikes. The values of the above indicators can be obtained from PJM's official online database (https: / / dataminer2.pjm.com / ).
[0051] It should be noted that extreme weather, transmission congestion, forced outage of generators or lines, tight reserve capacity, and high concentration of reserve capacity can all lead to peak electricity prices. Extreme weather and forced outage of generators or lines can be measured through the indicator h EM and h FGO Similarly, through h FSG and h EC Indicators can reflect transmission congestion, spare capacity constraints, etc.
[0052] Therefore, these operating indicators are used as input data for the WKNN classifier. The features of the i-th price data can be represented by the indicator vector x i Expressed as
[0053]
[0054] S20, using a power price peak prediction method based on weighted K nearest neighbors; in one embodiment:
[0055] WKNN classifier for price spikes f WKNN It can be expressed as
[0056]
[0057] In the formula, y new ∈{0,1} and x new are the labels and indicator vectors of the data points to be classified, N train is the number of training data. In fact, the WKNN method classifies samples (i.e., prices at different times) by measuring the distances between their several features (i.e., operating indicators related to price spikes).
[0058] The idea of the WKNN method to detect price spikes is:
[0059] The first step is to find the price data whose categories are unknown and the price data whose category labels are known (i.e., y i =0 or y i =1) position in the feature space.
[0060] The second step is to sequentially determine the distance between the unclassified price data and all other classified data.
[0061] The third step is to convert the classified points to the unclassified data points x newSort the distances in ascending order, find the neighboring points of the unclassified data points, and get x new The K nearest neighbors of K .
[0062] The fourth step is to perform a weighted majority vote on the unclassified data points. The closer the price data is, the larger the weight is set, and vice versa. In WKNN, the weights w1, w2, …, w K is determined by the kernel function. Therefore, x new The class label of can be determined as
[0063]
[0064] Where I(·) is the indicator function, which is equal to 1 if θ = y i True, equal to 0 if θ = y i is false.
[0065] S30, predicting future electricity prices using Gaussian process regression (GPR):
[0066] Electricity price prediction can be expressed as a regression analysis problem, expressed as
[0067]
[0068] v i =(x i ,y i )
[0069] In the formula, z new ∈R is the predicted price, v new It is the input vector data, which is composed of the operation index and peak electricity price indicator factor obtained in the first two steps. train is the number of training data samples.
[0070] To measure the predicted price z new The relationship between the Gaussian distribution and the exponential kernel function (i.e., covariance function) is introduced.
[0071]
[0072] In the formula, σ f is the maximum allowed covariance, σ l is the length parameter. Therefore, the kernel function matrices of training data, training combined with test data, and test data are expressed as
[0073]
[0074]
[0075]
[0076] In Gaussian processes (GPs), the generated data is distributed over the entire domain. Thus, any finite subset of the electricity price range follows a multivariate Gaussian distribution. Therefore, the observations in the electricity price dataset can always be viewed as samples from a multivariate Gaussian distribution, i.e.:
[0077]
[0078] Furthermore, given z new The conditional probability of follows a Gaussian distribution and can be derived as
[0079]
[0080] It can be seen that z new The mathematical meaning of |z is exactly the price prediction result of a given training set. The best estimate of the electricity price is the mean of the distribution, that is:
[0081]
[0082] Extract operational metrics from statistics.
Claims
1. A method for predicting electricity prices based on weighted K nearest neighbors and Gaussian process regression, characterized in that: The steps include: 1) Extracting operational indicators from statistical data; 2) Use the weighted K nearest neighbor (WKNN) algorithm to predict future electricity price spikes; 3) Use Gaussian process regression (GPR) to predict future electricity prices; In step 1): The operating index includes the predicted load index h FL 、Planned total output index h FSG 、Maximum economic power generation capacity index h EC 、Maximum emergency power generation capacity index h EM 、Electricity price index for the current month h M 、Current electricity price index h T 、Expected power generation interruption index h FGO , Actual load index one week ago h AL,d-7 、Actual load index one day ago h AL,d-1 、Total power generation capacity index one week ago h LG ,d-7 、Total power generation capacity index one day ago h LG,d-1 、Total network loss index one week ago h TL,d-7 and the total network loss index one day ago h TL,d-1 ; The feature of the i-th price data is the indicator vector x i express x i =(h i FL ,h i FSG ,h i EC ,h i EM ,h i M ,h i T ,h i FGO ,h AL,d-7 ,h AL,d-1 ,h LG,d-7 ,h LG,d-1 ,h TL,d-7 ,h TL,d-1 ); In step 2), the weighted K nearest neighbor (WKNN) algorithm is used to predict future electricity price peaks, as follows: WKNN classifier for price spikes f WKNN Expressed as y new =f WKNN [x new |(x1,y1),(x2,y2),...,(x Ntrain ,y Ntrain )] In the formula, y new ∈{0,1} and x new are the labels and indicator vectors of the data points to be classified, N train is the number of training data; The method of predicting electricity price spikes using the WKNN algorithm specifically includes the following steps: The first step is to find the location of the currently detected price data with unknown categories and the price data with known category labels detected in the past in the feature space; The second step is to sequentially determine the distance between the unclassified price data and all other classified data; The third step is to convert the classified points to the unclassified data points x new Sort the distances in ascending order, find the neighboring points of the unclassified data points, and get x new The K nearest neighbors of K ; The fourth step is to perform a weighted majority vote on the unclassified data points; the closer the price data is, the larger the weight is set, and vice versa; in WKNN, the weights w1, w2, …, w K is determined by the kernel function; therefore, x new The class label is determined as Where I(·) is the indicator function. If θ = y i True is equal to 1 if θ = y i If it is false, it is equal to 0; The step 3) is as follows: Electricity price prediction can be expressed as a regression analysis problem, expressed as v i (x) i ,and i ) In the formula, z new ∈R is the predicted price, v new It is the input vector data, which consists of operation index and peak electricity price indicator factor; N train is the number of training data samples; To measure the predicted price z new The relationship between the Gaussian distribution and the exponential kernel function In the formula, σ f is the maximum allowed covariance, σ l is the length parameter; the kernel function matrices of training data, test data, and full data set are respectively expressed as In Gaussian processes (GPs), the generated data all obey the multivariate Gaussian distribution; therefore, the electricity price data is: Furthermore, given z new The conditional probability of follows a Gaussian distribution and can be derived as The best estimate of the electricity price is the mean of the distribution, which is: In the formula, f GPR Represents an electricity price predictor based on Gaussian process regression.
Citation Information
Patent Citations
Facilitation of indoor localization and fingerprint updates of altered access point signals
CN108293238A
Rail transit short-term passenger flow prediction method and system and electronic equipment
CN110837903A