Spot electricity price prediction method and system based on similar day multi-dimensional matching and model fusion

By employing a method of multidimensional matching and model fusion for similar days, a multidimensional feature system and a Stacking architecture are constructed. This addresses the issues of poor feature adaptation and weak generalization ability in extreme scenarios in existing spot electricity price forecasting technologies, thereby achieving highly reliable electricity price forecasting results.

CN121921051APending Publication Date: 2026-04-24NARI NANJING CONTROL SYSTEM CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
NARI NANJING CONTROL SYSTEM CO LTD
Filing Date
2025-12-26
Publication Date
2026-04-24

AI Technical Summary

Technical Problem

Existing spot electricity price forecasting technologies suffer from incomplete feature systems, poor regional adaptability, and weak generalization ability in extreme scenarios, making it difficult to meet the electricity market's requirements for highly reliable forecasts.

Method used

A method combining multidimensional matching and model fusion of similar days is adopted. By constructing a historical database, utilizing a multidimensional feature system and multi-indicator similarity calculation, and combining a Stacking architecture of basic model layer and meta-model layer, electricity price prediction is performed, and the prediction results are dynamically weighted and optimized.

Benefits of technology

It improves the accuracy and robustness of spot electricity price forecasts, reduces errors in extreme scenarios, and enhances the reliability and adaptability of forecasts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121921051A_ABST
    Figure CN121921051A_ABST
Patent Text Reader

Abstract

The invention discloses a spot electricity price prediction method and system based on similar day multi-dimensional matching and model fusion. The method comprises the steps of obtaining historical supply and demand type, time sequence type and region type data and electricity price data to construct a unified database; related data is extracted, missing value complementation is performed, and prediction day features are constructed in a standardized manner; calculating and screening an optimal similar day by adopting multi-dimensional features and multi-index similarity, and extracting an actual electricity price of the similar day as a basic prediction result; outputting the clearing electricity price simulated by the model as an auxiliary prediction result through a fusion framework of a basic model and a meta model; dynamically weighting the two types of prediction results based on a historical error rate to generate a final prediction result; and finally, business rule correction and storage are carried out on the result. According to the method, historical experience of similar days and the precise fitting advantage of the intelligent model can be integrated, the method is suitable for various areas and scenes, and the accuracy and stability of spot electricity price prediction are kept in a high-fluctuation and strong-nonlinearity electricity market environment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of electricity market price forecasting technology, specifically relating to a spot electricity price forecasting method and system based on similar day multidimensional matching and model fusion. Background Technology

[0002] With the deepening of electricity market reform, the spot market, as the core link in electricity market transactions, directly impacts the trading decisions of market participants and the safe and economical operation of the power grid through the accuracy of its price signals. Spot electricity prices are characterized by high volatility, strong nonlinearity, multi-period coupling, and multi-factor driving forces, making accurate prediction of them crucial.

[0003] Existing spot electricity price forecasting technologies mainly fall into two categories: One is the similar-day algorithm, which finds historical dates with similar characteristics to the predicted date and uses the actual electricity price on that similar day as the prediction result. Its advantages include strong interpretability and no need for complex training, but it suffers from drawbacks such as incomplete feature systems, simplistic similarity calculations, and insufficient regional scenario adaptability. It also fails to consider regional power structure differences, making it prone to misjudging similar days. The other category is the simulated clearing algorithm, which builds a model based on the physical laws of supply and demand, learning the mapping relationship between "supply and demand indicators and clearing prices." Its advantage is that it aligns with market clearing logic, but it suffers from strong dependence on historical data, weak generalization ability in extreme scenarios, poor adaptability to extreme situations, and a tendency for prediction deviations to exceed thresholds. It cannot balance interpretability and accuracy, making it difficult to meet the high reliability requirements of the electricity market for forecast results.

[0004] Therefore, there is an urgent need for a high-precision spot electricity price forecasting method that can integrate the historical experience of similar day algorithms with the data fitting advantages of simulated clearing algorithms and adapt to multiple regions and scenarios. Summary of the Invention

[0005] Purpose of the Invention: The purpose of this invention is to overcome the shortcomings of existing technologies and provide a spot electricity price forecasting method and system based on multidimensional matching of similar days and model fusion. It leverages both the historical experience advantages of similar day algorithms and the precise fitting capabilities of model fusion to achieve highly reliable spot electricity price forecasting.

[0006] Technical solution:

[0007] This invention proposes a spot electricity price forecasting method based on multidimensional matching of similar days and model fusion, comprising:

[0008] Historical core feature data and electricity price data are obtained. After preprocessing, the historical core features are correlated with electricity price data through timestamps, regions, and electricity prices to obtain historical daily features. Build a historical database;

[0009] The system sets prediction parameters, including the prediction region, prediction scenario, prediction date, and prediction granularity. Supply and demand data are acquired according to these parameters, and the predicted daily characteristics are obtained after preprocessing. ;

[0010] calculate With each of the historical databases Similarity and distance metrics are used between them. For each metric, the K historical days corresponding to the Top K values ​​of the metric are selected as candidate similar days for that metric. The candidate similar days of all metrics are recorded to form a candidate sample set.

