Power spot market price prediction method and system based on deep waveform embedding and segment retrieval
Patent Information
- Application Number
- CN202611172313.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-04
- Publication Date
- 2026-10-30
AI Technical Summary
[0003]现有电力现货市场价格预测方法主要采用三类技术路线:传统统计与机器学习方法将全天96个时点作为整体输入,丢失了日内不同时段的差异化特征,且完全依赖端到端映射,无法显式利用历史相似价格模式进行迁移;基于聚类检索的相似日预测方法采用静态全局特征进行聚类匹配,无法捕捉日内局部时段的精细相似性,且输入特征相似的历史日可能因市场参与者报价策略差异导致电价曲线形态完全不同;端到端深度学习方法需要大量标注数据,在数据稀缺场景下泛化能力差,且嵌入表示学习与检索应用相互独立,嵌入空间的几何结构不受检索任务约束
1、本发明提供的基于深度波形嵌入与分段检索的电力现货市场价格预测方法,通过将全天时点划分为具有物理意义且存在重叠的时段,构建以尾部加权均方误差和波形度量损失联合优化的波形嵌入模型,并利用该模型同时执行历史片段检索与直接预测,再将两者融合输出全天价格预测曲线。本发明从根本上解决了现有技术中特征相似性与价格模式相似性之间的语义鸿沟问题。具体而言,动态重叠时段分段使模型能够聚焦于各时段内部的价格演化规律,避免了全天整体建模对局部特征的淹没;波形度量损失强制嵌入空间中的样本距离与真实电价曲线形态距离保持一致,使得检索到的历史片段不仅在输入特征上相似,更在价格曲线形态上高度匹配;直接预测与检索结果的融合机制则充分利用了模型的内生预测能力与历史经验的外生迁移能力。实验结果表明,该完整方案的平均绝对误差降至23.17,平均绝对百分比误差降至18.78%,相较于传统端到端基线模型,平均绝对误差降低76.0%,显著提升了电力现货市场价格预测的精度与可靠性。
Smart Images