[0011] The frequency of each candidate similar day in the candidate sample set is counted, and the candidate similar days are ranked by weight to obtain a final similar day. The electricity price of the final similar day is then extracted. ;

[0012] A fusion architecture comprising a base model layer and a meta-model is constructed. A model based on this fusion architecture is trained using a historical database to obtain an electricity price prediction model. Input the electricity price prediction model to obtain the clearing electricity price prediction result for the prediction date. ;

[0013] Based on historical error rate and Dynamic weighting is applied, and the final predicted electricity price for each time point on the prediction day is obtained by weighting according to the weights.

[0014] Furthermore, the historical core feature data includes feature name, feature value, and timestamp, and the electricity price data includes day-ahead electricity price and real-time electricity price;

[0015] The feature names include: supply and demand features: bidding space, centrally dispatched load, photovoltaic output, wind power output, interconnection line plan, gas turbine output, and units that must be started / stopped; time-series features: date type, seasonal label, and meteorological data; and regional features: power generation capacity distribution and power structure proportion.

[0016] Furthermore, the preprocessing includes:

[0017] We prioritize filling with feature values ​​from the same time point the previous day; when there are missing values ​​at three or more consecutive time points, we use linear interpolation to fill them in.

[0018] An improved Z-score method is used to identify outliers. The median absolute deviation (MAD) of all feature values ​​is calculated. When the absolute value of the difference between a feature and the median is greater than 3 × MAD, it is judged as an outlier. The mean of the adjacent time points before and after the feature is used to repair it.

[0019] Continuous features are normalized using Min-Max, while discrete features are encoded using one-hot encoding.

[0020] Furthermore, the similarity index includes cosine similarity. The distance metrics include Pearson correlation coefficient, Spearman correlation coefficient, and standardized Nash efficiency (NNSE); the distance metrics include mean absolute error (MAE), root mean square error (RMSE), mean absolute percentage error (MAPE), symmetric mean absolute percentage error (SMAPE), weighted mean absolute percentage error (MAAPE), mean absolute scale error (MASE), Wasserstein distance, and dynamic time warping (DTW).

[0021] Furthermore, the weighted ranking of candidate similar days includes:

[0022] The number of occurrences is used as the base score for the candidate similar day. If the regional or temporal features of the historical day feature match the predicted region or predicted scenario of the predicted day feature, the base score is increased by weight. If the difference between the date of the historical day feature and the predicted date of the predicted day feature exceeds one year, the base score is decreased by weight.

[0023] Furthermore, the basic model layer includes a KR sub-model, a LightGBM sub-model, and an LSTM sub-model. The KR sub-model is used to capture the nonlinear mapping from indicators to electricity prices. It maps features to a high-dimensional space through a kernel function and then performs linear regression. The LightGBM sub-model is used to capture the linear mapping from indicators to electricity prices. It iteratively generates multiple decision trees through gradient boosting, and the output prediction result is a weighted sum of multiple trees. The LSTM sub-model is used to capture the time-series fluctuations in electricity prices.

[0024] Furthermore, the meta-model is an XGBoost model, used to nonlinearly fuse the outputs of the sub-models to output the final model prediction value. Its objective function Introducing a second-order Taylor expansion, the formula is as follows:

[0025]

[0026] in, The first derivative of the loss function. It is the second derivative of the loss function.

[0027] Furthermore, the pair based on historical error rate and Dynamic weighting includes:

[0028] Calculate similar day prediction results on the test set of the historical database. Compared with actual electricity price The MAPE is used to obtain the similarity day algorithm error rate. On the same test set, calculate the model prediction results. and The MAPE is used to obtain the model fusion error rate. ;

[0029] The weights are assigned based on the reciprocal of the error rate, using the following formula:

[0030]

[0031]

[0032] in, Weights for similar day results, The weights are the model result weights; if a certain historical error rate is 0, then the algorithm weight is set to 1.

[0033] Furthermore, the final electricity price at each point in time is obtained by weighting the quantities according to their respective weights, using the following formula:

[0034]

[0035] Where j is the time index, Let be the final predicted electricity price at time j.

[0036] The present invention also proposes a spot electricity price forecasting system based on similar day multidimensional matching and model fusion, including a memory, a processor and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of any of the aforementioned methods.

[0037] Beneficial effects:

[0038] This invention constructs a three-category feature system of "supply and demand core + time series and season + market environment", and adjusts the feature weights in combination with regional power structure differences to solve the problems of "feature one-sidedness and poor regional adaptation" in traditional similar day algorithms. This invention uses 12 multi-dimensional indicators, combined with frequency statistics and time decay correction, to avoid misjudgment of similar days caused by a single indicator. In extreme weather scenarios, similarity calculation is more accurate and the similar day matching error is reduced.

[0039] The Stacking architecture of this invention integrates the advantages of nonlinear fitting KR, feature interaction LightGBM, and temporal capture LSTM. The meta-model achieves nonlinear fusion of multiple results. Compared with a single model, the prediction MAPE is reduced and the generalization ability in extreme scenarios is significantly improved.

[0040] This invention assigns weights based on historical error rates, automatically balancing historical experience on similar days with the model's fitting accuracy. When historical data is abundant and scenarios are similar, the weight of similar days is increased; when data is insufficient or scenarios are novel, the model weight is increased, thus improving the robustness of the prediction results. Attached Figure Description

[0041] Figure 1 This is a flowchart of the method of the present invention;

[0042] Figure 2 This is a schematic diagram of the system of the present invention. Detailed Implementation

[0043] The present invention will be further explained below with reference to the accompanying drawings and specific embodiments.

[0044] Example 1

[0045] This invention provides a spot electricity price forecasting method based on multidimensional matching and model fusion of similar days, the specific process of which is as follows: Figure 1 As shown, it includes the following steps:

[0046] S1. Historical Data Initialization: Obtain historical core feature data and historical actual electricity price data to construct a unified historical database for similar day search and model training.

[0047] The historical actual electricity price data is obtained from the power trading platform, including day-ahead and real-time electricity prices; the historical core feature data is collected from the power trading platform, meteorological departments, and the Internet, specifically including:

[0048] (1) Supply and demand characteristics: bidding space, central dispatch load, photovoltaic output, wind power output, interconnection line plan, gas turbine output, and units that must be started or stopped;

[0049] (2) Time-series features: date type (weekday / holiday), season label (spring / summer / autumn / winter), high-precision meteorological data (temperature, wind speed, irradiance, cloud cover, precipitation);

[0050] (3) Regional characteristics: power generation capacity distribution and power structure ratio (new energy / thermal power ratio).

[0051] The above data was fitted at a granularity of 15 minutes, covering 96 time points per day, corresponding to point1 to point96. Point1 is from 00:00 to 00:15, and point96 is from 23:45 to 24:00. Data at 00:00 was assigned to 24:00 of the previous day to ensure the completeness of the 96 time points per day. The data collection time range covers at least two full years.

[0052] This example uses a province in eastern China to predict the day-ahead spot electricity price for January 11, 2025 (D+1) on January 10, 2025 (the implementation date). Historical data from January 1, 2022 to December 31, 2024 is obtained, including the region's bidding space, load, photovoltaic output, interconnection line exchange, and day-ahead electricity price.

[0053] The collected historical data undergoes preprocessing and standardization, specifically including the following steps:

[0054] (1) Missing value imputation: Features from the previous day at the same time are used first; for consecutive missing values, interpolation is used. The formula for linear interpolation is as follows for consecutive missing values ​​(≥3 time points):

[0055]

[0056] in, Let i be the feature value at the i-th missing time point. Let i be the timestamp of the i-th time point. , These are the known feature values ​​before and after the missing time points, respectively.

[0057] (2) Outlier handling: An improved Z-score method is used to identify outliers, and the median absolute deviation (MAD) of each feature value is calculated. The value is identified as an outlier using the following formula:

[0058]

[0059] in, is the median of the eigenvalues, and n is the total number of eigenvalues. The cause is determined by combining the market event database. Outliers confirmed as data errors are corrected using the average of adjacent time points; those confirmed as genuine market fluctuations (such as a sudden surge in electricity prices due to extreme weather) are retained as their original values.

[0060] For example, the abnormally low load on February 10, 2024 (Spring Festival) was identified as a holiday effect, and the original data was retained; data error correction, such as an abnormal surge in electricity price to 2,000 yuan / MWh (the average for the same period was 800 yuan / MWh), was investigated as data transmission packet loss, and adjacent time points were used for correction.

[0061] (3) Standardization: Min-Max standardization (mapped to the [0,1] interval) is applied to continuous features, as shown in the following formula:

[0062]

[0063] in, , These are the historical minimum and maximum values ​​of the feature, respectively; one-hot encoding is used for discrete features, which include date type (weekday / holiday) and season (winter / spring / summer / autumn).

[0064] The preprocessed feature data and electricity price data are linked by timestamps and region IDs to form a structured database. It includes a three-dimensional index of "feature-electricity price-region" and supports fast querying by region and time dimension.

[0065] S2. Feature extraction and preprocessing for the forecast day: Obtain the core supply and demand data for the forecast day, fill in missing values, standardize the data, and form the features for the forecast day.

[0066] First, the prediction parameters are determined, including the prediction area (specified based on the region ID), the prediction scenario (predicting the current day or real-time), and the prediction date range. The default prediction date range is "D+1 days", but multiple days can be configured (e.g., D+1 to D+3). The prediction parameters set in this embodiment are shown in Table 1.

[0067] Table 1 Prediction parameters of this embodiment

[0068] Parameter name Value Configuration basis Prediction area ID of a province in the east Electricity Market Zoning Coding Standard Predicting scenarios Current spot electricity price Meeting the needs of power generation companies in formulating next-day bidding strategies Predicted date 2025-01-11 (D+1) The default forecast period is "forecast execution date + 1 day". Prediction Granularity 15 minutes (96 time points) Matching the trading hours of the spot market

[0069] The core supply and demand data for the forecast date are obtained according to the aforementioned forecast parameters, including the centrally dispatched load, photovoltaic output, wind power output, interconnection line plans, gas turbine output, and units that must be started or stopped. Officially disclosed data is prioritized, including the day-ahead plans, real-time rolling data, and forecast data released by the power trading center. In this embodiment, the forecast load (10,000MW), interconnection line exchange (+500MW), and various power source output data for January 11, 2025, disclosed by the power trading center, are retrieved.