Figure CN123015078A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of electricity price forecasting technology, and more specifically, to a method and system for forecasting electricity spot market prices based on deep waveform embedding and segmented retrieval. Background Technology
[0002] Electricity spot market prices exhibit complex characteristics such as strong nonlinearity, high volatility, and coupling across multiple time scales. In regions rich in hydropower resources, market prices are driven by multiple factors, including varying water inflows, fluctuations in renewable energy output, and changes in peak and off-peak loads, resulting in a significant intraday multi-peak and multi-valley pattern and seasonal switching characteristics. Accurate day-ahead electricity price forecasts are crucial for market participants' trading decisions, risk management, and the safe and economical operation of the power grid.
[0003] Existing methods for predicting electricity spot market prices mainly employ three technical approaches: Traditional statistical and machine learning methods use all 96 time points of the day as a whole as input, losing the differentiated features of different time periods within the day, and rely entirely on end-to-end mapping, unable to explicitly utilize historical similar price patterns for transfer; Similar day prediction methods based on cluster retrieval use static global features for cluster matching, failing to capture the fine similarity of local time periods within the day, and historical days with similar input features may have completely different electricity price curve shapes due to differences in the bidding strategies of market participants; End-to-end deep learning methods require a large amount of labeled data, have poor generalization ability in data-scarce scenarios, and embedding representation learning and retrieval applications are independent of each other, with the geometric structure of the embedding space not constrained by the retrieval task.
[0004] However, the common bottleneck of the above three methods lies in the lack of a collaborative optimization mechanism between feature embedding, price patterns, and retrieval consistency. There is a structural misalignment between the learning objective of the embedding space and the actual needs of retrieval prediction, namely, the semantic gap between feature similarity and price pattern similarity. Specifically, traditional methods rely on the statistical similarity of the input feature space, rather than the true similarity of price curve shapes, when retrieving historical similar segments. This leads to significant differences between the retrieved so-called similar segments and the target in terms of actual price evolution patterns. Furthermore, existing methods treat all points in time as a whole, ignoring the unique driving mechanisms and evolutionary patterns of different time periods within the day, making it difficult to effectively capture the differentiated characteristics of different stages such as morning ramp-up, midday transition, and evening peak. In addition, the retrieval process and prediction process in existing methods are independent, and the quality of retrieval results cannot be fed back into the adjustment of the prediction strategy, lacking an adaptive adjustment mechanism. Therefore, researching and designing a power spot market price prediction method and system based on deep waveform embedding and segmented retrieval that can overcome the above shortcomings is an urgent problem to be solved. Summary of the Invention
[0005] To address the shortcomings of existing technologies, the present invention aims to provide a method and system for predicting electricity spot market prices based on deep waveform embedding and segmented retrieval. By segmenting overlapping time periods, using a three-element collaborative learning approach of price-aware embedding, and employing a retrieval and prediction closed-loop consistency mechanism, the geometric structure of the embedding space is directly constrained by the explicit similarity of price patterns. This fundamentally eliminates the misalignment between feature similarity and price pattern similarity, thereby achieving high-precision electricity spot market price prediction.
[0006] The above-mentioned technical objective of the present invention is achieved through the following technical solution: Firstly, a method for predicting electricity spot market prices based on deep waveform embedding and segmented retrieval is provided, including the following steps: Acquire historical data of the electricity spot market, including multivariate time series characteristics and market state characteristics; According to the operating rules of the electricity market, the entire day is divided into multiple physically meaningful and overlapping time periods, and each time period is assigned a type label; A waveform embedding model is constructed. The waveform embedding model takes the multivariate time series features and the market state features as inputs and is trained through multi-task joint optimization. The multi-task joint optimization includes at least: supervising the electricity price prediction task with tail-weighted mean square error and supervising the embedding representation learning task with waveform metric loss. The waveform metric loss is used to constrain the consistency between the distance between samples in the embedding space and the distance between the corresponding electricity price curve shapes. The historical data is encoded using the trained waveform embedding model to construct a historical segment index library, and similarity retrieval is performed on each time period of the day to be predicted to obtain candidate segments for each time period. The waveform embedding model is used to directly predict the day to be predicted, generating a direct prediction result. The candidate segments are then fused with the direct prediction result to output a full-day price prediction curve.
[0007] Furthermore, the process of dividing the entire day into multiple physically meaningful and overlapping time periods according to the operating rules of the electricity market, and assigning type labels to each time period, includes: Based on load forecast curves, new energy output forecast characteristics, and hydropower unit output forecast characteristics, key locations affecting electricity price patterns are identified. Based on the key locations, the entire day is divided into a fixed number of time periods, with adjacent time periods sharing some consecutive time points, and each time period covering the entire day's operating cycle. Each time period is assigned a type label, which is used for time period type constraints during the retrieval process.
[0008] Furthermore, the calculation of the waveform metric loss is specifically as follows: For any two samples in a batch, calculate the first cosine distance between their embedding vectors and the second cosine distance between their corresponding real electricity price curves. The error between the first cosine distance and the second cosine distance is used as the waveform metric loss, and the first cosine distance and the second cosine distance are kept consistent by minimizing the error.
[0009] Furthermore, the multi-task joint optimization also includes contrastive learning loss; The contrastive learning loss is used to constrain the embedding vectors of the same type of time period to be close to each other in space, and the embedding vectors of different types of time periods to be far apart from each other.
[0010] Furthermore, the waveform embedding model adopts a WaveNet network skeleton; The WaveNet network performs temporal modeling of input features through dilated causal convolutional layers, performs nonlinear transformation through gated activation units, passes gradients and features through residual connections and skip connections, and then outputs an embedding vector through attention pooling. The embedding vector is used to output a predicted electricity price curve through a regression head. In this context, the multivariate time series features are used as local time series feature inputs, and the market state features are encoded into a market state vector through a fully connected layer and then fused with the local time series features.
[0011] Furthermore, the similarity retrieval for each time period within the day to be predicted includes: Filter historical segments that match the time period type label from the historical segment index library; The weighted sum of the embedding space distance, feature space distance, and market state distance between the time period and the historical segment is calculated. A time period type penalty term, a weekday reward factor, and a date decay weight are introduced to obtain a comprehensive similarity score for each historical segment.
[0012] Furthermore, the similarity retrieval also includes prior reordering of price levels: Obtain the direct predictive power of the segment regression model for each time period, and calculate the deviation between the direct predictive power and the price level of historical segments; The historical segments are reordered based on the deviation, with priority given to historical segments with smaller price level deviations as candidate segments.
[0013] Furthermore, the similarity retrieval also includes daytime consistency selection: The overall matching score is calculated by combining the consistency of day type, distance quality, new system identifiers, similarity of net load curve shape, and holiday identifiers between the predicted day and historical candidate days. The date with the highest consensus score is selected as the baseline date, and historical segments corresponding to the consensus date are extracted as candidate segments.
[0014] Furthermore, fusing the candidate fragments with the direct prediction results includes: Calculate the similarity of the search results for each candidate segment, normalize the similarity and use it as a weight to perform a weighted average of the prices of the candidate segments. When the number of candidate segments is less than a preset threshold, use the direct prediction results to supplement the weights and generate the search price curves for each time period. When the deviation between the directly predicted electricity price and the retrieved price curve exceeds a preset deviation threshold, peak relief is triggered to correct towards the direct prediction direction. Simultaneously, the weight mapping of peak and trough periods is adjusted according to the current market structure, and tightness amplification or profit suppression operations are implemented. The price mapper is used to correct the retrieved price curve according to the market conditions.
[0015] Secondly, a power spot market price forecasting system based on deep waveform embedding and segmented retrieval is provided, including: The data acquisition module is used to acquire historical data of the electricity spot market, including multivariate time series features and market state features. The time period segmentation module is used to divide the entire day into multiple physically meaningful and overlapping time periods according to the operating rules of the electricity market, and to assign a type label to each time period; The model building module is used to build a waveform embedding model. The waveform embedding model takes the multivariate time series features and the market state features as inputs and is trained through multi-task joint optimization. The multi-task joint optimization includes at least: supervising the electricity price prediction task with tail-weighted mean square error and supervising the embedding representation learning task with waveform metric loss. The waveform metric loss is used to constrain the consistency between the distance between samples in the embedding space and the distance between the corresponding electricity price curve shapes. The segment retrieval module is used to encode the historical data using the trained waveform embedding model, build a historical segment index library, and perform similarity retrieval for each time period in the day to be predicted to obtain candidate segments for each time period. The fusion prediction module is used to directly predict the day to be predicted using the waveform embedding model, generate a direct prediction result, and fuse the candidate segments with the direct prediction result to output a price prediction curve for the whole day.
[0016] Compared with the prior art, the present invention has the following beneficial effects: 1. The electricity spot market price forecasting method based on deep waveform embedding and segmented retrieval provided by this invention divides the entire day into physically meaningful and overlapping time periods, constructs a waveform embedding model jointly optimized by tail-weighted mean square error and waveform metric loss, and uses this model to simultaneously perform historical segment retrieval and direct prediction, then fuses the two to output a full-day price forecast curve. This invention fundamentally solves the semantic gap problem between feature similarity and price pattern similarity in existing technologies. Specifically, dynamic overlapping time period segmentation allows the model to focus on the price evolution patterns within each time period, avoiding the overwhelming of local features by overall modeling of the entire day; waveform metric loss forces the sample distance in the embedding space to be consistent with the distance of the actual electricity price curve shape, so that the retrieved historical segments are not only similar in input features, but also highly matched in price curve shape; the fusion mechanism of direct prediction and retrieval results fully utilizes the model's endogenous predictive ability and the exogenous transfer ability of historical experience. Experimental results show that the mean absolute error of the complete scheme is reduced to 23.17 and the mean absolute percentage error is reduced to 18.78%. Compared with the traditional end-to-end baseline model, the mean absolute error is reduced by 76.0%, which significantly improves the accuracy and reliability of electricity spot market price forecasting.
[0017] 2. This invention identifies key locations based on load forecast curves, new energy output forecast characteristics, and hydropower unit output forecast characteristics. It divides the entire day into a fixed number of overlapping time periods and assigns type labels to each. Simultaneously, it uses a WaveNet network skeleton to construct a waveform embedding model, trained through a ternary collaborative optimization of tail-weighted mean square error, contrastive learning loss, and waveform metric loss. This invention achieves accurate construction of the price-aware embedding space. Specifically, segmenting overlapping time periods allows adjacent time periods to share some continuous time points, effectively mitigating boundary effects and ensuring the continuity of price evolution. Time period type labels directly participate in the construction of positive and negative samples in supervised contrastive learning, causing embedding vectors of the same type of time period to be closer to each other in space, while time periods of different types are further apart, forming a cluster structure with price pattern discriminative power. The waveform metric loss ensures that the embedding distance has interpretable price pattern significance by constraining the cosine distance of the embedding vector to be consistent with the cosine distance of the actual electricity price curve. The tail-weighted mean square error forces the model to focus its optimization attention on high price ranges, enhancing peak prediction capabilities. Experiments show that the complete ternary collaborative loss reduces the absolute value of the mean absolute percentage error by 18.08 percentage points compared to the combination of waveform metric loss and regression loss alone, with a relative reduction of 42.6%, verifying the significant improvement of the embedding space quality and prediction accuracy of this technical solution.
[0018] 3. This invention introduces constraints such as multi-dimensional distance-weighted fusion, time-period type penalty, weekday reward, and date decay into similarity retrieval, and further implements price level prior reordering, daytime consistency selection, dynamic fusion closed loop, peak rescue, feature-aware level correction, and price mapper correction. This technical solution constructs an adaptive fusion and multi-level correction mechanism driven by retrieval quality feedback, realizing deep collaboration between retrieval and prediction. Specifically, price level prior reordering aligns the price level of the retrieved segments with the target, effectively solving the problem of percentage error amplification in valley areas; daytime consistency selection ensures that candidates from each time period come from the same historical day, avoiding curve jumps caused by cross-time period splicing; the dynamic fusion closed loop automatically adjusts the fusion weight of retrieval results and direct prediction based on the coefficient of variation of the distance between candidate segments, fully leveraging the advantages of high-quality retrieval when retrieval confidence is high, and automatically downgrading to direct prediction when retrieval confidence is low, suppressing interference from unreliable retrieval; the peak rescue mechanism corrects towards direct prediction when the direct model prediction is significantly higher than the retrieval curve, effectively capturing extreme high-price scenarios missed by the retrieval. Experimental results show that, compared with the configuration that only uses embedded retrieval plus multimodal distance fusion, the full retrieval strategy reduces the average absolute error by 26.4% and the average absolute percentage error by 20.0 percentage points, which fully verifies the significant advantages of this technical solution in terms of peak capture capability, market state switching adaptability and prediction robustness. Attached Figure Description
[0019] The accompanying drawings, which are included to provide a further understanding of embodiments of the invention and form part of this application, do not constitute a limitation thereof. In the drawings: Figure 1 This is a flowchart from Embodiment 1 of the present invention; Figure 2 This is a graph showing the electricity price prediction effect of the original scheme in Embodiment 1 of the present invention; Figure 3 This is a graph showing the electricity price prediction effect in Embodiment 1 of the present invention; Figure 4 This is a system block diagram in Embodiment 2 of the present invention. Detailed Implementation
[0020] To make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the embodiments and accompanying drawings. The illustrative embodiments and descriptions of the present invention are only used to explain the present invention and are not intended to limit the present invention.
[0021] Example 1: A method for predicting electricity spot market prices based on deep waveform embedding and segmented retrieval, such as... Figure 1 As shown, it includes the following steps: S1: Obtain historical data of the electricity spot market, including multivariate time series characteristics and market state characteristics; S2: Divide the entire day into multiple physically meaningful and overlapping time periods according to the operating rules of the electricity market, and assign a type label to each time period; S3: Construct a waveform embedding model. The waveform embedding model takes multivariate time series features and market state features as inputs and is trained through multi-task joint optimization. The multi-task joint optimization includes at least: supervising the electricity price prediction task with tail-weighted mean square error and supervising the embedding representation learning task with waveform metric loss. The waveform metric loss is used to constrain the consistency between the distance between samples in the embedding space and the distance between the corresponding electricity price curve shapes. S4: Encode historical data using the trained waveform embedding model, build a historical segment index library, and perform similarity retrieval for each time period in the day to be predicted to obtain candidate segments for each time period. S5: Use the waveform embedding model to make a direct prediction for the day to be predicted, generate a direct prediction result, and fuse the candidate segments with the direct prediction result to output the price prediction curve for the whole day.
[0022] In step S1, multi-source historical data of the target electricity spot market is first collected. This historical data includes historical spot market clearing prices, with a time resolution of 15 minutes and 96 time points per day. Simultaneously, various types of predicted electricity data are collected, including load forecasts, total generation forecasts, photovoltaic (PV) forecasts, hydropower forecasts, wind power forecasts, total renewable energy generation forecasts, and non-market unit forecasts. Furthermore, historical actual clearing electricity data is also collected, including actual load, actual total generation, actual PV, actual hydropower, and actual wind power. All data are aligned by time to form a multivariate time series feature matrix, with the feature vector at each time step containing all the aforementioned predicted and actual values.
[0023] To further describe the overall market operation, a market state feature vector is constructed, which comprehensively reflects the supply and demand pattern and price level background of the market on that day. Specifically, market state features include the proportion of hydropower, the proportion of renewable energy, and the net load factor, used to characterize the relative relationship between power supply structure and load demand; at the same time, price statistical features are also incorporated, covering the average, standard deviation, maximum, and minimum electricity prices for the same period over the past 7 days, used to characterize the recent price level's concentration trend and fluctuation range. These global features and local time-series features together constitute the input of the waveform embedding model, enabling the model to simultaneously perceive micro-time-series changes and macro-market conditions.
[0024] Data preprocessing includes: filling missing values with linear interpolation before and after the specified time points, truncating outliers, and normalizing all features to ensure that the mean of each feature dimension is 0 and the standard deviation is 1. The normalization parameters are obtained statistically from the training set and are saved for online standardization during subsequent prediction. Finally, the complete data for each historical day includes the multivariate time series feature matrix, market state feature vector, and the actual electricity price curve for that day.
[0025] In step S2, to overcome the shortcomings of traditional whole-day modeling that ignores the differentiated driving mechanisms of different time periods within the day, the 96 time points of the day are divided into multiple physically meaningful and overlapping time periods according to the operating rules of the electricity market. The specific process is as follows: First, the load forecast curve is smoothed and differentially calculated, and inflection points on the load curve are identified by combining meteorological abrupt change detection. Simultaneously, the forecast characteristics of renewable energy output and hydropower unit output are overlaid to comprehensively determine the key locations affecting electricity price patterns. These key locations typically correspond to the switching moments of the power system's operating state, such as the moment when the load begins to climb in the morning, the moment when a surge in photovoltaic power generation leads to a decrease in net load at midday, and the moment when the load climbs again in the evening.
[0026] Based on the identified key locations, the entire day is divided into a fixed number of time periods. In this embodiment, the entire day is divided into 8 time periods, each containing 12 or 16 consecutive time points, with adjacent time periods sharing 4 consecutive time points. This overlapping design allows the same time point to participate in feature learning of both preceding and following time periods simultaneously in the window boundary region, thereby maintaining the continuity of the price evolution process, effectively mitigating boundary effects, and reducing the problem of abrupt changes in the prediction curve at window connection points. Each time period covers the entire daily operating cycle, as shown in Table 1.
[0027] Table 1. Examples of Time Period Division
[0028] As shown in Table 1, each time period has a clear physical meaning. For example, time period 1 corresponds to the nighttime low point, time period 3 corresponds to the morning upswing, time period 4 corresponds to the morning peak, and time period 7 corresponds to the evening peak. Adjacent time periods share four consecutive time points. For example, the slot range of time period 1 is 0-15, and the slot range of time period 2 is 12-23, sharing slots 12-15 (four time points); the slot range of time period 2 is 12-23, and the slot range of time period 3 is 20-35, sharing slots 20-23 (four time points), and so on. By centering the window as close as possible to the typical operating phase, the model can focus more on learning the internal change patterns of that phase, improving local modeling capabilities.
[0029] Furthermore, each time period is assigned a corresponding operational phase type label, including types such as trough, transition, ramp, peak, and decline. For example, time period 1 is labeled as trough, time period 2 as transition, time period 3 as ramp, time period 4 as peak, time period 5 as transition, time period 6 as ramp, time period 7 as peak, and time period 8 as decline. These type labels not only describe the physical meaning of the time periods, but more importantly, they serve as time period type constraints in subsequent similar day retrieval processes, ensuring that only time period segments of the same type are retrieved. This avoids mixing and learning price patterns with significant differences, such as trough and peak phases, thereby improving local prediction accuracy.
[0030] The aforementioned overlapping segmentation design is not only a data preprocessing method but also a fundamental constraint for subsequent embedding learning. The type label of each time period directly participates in the construction of positive and negative samples in supervised contrastive learning: time periods of the same type form positive sample pairs, and time periods of different types form negative sample pairs. This dual mechanism, combining physical constraints and learning constraints, ensures that the embedding space maintains the consistency of price patterns at the segment level, avoiding the erroneous merging of samples with significantly different evolutionary patterns, such as climbing segments and peak segments.
[0031] In step S3, to address the semantic gap caused by a structural misalignment between the learning objectives of the embedding space and the actual needs of retrieval prediction in existing technologies, a price-aware embedding learning model based on WaveNet is constructed. This model employs a ternary collaborative loss mechanism, which explicitly constrains the geometric structure of the embedding space during the training phase by price pattern similarity, ensuring that samples with close proximity in the embedding space necessarily have similar price curve shapes.
[0032] First, for each time segment obtained in step S2, a corresponding input sequence is constructed. The input data is organized into a multivariate time series in chronological order. Each time step contains multiple prediction features, including load forecast information, renewable energy output forecast information, hydropower output forecast information, meteorological forecast information, and historical electricity price context, etc. These features constitute local time series features. Simultaneously, to further describe the overall market operation status, a market state vector is constructed, containing global information such as hydropower share, renewable energy share, net load factor, and price statistics. The local time series features serve as the main input. The market state features are encoded into a market state vector through a fully connected layer and then fused with the local time series features, jointly inputting into the waveform embedding model.
[0033] The waveform embedding model employs the WaveNet network backbone. WaveNet utilizes multi-layer dilated causal convolutions to progressively expand the temporal receptive field, capturing local fluctuation features and long-term dependencies while maintaining computational efficiency. Compared to ordinary convolutional networks, WaveNet can better learn complex change patterns in electricity price curves, such as peak formation, plateau maintenance, rapid ramp-up, and rapid fall-down. The network internally employs a gated activation mechanism, using filtering and gated branches to jointly control information flow, improving the model's ability to model nonlinear market changes. Residual connections and skip connections are also used to fully integrate shallow local information with deep global information, improving training stability and feature representation capabilities. After multi-layer WaveNet encoding, a high-dimensional temporal representation corresponding to the entire time period is obtained. Subsequently, an attention pooling mechanism is used to adaptively weight the importance of each time step, generating a fixed-dimensional embedding vector. This embedding vector comprehensively describes the current time period's price change trend, peak-valley structure, rate of change, and coupling relationships between input variables, representing a deep semantic representation of the current time period's electricity price pattern. The embedding vector is used to output the predicted electricity price curve through a regression head.
[0034] Multi-task joint optimization includes three loss functions, which are backpropagated through a shared WaveNet encoder to form a collaborative optimization mechanism.
[0035] The first loss term is the tail-weighted mean squared error. It is used to monitor electricity price forecasting tasks. Its calculation method is as follows: ; in, The total number of points in time within a given period. This represents the actual electricity price at time t. The model predicts the electricity price at time t. Let be the weight at time point t. The configuration is as follows: for price points higher than the 75th percentile of historical electricity prices, a weight of 1.5 is assigned, while the weight for other price points is 1. This configuration forces the model to focus its optimization efforts on high price ranges, enhancing its ability to predict price spikes.
[0036] The second loss term is the supervised contrastive learning loss, used to constrain the embedding representation learning task. This loss is constructed as follows: embedding vectors from the same time period are used as positive sample pairs, and embedding vectors from different time periods are used as negative sample pairs, calculated based on the InfoNCE loss function. Let the batch contain b samples, and the embedding vector of each sample be... Its corresponding time period type label is For anchor sample i, its set of positive samples is: The negative sample set is Supervised contrastive learning loss Defined as: ; in, The temperature coefficient is set to 0.2 in this embodiment to control the difficulty of distinguishing sample pairs. This loss function encourages embedding vectors of the same type of time period to move closer to each other in space, while embedding vectors of different types of time periods move further apart, thereby forming a cluster structure with price pattern discrimination power in the embedding space.
[0037] The third loss term is the waveform metric loss, used to finely calibrate the correspondence between the embedding distance and the difference in the true price pattern. For any two samples i and j within a batch, the first cosine distance between their embedding vectors and the second cosine distance between their corresponding true electricity price curves are calculated. The first cosine distance is defined as... The second cosine distance is defined as ,in, and Let i and j be the vectors of the actual electricity price curves, respectively. The waveform metric loss uses the mean square error between the first cosine distance and the second cosine distance as the loss value. ; By minimizing the error, the first cosine distance and the second cosine distance are constrained to remain consistent, meaning that samples with similar distances in the embedding space also have similar electricity price curve shapes. The physical meaning of this loss is: if two historical price curves differ significantly in shape, their embedding vectors should also be far apart in space; and vice versa. This constraint ensures that the embedding distance has an interpretable price pattern meaning, so that the nearest neighbor during retrieval truly corresponds to the most similar price pattern, rather than merely the most similar input feature.
[0038] The three losses mentioned above are backpropagated through a shared WaveNet encoder, forming a collaborative optimization mechanism. Tail-weighted mean squared error guides the encoder to learn price-driven features, supervised contrastive learning organizes these features into price pattern-related clusters, and waveform metric loss finely adjusts the intra-cluster distances to match differences in actual price patterns. The total loss is the weighted sum of the three losses.
[0039] In step S4, the trained waveform embedding model is used to encode all historical data, constructing a searchable historical segment index. For each time segment of each historical day, its embedding vector, normalized feature vector, market state vector, actual price curve, time segment type label, and metadata such as date and location are recorded.
[0040] For each time segment of the day to be predicted, a systematic retrieval process is executed. First, historical segments matching the time segment type label are selected from the historical segment index, requiring the same time segment number and a date earlier than the target day, optionally limited to the same water period. Then, various distance metrics are calculated, including embedding space distance based on cosine similarity, feature space distance based on weighted distance, and market distance based on market state vector, etc., and these distances are fused according to the set retrieval mode.
[0041] Specifically, the embedding vector of the time segment to be predicted is denoted as... The embedding vector of a certain historical candidate segment is The embedding space distance is defined as Let the normalized feature vector of the time segment to be predicted be denoted as . The normalized feature vector of the historical candidate segment is The feature space distance is defined as the weighted Euclidean distance. ,in For feature dimension, Let be the weight of the k-th feature, pre-set according to the importance of the feature to electricity price prediction. Let the market state vector for the time segment to be predicted be denoted as . The market state vector of the historical candidate segment is Market distance is defined as The combined distance is a weighted sum of the three distances mentioned above. for: ; in, , , The fusion weights are determined through validation set tuning, and in this embodiment, they are set to 0.5, 0.3, and 0.2 respectively.
[0042] In some preferred examples, various constraints and corrections are applied during the distance calculation process. A time period type penalty is introduced: when the type label of a candidate segment is inconsistent with the time period to be predicted, a penalized increment is applied to the overall distance to ensure that only time periods of the same type are retrieved. A weekday reward factor is applied: for candidate segments that are on the same weekday or weekend as the date to be predicted, a distance reduction reward is given, increasing the weight of historical samples from the same period. A date decay weight is applied: an exponential decay coefficient is calculated based on the time interval between the date to be predicted and historical dates, so that historical segments closer to the date to be predicted receive higher effective similarity scores in the final ranking, while historical segments farther away experience more significant score decay. The similarity scores of all historical segments are then combined; higher scores indicate greater similarity.
[0043] In some preferred examples, after completing the basic similarity calculation, a priori price level reordering operation is performed to further ensure that the absolute price level of the retrieved segments aligns with the target. First, a pre-trained segment regression model is used to predict the initial price level for the period to be predicted. This model is a lightweight regression model that takes the market state vector as input. Then, the deviation between the actual price level of each historical candidate segment and the directly predicted level is calculated. The historical segments are then reordered in descending order based on the deviation, prioritizing the retention of historical segments with smaller price level deviations as candidate segments. This mechanism effectively avoids the amplification of percentage errors caused by overall price increases or decreases, ensuring that the retrieved segments are not only similar in curve fluctuation patterns but also highly consistent in price dimensions.
[0044] In some preferred examples, to prevent unnatural curve abrupt changes during cross-period stitching due to independent searches of each time period, intraday consistency selection is performed after the independent searches of each time period are completed. A multi-dimensional score is calculated based on the information between the day to be predicted and each historical candidate day. Dimensions include: day type consistency (whether they are the same workday or rest day), distance quality (the average similarity score of candidate segments across time periods within that day), new system identifier (whether they are under the same market rule period), comprehensive net load curve shape similarity (the cosine similarity between the net load curves of the day to be predicted and the historical candidate days), and holiday identifier (whether all are holidays or all are non-holidays). The scores of these dimensions are weighted and summed to calculate the comprehensive matching score. The consistent day with the highest comprehensive matching score is selected as the baseline day, and the corresponding historical segments of that consistent day are extracted as the final high-confidence candidate segments input into the subsequent fusion prediction module.
[0045] In step S5, firstly, all feature data for the day to be predicted are input into the trained waveform embedding model. The WaveNet encoder and regression head then output the direct predicted electricity price curves for each time period, denoted as... ,in Indicates the time period number.
[0046] For each time period, a retrieval price curve is generated based on the obtained candidate segments. Let the set of candidate segments for the s-th time period be denoted as . Each candidate fragment Similarity score First, the similarity scores of each candidate segment are normalized to obtain the weights. Then, a weighted average is calculated on the price curves of the candidate segments to generate the initial search price curve for that period. ,in, The actual electricity price curve for candidate segment c. When the number of candidate segments is less than a preset threshold (set to 3 in this embodiment), it indicates that there are not enough high-quality similar segments in the historical database, and the direct prediction result is used. Supplementing the weights means using the direct prediction results as the search price curve for that period.
[0047] After obtaining the direct prediction results and retrieval price curves for each time period, a dynamic fusion strategy is implemented. This strategy adjusts the fusion weights based on retrieval confidence feedback. Retrieval confidence is measured by the coefficient of variation of the candidate segment distance, denoted as the set of comprehensive distances of candidate segments in the s-th time period. Its mean is The standard deviation is Then the coefficient of variation .when If a price pattern highly consistent with the target time period exists in the historical database, and the retrieval confidence is high, then a fusion weight is set. Based primarily on search results; when When the search results are determined to be scattered and lack historical similarity, the weight of the direct model is automatically increased. The maximum value can reach 0.95 to suppress interference from unreliable retrieval. The fused time-period prediction curve is as follows: ; This dynamic adjustment mechanism creates a closed loop between the goals of embedded learning and the actual effects of retrieval applications. When retrieval is reliable, it fully leverages the advantages of high-quality retrieval and automatically downgrades to direct prediction when retrieval is unreliable, thus avoiding the propagation of errors.
[0048] Based on dynamic fusion, a peak-response mechanism is further implemented. When the deviation between the directly predicted electricity price and the retrieved price curve exceeds a preset deviation threshold, it indicates that the retrieval may have missed extreme high-price scenarios. Let the maximum value of the directly predicted price in the s-th time period be denoted as... The maximum value of the search price curve is ,like ,in If a preset deviation threshold is set, such as 50 yuan / MWh, peak recovery will be triggered, correcting the search price curve towards direct prediction. The correction method involves overlaying a peak compensation term onto the search price curve. , where β is the compensation intensity coefficient, which is set to 0.3, so that the corrected retrieval curve moves closer to the direct prediction direction, enhancing the ability to capture price peaks.
[0049] Subsequently, feature perception level correction is performed. Market structure is inferred based on the current market state, which includes a tight market and a surplus market. In a tight market, i.e., when the net load factor is high and reserve capacity is low, peak-hour prices are amplified and the ramp-up steepness is increased; in a surplus market, i.e., when renewable energy generation is high and load is low, peak-hour prices are suppressed and converged towards the median. Specifically, based on the market state vector... The market pattern type is determined by a pre-trained classifier, and then the peak and trough periods of the retrieved price curve are scaled and shifted accordingly.
[0050] Finally, the price mapper is used to refine the search results. The price mapper is a lightweight regression model that takes the market state vector as input and predicts the search residuals. ,in This represents the actual electricity price curves from historical samples. After training, for the day to be predicted, input its market state vector and output the predicted retrieval residual. This is then superimposed onto the search price curve to obtain the corrected search price curve. This mechanism establishes a systematic mapping from market status to retrieval error, enabling fine-tuning of retrieval results in relation to market status.
[0051] Experimental verification To verify the effectiveness of the tail-weighted mean square error, supervised contrastive learning, and waveform metric learning ternary collaborative loss mechanism in this invention, four sets of comparative experiments were designed. Under the same dataset, WaveNet encoder structure, and training hyperparameters, only the configuration of the loss function was changed to quantify the independent contribution and collaborative gain of each loss to the embedding space geometry and prediction accuracy.
[0052] Loss Ablation 1 is a single-task regression baseline that uses only ordinary mean squared error as the regression loss, without introducing supervised contrastive learning or waveform metric loss.
[0053] Loss Ablation 2 is a regression with supervised comparison loss. It adds supervised comparison loss based on the pseudo-label of K-means clustering of price curves to the ordinary mean square error regression loss, without introducing waveform metric loss.
[0054] Loss Ablation 3 is a regression with waveform metric loss. It adds waveform metric loss to the ordinary mean square error regression loss, requiring the cosine distance of the embedding vector to be consistent with the cosine distance of the true price curve, and does not introduce supervised comparison loss.
[0055] Loss Ablation 4 employs a complete ternary collaborative loss mechanism, fully utilizing the three loss parameters of this invention: tail-weighted mean squared error assigning a 1.5x weight to high price points above the 75th percentile; supervised comparison loss with a temperature coefficient of 0.2; and waveform metric loss requiring the embedded cosine distance to align with the cosine distance of the price curve. These three losses are deeply coupled and collaboratively optimized through a shared WaveNet encoder. Data comparisons are shown in Table 2.
[0056] Table 2 Data Comparison
[0057] As shown in Table 2, the results of the four loss ablation experiments clearly reveal the mechanism and synergistic effect of the three losses. The single-task regression baseline, lacking price pattern constraints in the embedding space, resulted in nearly random retrieval results and the worst prediction accuracy. While introducing supervised contrast loss alone led to the clustering of similar price patterns and a significant decrease in MAE (Maximum Amount) of 32.3%, the clustering averaging effect smoothed out high-price periods, causing MAPE to rise to 51.24%. Introducing waveform metric loss alone reduced MAPE to 42.46% by constraining the embedding distance to be consistent with price pattern differences, but the lack of explicit cluster structure guidance limited retrieval stability. The complete ternary synergistic loss method guides the encoder to focus on high-price-driven features through tail-weighted MSE, organizes features into price pattern clusters through supervised contrast loss, and finely calibrates intra-cluster distances through waveform metric loss to match the differences in real price patterns. These three elements form a synergistic link of feature focusing, cluster structure organization, and fine distance calibration. Ultimately, the absolute value of MAPE is reduced by 18.08 percentage points compared to the optimal dual-item combination, with a relative reduction of 42.6%, and MAE is reduced by 56.9% compared to the baseline, fully verifying the necessity and superiority of the ternary synergistic loss method.
[0058] To verify the effectiveness of each core component of the retrieval strategy in this invention, four sets of comparative experiments were designed, using the exact same embedding model and historical index database, with only the distance measurement method, candidate selection rules and fusion strategy changed during retrieval, to quantify the superiority of embedding retrieval over traditional feature retrieval and the marginal contribution of various engineering constraints.
[0059] Retrieval Ablation 1 is the baseline for retrieval in the original feature space. It does not use the trained embedding vectors, but directly calculates the weighted Euclidean distance based on the original normalized feature vectors for retrieval. It does not add any corrections such as time period constraints, weekday rewards, date decay, price level prior reordering, or intraday consistency selection. The retrieval results are directly used as the basis for fusion prediction.
[0060] Retrieval Ablation 2 is a pure embedding distance retrieval method. It only uses the price-aware embedding vectors trained with ternary collaborative loss to calculate the cosine distance for retrieval, without adding multimodal distance fusion, engineering constraint correction, or daytime consistency selection. The retrieval results are directly used as the basis for fusion prediction.
[0061] Retrieval Ablation 3 is an engineering constraint for embedding and multimodal distance fusion. Based on the embedding cosine distance, it superimposes the feature space weighted distance and the market state vector distance to form a multimodal fusion distance, and applies engineering constraints such as time period type mismatch penalty, same week reward, and date age decay correction, but does not introduce price level prior reordering and intraday consistency selection.
[0062] Retrieval Ablation 4 is a complete retrieval strategy. Building upon the previous configuration, it further introduces a price level prior re-ranking mechanism based on a segment-level regression model. After completing independent searches for each time period, it performs inter-day consistency selection and employs a dynamic fusion closed loop driven by retrieval quality feedback. Simultaneously, it introduces segment-level calibration and a price mapper to refine the retrieval results. Data comparisons are shown in Table 3.
[0063] Table 3 Data Comparison
[0064] As shown in Table 3, the results of the four sets of retrieval ablation experiments clearly reveal the mechanism and cumulative effect of each retrieval step. Due to the semantic gap between feature similarity and price similarity, the candidate segments retrieved by the original feature retrieval showed significant differences from the target in terms of price pattern, resulting in a MAE as high as 120.79. Pure embedding retrieval, through the geometric constraints of the price-aware embedding space, made the embeddings closer (i.e., the price patterns closer), significantly reducing the MAE to 52.10, a decrease of 56.9%, but the MAPE remained at 24.38%. After superimposing multimodal distance fusion and engineering constraint correction on the basis of embedding retrieval, the MAE slightly rebounded to 54.21, but the MAPE rose to 39.89%. This is because multimodal fusion introduces more dimensional constraints, which, while improving the robustness of the retrieval, may also introduce noise. The complete retrieval strategy effectively solves the problem of amplified percentage error in valley areas by aligning the price levels of retrieved segments with the target through price level prior reordering. The daytime consistency selection ensures that candidates from different time periods come from the same historical day to avoid curve jumps across time periods. The dynamic fusion closed loop fully leverages the advantages of high-quality retrieval when the retrieval confidence is high, and automatically increases the weight of the direct model to suppress unreliable retrieval interference when the retrieval confidence is low. The synergy of these three factors significantly reduces MAE to 39.89% and MAPE to 19.89%, fully verifying that price level prior, daytime consistency selection, and dynamic fusion closed loop are indispensable in the retrieval strategy.
[0065] To verify the effectiveness of the complete technical solution of this invention, four sets of progressive comparative experiments were designed, starting from a traditional end-to-end baseline and progressively adding core modules to quantify the marginal contribution and synergistic gain of each module. All experiments used the same dataset, time segmentation strategy, and evaluation protocol to ensure that differences only stemmed from solution configuration.
[0066] Scheme Comparison 1 is a traditional end-to-end baseline that does not use overlapping time periods for segmentation. It directly inputs the multivariate features of 96 time points throughout the day into a standard LSTM network for end-to-end prediction and outputs a 96-point price curve for the whole day.
[0067] Scheme Comparison 2 is a superimposed S3 waveform embedding model. Based on the baseline, it introduces overlapping time period segments, uses a WaveNet encoder to extract time series features for each time period segment, and obtains price-aware embedding vectors through ternary collaborative loss training. During prediction, the prediction curves of each time period are directly output from the regression branch and then spliced to form the full-day result, without introducing any retrieval and fusion mechanism.
[0068] Scheme Comparison 3 combines the complete retrieval strategies S3 and S4. Based on the previous configuration, it applies the trained embedding model to all historical data to build a searchable index library, performs multimodal fusion retrieval for each time segment of the day to be predicted, introduces price level prior reordering and inter-day consistency selection, and uses fixed fusion weights to equally weight the retrieval curve and the direct prediction results.
[0069] Scheme Comparison 4 is the complete solution. Building upon the previous configuration, it further introduces a dynamic fusion closed loop driven by retrieval quality feedback, and overlays a peak rescue mechanism, feature-aware level correction, and a price mapper, thus fully implementing the entire process of this invention. Data comparisons are shown in Table 4.
[0070] Table 4 Data Comparison
[0071] As shown in Table 4, the comparative experimental results of the four schemes clearly reveal the marginal contribution and synergistic gain of each core module. Traditional end-to-end whole-day modeling has the lowest prediction accuracy due to ignoring the heterogeneity of electricity prices during different time periods and lacking price perception embedding constraints, with a MAE of 96.50 and a MAPE of 23.15%. After introducing overlapping time period segmentation and a ternary synergistic loss embedding model, the model can learn price perception representations for each time period separately, and the MAE drops significantly to 79.11, a decrease of 18.0%, but the MAPE actually increases to 39.26%. This is because the supervised contrastive learning in the ternary synergistic loss clusters the price curves according to their shape, and the cluster center is the mean curve, which naturally tends to smooth and average the high price peaks and medium price levels, resulting in a sharp amplification of the percentage error in high price periods. In addition, the pure embedding model has insufficient ability to retain extreme price patterns when directly regressing for prediction, so the MAPE increases instead of decreasing.
[0072] By overlaying multimodal fusion retrieval, engineering constraint correction, price level prior, and inter-day consistency selection on the embedded model, and employing fixed equal-weight fusion, the MAE significantly decreased to 39.89, a 49.6% reduction compared to the previous configuration and a 58.7% reduction compared to the baseline. The MAPE also significantly decreased to 19.89%, a 19.37 percentage point reduction compared to the previous configuration and a 3.26 percentage point reduction compared to the baseline. This is because the retrieval mechanism, by explicitly utilizing the true curve shape of historically similar price segments for transfer prediction, effectively avoids the smoothing effect on extreme prices that occurs when the pure embedded model directly regresses. Simultaneously, the price level prior ensures that the retrieved segments and the target are aligned in terms of scale, and the inter-day consistency selection guarantees the coherence of cross-period splicing. This verifies the fundamental advantage of similar-day retrieval over pure regression mapping in maintaining price patterns.
[0073] The complete solution, building upon the previous configuration, further introduces a dynamic fusion closed loop and a triple correction mechanism of peak rescue, level correction, and price mapper. This further reduces the MAE to 23.17, a 41.9% decrease compared to the previous configuration and a 76.0% decrease compared to the baseline. The MAPE decreases to 18.78%, a 1.11 percentage point reduction compared to the previous configuration and a 4.37 percentage point reduction compared to the baseline. The dynamic fusion closed loop ensures optimal accuracy when retrieval is reliable and optimal stability when retrieval is unreliable. The peak rescue mechanism corrects the retrieval curve towards the direct prediction direction when the direct model prediction is significantly higher than the retrieval curve, effectively capturing extreme high-price scenarios missed by the retrieval. The level correction and price mapper refine the retrieval results based on market supply and demand. The synergy of these three mechanisms enables the complete solution to lead across all evaluation indicators, fully validating the necessity and superiority of the complete technical solution of this invention.
[0074] To further verify the effectiveness of the experiment, the data results of the original scheme and the final scheme of this invention were compared. The backtesting results of the original scheme are shown in the figure below. Figure 2As shown in the figure, the final experimental results of this invention are as follows. Figure 3 As shown.
[0075] like Figure 2 and Figure 3 The comparison shows that the original method only fits the data pattern basically correctly, but it generally underestimates the prediction of high electricity price ranges. The improved scheme, when used for electricity price prediction, has an error of less than 1% in 80% of the high electricity price ranges. It does not have a serious problem of peak shaving and valley shaving. Furthermore, it does not have the problem of delaying the satisfaction or expression of the electricity price rise and fall trend.
[0076] While the original method can generally fit the overall trend of electricity price data, it generally suffers from a systematic underestimation problem in forecasting high-price periods. This manifests as peak-shaving and valley-shaving, meaning the model's response to price spikes is insufficient, with predicted values during peak periods significantly lower than actual clearing prices. This deficiency is particularly pronounced during key market events such as tight supply and demand or sharp drops in renewable energy output, directly impacting the reliability of trading decisions during high-price periods. Simultaneously, the original method exhibits a significant delayed gratification problem in tracking electricity price trends. When market conditions change abruptly, the predicted curve lags behind actual price changes, failing to reflect turning points in electricity price trends in a timely manner.
[0077] In contrast, the present invention fundamentally solves the semantic gap problem of misalignment between feature similarity and price similarity in traditional methods by segmenting overlapping time periods, using ternary collaborative learning with price-aware embedding, and establishing a retrieval prediction closed-loop consistency mechanism. Experimental results show that the improved scheme controls the prediction error to within 1% in 80% of high-price ranges, eliminating severe peak-shaving and valley-shaving phenomena. This indicates that the tail-weighted MSE successfully guides the model to focus its optimization attention on high-price ranges, and the peak-rescue mechanism corrects for omissions in extreme high-price scenarios by direct prediction, reducing the prediction error of price peaks by 42% compared to the baseline. Meanwhile, the prediction curve tracks electricity price fluctuations with virtually no delayed gratification or delayed expression issues. This is thanks to the overlapping time-segmentation strategy, which allows adjacent time periods to share boundary information to maintain the continuity of price evolution. Furthermore, the dynamic fusion closed loop driven by retrieval confidence feedback prioritizes retrieval when highly consistent price patterns exist in the historical database, and automatically increases the weight of the direct model to achieve adaptive degradation when historical similarity is insufficient. The synergy of these two mechanisms enables the system to automatically adjust its prediction strategy in scenarios such as the transition between wet and dry seasons and sudden changes in supply and demand, reducing the prediction error on the switching day by 52% compared to the baseline. In addition, the prediction results for each time period can be traced back to specific historical similar segments and their fusion weights, giving the predictions strong interpretability, unlike end-to-end black-box models.
[0078] In summary, this invention fundamentally eliminates the structural misalignment between feature similarity and price pattern similarity through an adaptive closed loop of embedding learning, similarity retrieval, prediction fusion, and quality feedback. It significantly outperforms the original method in terms of capturing high electricity price spikes, adapting to market state switching, and interpretability of prediction results, thus verifying the effectiveness and superiority of the technical solution of this invention.
[0079] Example 2: A power spot market price forecasting system based on deep waveform embedding and segmented retrieval. This system is used to implement the power spot market price forecasting method based on deep waveform embedding and segmented retrieval described in Example 1, such as... Figure 4 As shown, it includes a data acquisition module, a time period segmentation module, a model building module, a fragment retrieval module, and a fusion prediction module.
[0080] The system comprises the following modules: a data acquisition module for acquiring historical data from the electricity spot market, including multivariate time series features and market state features; a time period segmentation module for dividing the day into multiple physically meaningful and overlapping time periods according to the operating rules of the electricity market, and assigning type labels to each time period; a model building module for constructing a waveform embedding model, which takes multivariate time series features and market state features as input and trains through multi-task joint optimization, including at least: supervising the electricity price prediction task with tail-weighted mean square error and supervising the embedding representation learning task with waveform metric loss, which constrains the consistency between the distance between samples in the embedding space and the distance between the corresponding electricity price curve shapes; a segment retrieval module for encoding historical data using the trained waveform embedding model, constructing a historical segment index, and performing similarity retrieval on each time period of the forecast day to obtain candidate segments for each time period; and a fusion prediction module for directly predicting the forecast day using the waveform embedding model, generating direct prediction results, and fusing the candidate segments with the direct prediction results to output the full-day price prediction curve.
[0081] Working Principle: This invention divides the entire day into physically meaningful and overlapping time periods, constructs a waveform embedding model jointly optimized by tail-weighted mean square error and waveform metric loss, and uses this model to simultaneously perform historical segment retrieval and direct prediction, then fuses the two to output a full-day price prediction curve. This invention fundamentally solves the semantic gap problem between feature similarity and price pattern similarity in existing technologies. Specifically, dynamic overlapping time period segmentation allows the model to focus on the price evolution patterns within each time period, avoiding the overwhelming of local features by overall full-day modeling; waveform metric loss forces the sample distance in the embedding space to be consistent with the distance of the actual electricity price curve shape, so that the retrieved historical segments are not only similar in input features, but also highly matched in price curve shape; the fusion mechanism of direct prediction and retrieval results fully utilizes the model's endogenous predictive ability and the exogenous transfer ability of historical experience.
[0082] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0083] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0084] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0085] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0086] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for predicting electricity spot market prices based on deep waveform embedding and segmented retrieval, characterized in that, Includes the following steps: Acquire historical data of the electricity spot market, including multivariate time series characteristics and market state characteristics; According to the operating rules of the electricity market, the entire day is divided into multiple physically meaningful and overlapping time periods, and each time period is assigned a type label; A waveform embedding model is constructed. The waveform embedding model takes the multivariate time series features and the market state features as inputs and is trained through multi-task joint optimization. The multi-task joint optimization includes at least: supervising the electricity price prediction task with tail-weighted mean square error and supervising the embedding representation learning task with waveform metric loss. The waveform metric loss is used to constrain the consistency between the distance between samples in the embedding space and the distance between the corresponding electricity price curve shapes. The historical data is encoded using the trained waveform embedding model to construct a historical segment index library, and similarity retrieval is performed on each time period of the day to be predicted to obtain candidate segments for each time period. The waveform embedding model is used to directly predict the day to be predicted, generating a direct prediction result. The candidate segments are then fused with the direct prediction result to output a full-day price prediction curve.
2. The method for predicting electricity spot market prices based on deep waveform embedding and segmented retrieval according to claim 1, characterized in that, The method involves dividing the entire day into multiple physically meaningful and overlapping time periods according to the operating rules of the electricity market, and assigning type labels to each time period, including: Based on load forecast curves, new energy output forecast characteristics, and hydropower unit output forecast characteristics, key locations affecting electricity price patterns are identified. Based on the key locations, the entire day is divided into a fixed number of time periods, with adjacent time periods sharing some consecutive time points, and each time period covering the entire day's operating cycle. Each time period is assigned a type label, which is used for time period type constraints during the retrieval process.
3. The method for predicting electricity spot market prices based on deep waveform embedding and segmented retrieval according to claim 1, characterized in that, The waveform metric loss is calculated as follows: For any two samples in a batch, calculate the first cosine distance between their embedding vectors and the second cosine distance between their corresponding real electricity price curves. The error between the first cosine distance and the second cosine distance is used as the waveform metric loss, and the first cosine distance and the second cosine distance are kept consistent by minimizing the error.
4. The method for predicting electricity spot market prices based on deep waveform embedding and segmented retrieval according to claim 1, characterized in that, The multi-task joint optimization also includes contrastive learning loss; The contrastive learning loss is used to constrain the embedding vectors of the same type of time period to be close to each other in space, and the embedding vectors of different types of time periods to be far apart from each other.
5. The method for predicting electricity spot market prices based on deep waveform embedding and segmented retrieval according to claim 1, characterized in that, The waveform embedding model uses the WaveNet network skeleton; The WaveNet network performs temporal modeling of input features through dilated causal convolutional layers, performs nonlinear transformation through gated activation units, passes gradients and features through residual connections and skip connections, and then outputs an embedding vector through attention pooling. The embedding vector is used to output a predicted electricity price curve through a regression head. In this process, the multivariate time series features are used as local time series feature inputs, and the market state features are encoded into a market state vector through a fully connected layer and then fused with the local time series features.
6. The method for predicting electricity spot market prices based on deep waveform embedding and segmented retrieval according to claim 1, characterized in that, The similarity search for each time period within the day to be predicted includes: Filter historical segments that match the time period type label from the historical segment index library; The weighted sum of the embedding space distance, feature space distance, and market state distance between the time period and the historical segment is calculated. A time period type penalty term, a weekday reward factor, and a date decay weight are introduced to obtain a comprehensive similarity score for each historical segment.
7. The method for predicting electricity spot market prices based on deep waveform embedding and segmented retrieval according to claim 1, characterized in that, The similarity retrieval also includes prior reordering of price levels: Obtain the direct predictive power of the segment regression model for each time period, and calculate the deviation between the direct predictive power and the price level of historical segments; The historical segments are reordered based on the deviation, with priority given to historical segments with smaller price level deviations as candidate segments.
8. The method for predicting electricity spot market prices based on deep waveform embedding and segmented retrieval according to claim 7, characterized in that, The similarity retrieval also includes daytime consistency selection: The overall matching score is calculated by combining the consistency of day type, distance quality, new system identifiers, similarity of net load curve shape, and holiday identifiers between the predicted day and historical candidate days. The date with the highest consensus score is selected as the baseline date, and historical segments corresponding to the consensus date are extracted as candidate segments.
9. The method for predicting electricity spot market prices based on deep waveform embedding and segmented retrieval according to claim 1, characterized in that, The step of fusing the candidate fragments with the direct prediction results includes: Calculate the similarity of the search results for each candidate segment, normalize the similarity and use it as a weight to perform a weighted average of the prices of the candidate segments. When the number of candidate segments is less than a preset threshold, use the direct prediction results to supplement the weights and generate the search price curves for each time period. When the deviation between the directly predicted electricity price and the retrieved price curve exceeds a preset deviation threshold, peak relief is triggered to correct towards the direct prediction direction. Simultaneously, the weight mapping of peak and trough periods is adjusted according to the current market structure, and tightness amplification or profit suppression operations are implemented. The price mapper is used to correct the retrieved price curve according to the market conditions.
10. A power spot market price forecasting system based on deep waveform embedding and segmented retrieval, characterized in that it includes: The data acquisition module is used to acquire historical data of the electricity spot market, including multivariate time series features and market state features. The time period segmentation module is used to divide the entire day into multiple physically meaningful and overlapping time periods according to the operating rules of the electricity market, and to assign a type label to each time period; The model building module is used to build a waveform embedding model. The waveform embedding model takes the multivariate time series features and the market state features as inputs and is trained through multi-task joint optimization. The multi-task joint optimization includes at least: supervising the electricity price prediction task with tail-weighted mean square error and supervising the embedding representation learning task with waveform metric loss. The waveform metric loss is used to constrain the consistency between the distance between samples in the embedding space and the distance between the corresponding electricity price curve shapes. The segment retrieval module is used to encode the historical data using the trained waveform embedding model, build a historical segment index library, and perform similarity retrieval for each time period in the day to be predicted to obtain candidate segments for each time period. The fusion prediction module is used to directly predict the day to be predicted using the waveform embedding model, generate a direct prediction result, and fuse the candidate segments with the direct prediction result to output a price prediction curve for the whole day.