[0070] If any data fields are missing from the official disclosure, supply and demand forecasts will be obtained from authoritative energy forecasting platforms in the industry to supplement them; for any missing bidding space, the supply and demand balance formula will be used for calculation, as shown below:

[0071] Bidding space = Centrally dispatched load - (Renewable energy output + Interconnection lines + Non-market units)

[0072] For the core supply and demand data acquired for the forecast date, the same preprocessing and standardization rules as those used in step S1 for historical data processing are applied. These include: data with ≥3 consecutive missing time points are supplemented using linear interpolation; data with a single missing time point are filled with data from the same time point of the previous day; an improved Z-score method is used to identify and repair outliers; continuous features such as load and output are standardized using Min-Max; and discrete features such as date type and seasonal label are encoded using one-hot encoding. After the above process, the characteristics of the forecast date are obtained. This ensures that the feature distribution of the predicted daily features is consistent with historical data, avoiding the influence of units on similarity calculation and model input.

[0073] S3. Multi-dimensional matching and screening of similar days: Using multi-dimensional features and multi-indicator similarity calculation, the historical days most similar to the predicted day are screened as similar days, and the actual electricity price of the similar days is extracted as the basic prediction result.

[0074] from Extract the feature subset that matches the predicted date and divide it into three core features: (1) Supply and demand core features: bidding space, load, new energy output, and interconnection line plan to quantify the degree of supply and demand tension; (2) Time series and seasonal features: date type, seasonal label, and weather changes to capture periodic fluctuations; (3) Market environment features: historical volatility of electricity price and market power HHI index to reflect the degree of market competition.

[0075] In this embodiment, based on the goodness of fit of historical predictions, “bidding space (weight × 1.2), load, photovoltaic output (weight × 1.2), date type (weekday), and season (winter)” are selected as core features.

[0076] Targeting the characteristics of the predicted day With historical database Each historical day feature It calculates 12 similarity / distance metrics, covering different similarity dimensions, including:

[0077] (1) Cosine similarity :

[0078] Used to measure and The vector direction is consistent and unaffected by the feature dimensions, making it suitable for similarity judgment of high-dimensional supply and demand features (such as load at 96 time points and new energy output). The formula is as follows:

[0079]

[0080] Where n is the number of time points for the time series feature. To predict the standardized eigenvalue of the daily feature at time point i, Let be the standardized feature value of the historical day feature at the i-th time point.

[0081] (2) Pearson correlation coefficient:

[0082] Used to measure and The degree of linear correlation is suitable for capturing the linear similarity trend of continuous characteristics such as load and renewable energy output (e.g., the synchronicity of intraday load peak and valley changes). The formula is as follows:

[0083]

[0084] in, To predict the mean of daily characteristics, This represents the average of historical daily characteristics.

[0085] (3) Spearman correlation coefficient:

[0086] Used to measure and The monotonic correlation of this property does not depend on the normal distribution of the data, making it suitable for capturing similar trends of non-normal characteristics such as electricity price volatility and the HHI index of market power (e.g., the direction of change in intraday electricity price fluctuations). The formula is as follows:

[0087]

[0088] in, Let be the rank difference of the eigenvalues ​​at the i-th time point.

[0089] (4) Standardized Nash efficiency NNSE:

[0090] Used to measure and The overall goodness of fit, taking into account both bias and fluctuation similarity, is suitable for comprehensively evaluating the similarity of multi-dimensional features (such as the combination of "load + renewable energy output + bidding space"). The formula is as follows:

[0091]

[0092] (5) Mean Absolute Error (MAE):

[0093] Used to measure and The mean absolute deviation is insensitive to outliers and is suitable for assessing the similarity of characteristics susceptible to random fluctuations, such as load and tie-line schedules. The formula is as follows:

[0094]

[0095] (6) Root Mean Square Error (RMSE):

[0096] Used to measure and The square root of the mean square deviation is more sensitive to large deviations (such as a sharp drop in renewable energy output caused by extreme weather) and is suitable for identifying similarities in key time points (such as the deviation of peak photovoltaic output at midday). The formula is as follows:

[0097]

[0098] (7) Mean Absolute Percentage Error (MAPE):

[0099] Used to measure and The relative deviation mean is suitable for assessing the similarity of characteristics with a clear "non-zero benchmark" (such as bidding space, thermal power output), and intuitively reflects the deviation ratio. The formula is as follows:

[0100]

[0101] (8) Symmetrical Mean Absolute Percentage Error (SMAPE):

[0102] This solution addresses the issue of amplified bias caused by an excessively small denominator when historical daily characteristic values ​​in MAPE are close to 0. It is suitable for assessing the similarity of characteristics such as photovoltaic power output (close to 0 at night) and wind power output (close to 0 when there is no wind).

[0103] (9) Weighted average absolute percentage error (MAAPE):

[0104] By smoothing extreme percentage deviations (such as extremely large percentage deviations caused by extremely small historical daily eigenvalues) using the arctangent function, it is suitable for assessing the similarity of characteristics such as the market power HHI index (with large differences in numerical range) and electricity price volatility.

[0105] (10) Mean Absolute Scale Error (MASE):

[0106] By standardizing the absolute error based on the self-fluctuations of historical characteristics, it is suitable for comparing similarities across time and regions, such as comparing the similarity of load characteristics between summer and winter, or the similarity of new energy output between region A and region B.

[0107] (11) Wasserstein distance:

[0108] measure and The probability distribution difference, rather than the hourly deviation, is suitable for assessing the "distribution similarity" of characteristics (such as the peak and valley distribution of intraday load and the time-period distribution of renewable energy output). The formula is as follows:

[0109]

[0110] In the above formula, k is the cumulative index at a given time point.

[0111] (12) Dynamic Time Warping (DTW):

[0112] This method is used to address similarity issues arising from inconsistencies in the length or phase shift of time-series characteristics (e.g., the predicted daily load peak occurs one hour earlier than the historical peak). It is suitable for assessing the morphological similarity of strong time-series characteristics such as electricity prices and loads (e.g., the shape of intraday fluctuation curves). The calculation process is as follows:

[0113]

[0114]

[0115]

[0116]

[0117]

[0118] The final DTW distance is expressed as:

[0119]

[0120] in, To predict the point-by-point distance between time i on a given day and time j on a historical day; It represents the minimum cumulative distance between the i-th prediction time point and the j-th historical time point.

[0121] Among the above indicators, (1)-(4) are similarity indicators, and the closer the value is to 1, the stronger the feature similarity; (5)-(12) are distance indicators, and the closer the value is to 0, the stronger the feature similarity. The 12 indicators selected above are based on a deep understanding of the multi-dimensional influencing factors of spot electricity prices. In response to the core pain points of traditional algorithms such as "single indicators, insufficient scenario adaptation, and failure in extreme scenarios", this innovation overcomes the four major technical difficulties of "complementary screening, special scenario adaptation, correlation verification, and universal design" to form an accurate, stable, and universal indicator system. This innovation breaks through the path dependence and cognitive gap of traditional technologies, and its indicator combination is targeted, complementary, and universal.

[0122] This embodiment starts from... We selected historical samples (approximately 180 samples) from the "winter (December-February) + weekday" period and used Python multithreading (8 threads) to calculate 12 similarity / distance indicators in parallel. Some results are shown in Table 2. Taking January 12, 2024 as an example, this day was a winter weekday with a photovoltaic output of 1450MW, which is highly consistent with the characteristics of the predicted day.

[0123] Table 2. Calculation results of some indicators in this embodiment.

[0124] Indicator Type Specific indicators Calculation results Similarity determination criteria Adapted scenarios Similarity index Cosine similarity 0.92 The closer to 1, the more similar; ≥0.85 indicates high similarity. Consistency of direction of high-dimensional supply and demand feature vectors Similarity index Pearson correlation coefficient 0.91 The closer to 1, the more similar; ≥0.8 indicates high similarity. Synchronous linear trends in load and renewable energy output Similarity index NNSE 0.89 The closer to 1, the more similar; ≥0.8 indicates high similarity. Multi-feature overall goodness of fit Distance index MAE 0.05 The closer to 0, the more similar; ≤0.1 indicates low bias. Absolute deviation assessment of load and bidding space Distance index DTW 0.12 The closer to 0, the more similar; ≤0.15 indicates morphological matching. Similarity in shape of intraday electricity price fluctuation curves Distance index Wasserstein distance 0.08 The closer to 0, the more similar; ≤0.1 indicates a distribution match. Similarity in the distribution of photovoltaic power output during different time periods

[0125] For each indicator, the top 10 historical days are selected as candidate similar days based on similarity ranking, forming 12 × 10 = 120 candidate samples. Duplicate candidate samples are allowed. The frequency of each candidate similar day in the 120 samples is counted; a higher frequency indicates better overall similarity.

[0126] Based on the power structure of the predicted region, candidate days with high contributions to regional adaptation features are given an additional 20% weight. For candidate days more than one year away from the prediction date, their weights are reduced by a time decay coefficient of 10% per year to prioritize the selection of more recent similar days. The historical day with the highest adjusted weight is selected as the final similar day; if the weights are the same, the date closest to the prediction date is selected.

[0127] Based on the predicted scenario, the corresponding electricity price for similar days is extracted and recorded as follows: The extraction methods include: day-ahead forecasting, extracting the day-ahead market settlement price (96 point-in-time electricity prices) for similar days; and real-time forecasting, extracting the real-time market settlement price (96 point-in-time electricity prices) for similar days.

[0128] In this embodiment, the historical sample date 2024-01-12 appeared 9 times in the Top 10 of 12 indicators, the highest frequency. Regional photovoltaic characteristics contributed significantly; the photovoltaic output on 2024-01-12 deviated from the predicted date by only 5%, hence an additional 20% weight was added. 2024-01-12 is one year from the predicted date, with a 10% degradation, resulting in a final weight of 9 × 1.2 × 0.9 = 9.72, determining 2024-01-12 as the optimal similarity date. The day-ahead electricity price (96-point price) for 2024-01-12 is denoted as... The average daily electricity price is 420 yuan / MWh.

[0129] S4. Model Fusion Clearing Simulation: Construct a Stacking fusion architecture of "basic model + meta-model", take the characteristics of the prediction day as input, and output the clearing price simulated by the model as the prediction result.

[0130] The Stacking converged architecture is constructed, comprising a base model layer and a meta-model layer, wherein:

[0131] (1) Basic Model Layer: Three models adapted to different features were selected, covering linear, nonlinear, and time-series fitting capabilities. The selected models are as follows:

[0132] (1.1) KR sub-model: used to fit the nonlinear mapping of "supply and demand indicators → electricity price". The features are mapped to a high-dimensional space through the kernel function, and then linear regression is performed. The kernel function selected is the RBF kernel (radial basis function). The formula is as follows:

[0133]

[0134] in, For RBF kernel function, For kernel parameters, is the regression coefficient, b is the bias term, and n is the number of training samples.

[0135] (1.2) LightGBM sub-model: used to capture feature interaction effects, with fast training speed and low memory consumption. Its core is to generate multiple decision trees iteratively through "gradient boosting", and the final prediction result is the weighted sum of the outputs of multiple trees. The objective function is as follows:

[0136]

[0137] in, The loss function is the mean squared error (MSE). K is the penalty term, and K is the total number of trees.

[0138] (1.3) LSTM sub-model: used to capture intraday electricity price fluctuation trends. The input is the historical electricity price and supply and demand characteristics (new energy, interconnection lines, etc.) of the sliding window. Its cell state update formula is as follows:

[0139]

[0140] in, , , The outputs of the forget gate, input gate, and output gate are... In cellular state, For output of the hidden layer, It is the sigmoid activation function. For element-wise multiplication, , , , This is the weight matrix. , , , This is a bias term.

[0141] (2) Meta-model layer: The XGBoost model is selected. The input is the prediction result of the base model, and the output is the final model prediction value, realizing the nonlinear fusion of the results of multiple models and avoiding the accumulation of bias of a single base model. Its objective function is similar to that of LightGBM, the difference being the introduction of "second-order Taylor expansion" to optimize the training speed, as shown in the following formula:

[0142]

[0143] in, The first derivative of the loss function. It is the second derivative of the loss function.

[0144] The model based on the aforementioned Stacking fusion architecture is trained. The training, validation, and test sets are divided in a 7:2:1 ratio to ensure that each set contains data from different seasons and supply and demand scenarios, thus avoiding overfitting. The specific training methods for each base model and meta-model are as follows:

[0145] (1) KR model: Minimize the prediction error (MAE) by optimizing the kernel function (such as RBF kernel) and regularization parameter through grid search.

[0146] (2) LightGBM model: Optimize learning rate (0.01~0.1) and tree depth (3~8), and use 5-fold cross-validation to avoid overfitting;

[0147] (3) LSTM model: Construct a 3-layer network (input layer → hidden layer → output layer), with 64 units in the hidden layer, using the Adam optimizer, and the loss function is MSE;

[0148] (4) Meta-model training: The prediction results of the basic model on the validation set are used as meta-features to train the XGBoost meta-model. The optimization objective is to minimize the difference between the meta-features and the actual electricity price.

[0149] The training parameters of the base models (KR, LightGBM, LSTM) used in this embodiment are shown in Table 3. The core parameters of the meta-model are set as follows: learning rate = 0.08, tree depth = 4, number of trees = 80, and optimization objective = "minimize MAPE".

[0150] Table 3. Training parameters of the basic model

[0151] Basic Model Core parameters Optimization methods Test set MAPE Adaptability KR Kernel function = RBF, γ = 0.1, regularization parameter = 0.1 Grid search (γ∈[0.01,0.1]) 4.8% Fitting a nonlinear supply-demand-electricity price relationship LightGBM Learning rate = 0.05, tree depth = 5, number of trees = 100 50% cross-validation 4.2% Capture characteristic interactions (such as "high load + low bid space") LSTM Number of layers = 3, hidden units = 64, dropout = 0.2 Adam optimizer (learning rate = 0.001) 5.1% Capture the time-series dependence of intraday electricity prices (such as peak-hour price continuity).

[0152] The training process yields a complete electricity price prediction model. The predicted daily characteristics are then analyzed. Input three pre-trained base models and output their prediction results respectively. , , ;Will , , The combination of meta-features is input into the XGBoost meta-model, and the output is the clearing electricity price prediction result fused by the model, denoted as . The specific numerical values ​​of the prediction results of the basic model in this embodiment are shown in Table 4, where the peak time is 19:00 and the trough time is 03:00.

[0153] Table 4. Prediction Results of the Basic Model

[0154] Basic Model Average daily electricity price (RMB / MWh) Peak hourly electricity price (RMB / MWh) Off-peak electricity price (RMB / MWh) Peak-to-valley difference (yuan / MWh) KR 415 475 295 180 LightGBM 422 482 302 180 LSTM 418 478 298 180

[0155] The prediction results of the three basic models in Table 4 are combined into meta-features (dimension = 3 × 96), input into the XGBoost meta-model, and the auxiliary prediction results are output. Average daily electricity price: 420 yuan / MWh; Peak-valley characteristics: peak price 480 yuan / MWh, valley price 300 yuan / MWh, peak-valley difference 180 yuan / MWh. Comparison with similar day results: point-in-time electricity price deviation ≤3%, indicating that the model prediction is highly consistent with historical experience.

[0156] S5. Dynamic weighted fusion: Based on the historical error rate, the basic prediction results and model-assisted prediction results for similar days are dynamically weighted to generate the final prediction result.

[0157] Calculate similar day prediction results on the historical test set. Compared with actual electricity price The MAPE is used to obtain the similarity day algorithm error rate. On the same test set, calculate the model's prediction results. and The MAPE is used to obtain the model fusion error rate. .

[0158] Weights are assigned based on the reciprocal of the error rate; the lower the error rate, the higher the weight. The formula is as follows:

[0159]

[0160]

[0161] in, Weights for similar day results, The weights are assigned to the model results; if the historical error rate of an algorithm is 0 (the theoretical extreme value), then the weight of that algorithm is set to 1. The final electricity price at each time point is obtained by weighting the results, using the following formula:

[0162]

[0163] Where j is the time index, and in this embodiment, the value range is 1 to 96. Let be the final predicted electricity price at time j.

[0164] S6. Post-processing and storage of results: Correct the final prediction results according to business rules, write them to the database and record the prediction log.

[0165] According to electricity market rules, price upper and lower limits will be adjusted. Cut to the compliant range (matching the maximum price limit in most provinces); use a 3-point moving average method to... Perform smoothing processing to eliminate abrupt fluctuations; according to Manual adjustments will be made for different regions. For example, if the output of new energy sources in region A exceeds expectations, the electricity price will be reduced by 5% to 8%; if the maintenance of thermal power plants in region B increases, the electricity price will be increased by 3% to 5%.

[0166] The process of writing to the database and recording prediction logs involves first formatting the data and supplementing metadata fields (prediction date, release date, region ID, update time); then writing the results to the target table, and performing an update operation if duplicate data exists; and recording key information of the prediction process (similar dates, weight allocation, error rate) to the log table to support traceability and model optimization.

[0167] Example 2

[0168] This invention also proposes a spot electricity price forecasting system based on multidimensional matching and model fusion of similar days, and runs the system to implement all the steps of Example 1. Specifically, the spot electricity price forecasting system includes the following modules:

[0169] Data initialization module 100:

[0170] The data acquisition unit connects to the power trading center and periodically retrieves historical data; the preprocessing unit automatically performs format conversion and missing value filling, and manual confirmation is required after outlier marking; the database construction unit stores the data in MySQL, creates a composite index of info_date, info_hour, and region_id, and the query response time is less than 1 second.

[0171] Predicting Daily Feature Module 101:

[0172] The parameter configuration unit supports inputting the prediction region, scenario, and date via the web interface and saving the configuration template; the feature acquisition unit calls the scheduling center's planned data interface in real time, and automatically triggers the logic to fill in the _self field if there is missing data; the standardization unit reads historical standardized parameters (stored in the configuration file) and processes the features of the prediction day in batches.

[0173] Similar day matching module 102:

[0174] The feature system unit automatically loads feature weights (photovoltaic weight × 1.2) by region; the similarity calculation unit uses Python multithreading to perform parallel calculations of 12 indicators, processing 1000 historical days in less than 5 minutes; the similar day filtering unit outputs a candidate day frequency ranking table, which supports manual intervention and adjustment; the basic results unit automatically extracts the corresponding electricity price field according to the scenario.

[0175] Model fusion module 103:

[0176] The architecture building unit defines the model input and output formats and supports model version management (such as KR V1.0, V2.0); the model training unit updates training data periodically (monthly), automatically optimizes parameters, and writes training logs to the monitoring platform in real time; the model prediction unit receives the daily prediction features and outputs the basic model and meta-model results within 5 minutes.

[0177] Dynamic weighting module 104:

[0178] The error calculation unit updates the historical error rate monthly and generates an error trend chart; the weight allocation unit automatically calculates the weights and supports manual fine-tuning (such as forcibly increasing the model weights in extreme scenarios); the weighted fusion unit outputs the final result and generates a comparison chart of "similar day results - model results - final results".

[0179] Post-processing storage module 105:

[0180] The rule correction unit has built-in electricity price rules for each province (e.g., the upper limit for a certain province is 1500 yuan / MWh), which can be configured and updated; the statistical calculation unit automatically generates summary indicators and supports Excel export; the data writing unit uses batch insertion, automatically updates when there are conflicts, and has a 100% write success rate; the log recording unit archives logs by "prediction date-region-scenario" and supports fuzzy search.

[0181] To verify the effectiveness of the present invention, historical data from January to December 2024 of a certain province were used, and the prediction accuracy results of the method of the present invention were compared with those of the traditional similar day algorithm and the single model algorithm, as shown in Table 5.

[0182] Table 5. Comparison of prediction accuracy between the present invention and traditional algorithms.

[0183] algorithm Regional MAPE Overall RMSE (RMB / MWh) Extreme scenarios (high temperature / cold wave) MAPE Traditional similar day algorithm 8.7% 35.2 12.5% Single LightGBM model 5.3% 22.6 8.3% This invention 3.6% 15.8 4.1%

[0184] The experimental results above show that the present invention outperforms traditional algorithms in all indicators, especially in extreme scenarios, where the prediction accuracy is improved by more than 50%, fully demonstrating the synergistic advantages of "multidimensional matching of similar days + model fusion".

Claims

1. A spot electricity price forecasting method based on multidimensional matching and model fusion of similar days, characterized in that, include: Historical core feature data and electricity price data are obtained. After preprocessing, the historical core features are correlated with electricity price data through timestamps, regions, and electricity prices to obtain historical daily features. Build a historical database; The system sets prediction parameters, including the prediction region, prediction scenario, prediction date, and prediction granularity. Supply and demand data are acquired according to these parameters, and the predicted daily characteristics are obtained after preprocessing. ; calculate With each of the historical databases Similarity and distance metrics are used between them. For each metric, the K historical days corresponding to the Top K values ​​of the metric are selected as candidate similar days for that metric. The candidate similar days of all metrics are recorded to form a candidate sample set. The frequency of each candidate similar day in the candidate sample set is counted, and the candidate similar days are ranked by weight to obtain a final similar day. The electricity price of the final similar day is then extracted. ; A fusion architecture comprising a base model layer and a meta-model is constructed. A model based on this fusion architecture is trained using a historical database to obtain an electricity price prediction model. Input the electricity price prediction model to obtain the clearing electricity price prediction result for the prediction date. ; Based on historical error rate and Dynamic weighting is applied, and the final predicted electricity price for each time point on the prediction day is obtained by weighting according to the weights.

2. The spot electricity price forecasting method according to claim 1, characterized in that, The historical core feature data includes feature name, feature value, and timestamp; the electricity price data includes day-ahead electricity price and real-time electricity price. The feature names include: supply and demand features: bidding space, centrally dispatched load, photovoltaic output, wind power output, interconnection line plan, gas turbine output, and units that must be started / stopped; time-series features: date type, seasonal label, and meteorological data; and regional features: power generation capacity distribution and power structure proportion.

3. The spot electricity price forecasting method according to claim 2, characterized in that, The preprocessing includes: We prioritize filling with feature values ​​from the same time point the previous day; when there are missing values ​​at three or more consecutive time points, we use linear interpolation to fill them in. An improved Z-score method is used to identify outliers. The median absolute deviation (MAD) of all feature values ​​is calculated. When the absolute value of the difference between a feature and the median is greater than 3 × MAD, it is judged as an outlier. The mean of the adjacent time points before and after the feature is used to repair it. Continuous features are normalized using Min-Max, while discrete features are encoded using one-hot encoding.

4. The spot electricity price forecasting method according to claim 3, characterized in that, The similarity index includes cosine similarity. The distance metrics include Pearson correlation coefficient, Spearman correlation coefficient, and standardized Nash efficiency (NNSE); the distance metrics include mean absolute error (MAE), root mean square error (RMSE), mean absolute percentage error (MAPE), symmetric mean absolute percentage error (SMAPE), weighted mean absolute percentage error (MAAPE), mean absolute scale error (MASE), Wasserstein distance, and dynamic time warping (DTW).

5. The spot electricity price forecasting method according to claim 4, characterized in that, The weighted ranking of candidate similar days includes: The number of occurrences is used as the base score for the candidate similar day. If the regional or temporal features of the historical day feature match the predicted region or predicted scenario of the predicted day feature, the base score is increased by weight. If the difference between the date of the historical day feature and the predicted date of the predicted day feature exceeds one year, the base score is decreased by weight.

6. The spot electricity price forecasting method according to claim 5, characterized in that, The basic model layer includes a KR sub-model, a LightGBM sub-model, and an LSTM sub-model. The KR sub-model is used to capture the nonlinear mapping from indicators to electricity prices. It maps features to a high-dimensional space through a kernel function and then performs linear regression. The LightGBM sub-model is used to capture the linear mapping from indicators to electricity prices. It iteratively generates multiple decision trees through gradient boosting, and the output prediction result is a weighted sum of multiple trees. The LSTM sub-model is used to capture the time-series fluctuations in electricity prices.

7. The spot electricity price forecasting method according to claim 6, characterized in that, The meta-model is an XGBoost model, used to nonlinearly fuse the outputs of the sub-models and output the final model prediction value. Its objective function Introducing a second-order Taylor expansion, the formula is as follows: in, The first derivative of the loss function. It is the second derivative of the loss function.

8. The spot electricity price forecasting method according to claim 7, characterized in that, The historical error rate-based pair and Dynamic weighting includes: Calculate similar day prediction results on the test set of the historical database. Compared with actual electricity price The MAPE is used to obtain the similarity day algorithm error rate. On the same test set, calculate the model prediction results. and The MAPE is used to obtain the model fusion error rate. ; The weights are assigned based on the reciprocal of the error rate, using the following formula: in, Weights for similar day results, The weights are the model result weights; if a certain historical error rate is 0, then the algorithm weight is set to 1.

9. The spot electricity price forecasting method according to claim 8, characterized in that, The final electricity price at each point in time is obtained by weighting the electricity prices according to the following formula: Where j is the time index, Let be the final predicted electricity price at time j.

10. A spot electricity price forecasting system based on multidimensional matching and model fusion of similar days, comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the steps of any of the methods of claims 1 to 9.