Electricity price forecasting method and system based on state-aware and hybrid forecasting networks

By constructing a complexity vector and a hybrid prediction network, and dynamically adjusting the feature focus and sub-network combination weights, the error amplification problem of the electricity price prediction model during the power market state transition is solved, the robustness and adaptability of the model are improved, and the refined diagnosis and smoothness of the prediction results of the power market state are achieved.

CN122492272APending Publication Date: 2026-07-31SICHUAN JIEWUJI TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SICHUAN JIEWUJI TECHNOLOGY CO LTD
Filing Date
2026-04-29
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

Existing electricity price forecasting models are ill-suited to the variability of the electricity market, exhibiting large prediction errors during state transitions. Furthermore, they lack the ability to deeply interact with and adaptively fuse multi-source heterogeneous features, resulting in insufficient robustness and scenario adaptability.

Method used

A complexity vector is constructed to explicitly quantify the market state. Through cross-feature attention fusion, task-adaptive networks, and sparse hybrid prediction networks, the feature attention points and sub-network combination weights are dynamically adjusted. Combined with gated routing and routing smoothing decisions, a division-of-labor and collaborative prediction architecture is formed.

Benefits of technology

It improves the robustness and scenario adaptability of the electricity price forecasting model in complex and volatile market environments, achieves refined diagnosis of the electricity market status and smoothness of forecast results, and meets the requirements of electricity trading and dispatch.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122492272A_ABST
    Figure CN122492272A_ABST
Patent Text Reader

Abstract

This invention discloses a method and system for electricity price prediction based on state awareness and a hybrid prediction network, belonging to the field of electricity price prediction technology. The key technical points are: constructing multi-scale input features; constructing a complexity vector representing the operating state of the electricity market; performing feature interaction through a cross-feature attention mechanism, and using a task-adaptive network to modulate the interacted features based on the complexity vector and market state to obtain a fused feature representation; inputting the fused feature representation into a sparse hybrid prediction network; smoothing the sparse routing weights based on the change in the complexity vector and the change in the historical operating state of each prediction sub-network, and then weighting them to output the final electricity price prediction result. This invention can dynamically adjust its internal feature focus, sub-network combination weights, and output time smoothing inertia according to the market state, improving the overall robustness and scenario adaptability of the electricity price prediction model in complex and volatile market environments.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of electricity price forecasting technology, and more specifically, to an electricity price forecasting method and system based on state-aware and hybrid forecasting networks. Background Technology

[0002] Electricity price forecasting is a core basis for electricity market participants to make day-ahead bidding, risk management, and dispatch decisions. With the increasing penetration of renewable energy and the increasing complexity of market mechanisms, electricity price series exhibit characteristics of multi-timescale coupling, nonlinearity, and non-stationarity, which places higher demands on the accuracy and robustness of forecasting models.

[0003] Currently, electricity price forecasting methods mainly encompass statistical models, traditional machine learning models, and deep learning models. Statistical models, such as ARIMA, have limited ability to characterize nonlinear and abrupt change patterns; while machine learning models based on gradient boosting trees can capture nonlinearity, they struggle to effectively model long-range time-series dependencies; deep learning models, represented by recurrent neural networks, convolutional networks, and Transformer architectures, have made significant progress in electricity price forecasting through their powerful representation learning capabilities, but existing solutions still suffer from several common shortcomings. First, they lack the ability to explicitly perceive and differentiate the operating status of the electricity market; most models use fixed network structures to process data from all time periods, making it difficult to differentiate between highly complex states such as high volatility, strong constraints, and sudden disturbances, as well as low-complexity states such as stable and regular cycles. This leads to amplified prediction errors during state transitions, resulting in poor overall model robustness. Second, they lack deep interaction and adaptive fusion mechanisms for multi-source heterogeneous features. Existing methods often employ simple feature concatenation or single sequence encoding, which fails to adequately characterize the complex dynamic interactions among diverse features such as time attributes, historical electricity prices, supply and demand variables, and external factors. Furthermore, they lack mechanisms to dynamically adjust feature fusion weights based on the prediction task and the real-time scenario. Thirdly, a division-of-labor and collaborative prediction architecture for diverse electricity price formation patterns is lacking. A single model often needs to simultaneously cover multiple inherent patterns such as trends, cycles, fluctuations, supply-demand coupling, and anomalies, easily leading to inter-pattern interference and model capacity conflicts. While Mixture of Experts (MoE) models offer the possibility of conditional computation, without expert design closely integrated with business semantics and an intelligent routing mechanism linked to real-time market conditions and historical expert performance, stable and accurate expert division of labor is difficult to achieve. Fourthly, sparse routing mechanisms inherently suffer from output discontinuity issues. When traditional TopK-based sparse routing experiences slight changes in input features at adjacent times, the activated expert set may undergo abrupt changes, leading to non-physical jumps in the final prediction result. This makes it difficult to meet the requirements of power trading and dispatch applications for smoothness and stability of the output sequence.

[0004] Therefore, researching and designing an electricity price forecasting method and system based on state-awareness and hybrid forecasting networks that can overcome the above-mentioned defects 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 an electricity price prediction method and system based on state-aware and hybrid prediction networks. By constructing a complexity vector to explicitly quantify and represent the market state, the complexity vector serves as a unified state awareness, permeating and modulating subsequent cross-feature attention fusion, feature recalibration of the task-adaptive network, gated routing of the hybrid prediction network, and final routing smoothing decision. This makes the model no longer a static, fixed structure, but capable of dynamically adjusting its internal feature focus, sub-network combination weights, and output temporal smoothing inertia according to different market states such as stability, fluctuation, and anomalies. This solves the technical problem in existing technologies where a single model is difficult to adapt to changing market states and where prediction errors are amplified during state transitions, thereby improving the overall robustness and scenario adaptability of the electricity price prediction model in complex and volatile market environments.

[0006] The above-mentioned technical objective of the present invention is achieved through the following technical solution: Firstly, a method for electricity price forecasting based on state-awareness and hybrid forecasting networks is provided, including the following steps: Multi-scale input features are constructed based on the acquired multi-source power time-series data; Based on historical electricity price sequences and load data, a complexity vector is constructed to characterize the current operating status of the electricity market. Based on the multi-scale input features, feature interaction is performed through a cross-feature attention mechanism, and a task-adaptive network is used to modulate the interacted features with the complexity vector and the market state determined by it as conditions, so as to obtain a task-adaptive fusion feature representation. The fused feature representation is input into a sparse hybrid prediction network, which includes multiple prediction subnetworks with different structures and a gating network. The gating network generates sparse routing weights based on the fused feature representation, the complexity vector, and the historical operating state of each prediction subnetwork to select and activate at least one prediction subnetwork, and the activated prediction subnetwork generates a preliminary electricity price prediction result. Based on the changes in the complexity vector at adjacent time points and the changes in the historical operating status of each prediction sub-network at adjacent time points, the sparse routing weights at the current time point and the previous time point are smoothed, and the preliminary electricity price prediction results are weighted based on the smoothed routing weights to output the final electricity price prediction results.

[0007] Furthermore, the construction of the complexity vector used to characterize the current operating state of the electricity market includes: Calculate the current moment's electricity price volatility characteristics, electricity price range characteristics, electricity price trend slope characteristics, net load change characteristics, price jump indication characteristics, and constraint strength indication characteristics; The electricity price volatility feature, the electricity price range feature, the electricity price trend slope feature, and the net load change feature are normalized based on training set statistics. The normalized electricity price volatility feature, electricity price range feature, electricity price trend slope feature, and net load change feature are concatenated with the price jump indicator feature and the constraint strength indicator feature to obtain a six-dimensional complexity vector.

[0008] Furthermore, the method also includes: Calculate the overall complexity score based on the complexity vector; Based on the comprehensive complexity score, the price transition indication feature, and the constraint strength indication feature, the current market state is determined to be a stable state, a fluctuating state, or an abnormal state, and the market state is encoded as a one-hot vector.

[0009] Furthermore, the process of utilizing a task-adaptive network to modulate the post-interaction features based on the complexity vector and the market state determined therefrom includes: The interactive features are averaged over time to obtain pooled features. The pooled features, the complexity vector, and the one-hot vector are concatenated to obtain the task context vector. The task context vector is input into the task adaptive network, and the task adaptive network outputs a one-channel modulation vector. The channel modulation vector is used to perform channel-by-channel scaling modulation on the interactive features.

[0010] Furthermore, the gating network generates sparse routing weights based on the fused feature representation, the complexity vector, and the historical operating states of each prediction sub-network, including: For each predicted subnetwork, calculate its activation frequency, average routing load, and output stability within the most recent predetermined time window, and construct a subnetwork state vector based on the activation frequency, average routing load, and output stability of all predicted subnetworks. The fused feature representation is averaged in the time dimension to obtain the first pooled feature vector. The first pooling feature vector, the complexity vector, and the sub-network state vector are concatenated to obtain the gating network input vector; The gating network input vector is input into the gating network to obtain the original routing weight vector; The original routing weight vector is subjected to TopK sparse selection and normalization processing to obtain the sparse routing weights.

[0011] Furthermore, the smoothing of the sparse routing weights between the current and previous time steps based on the changes in the complexity vector and the changes in the historical operating states of each predicted sub-network between adjacent time steps includes: Calculate the average of the absolute values ​​of the differences in each dimension between the complexity vector at the current time step and the complexity vector at the previous time step, and use this as the change in complexity. Calculate the Euclidean distance between the current subnetwork state vector and the previous subnetwork state vector, and use it as the subnetwork state change. The fused feature representation is then subjected to global average pooling in the time dimension to obtain a second pooled feature vector. The second pooling feature vector, the complexity vector, the complexity change, and the sub-network state change are concatenated to obtain the smoothing control input vector; The smoothing control input vector is input into a smoothing control network to obtain a smoothing coefficient vector; Based on the change in complexity and the change in the state of the sub-network, determine the smooth region at the current moment; Based on the smoothed region, constraints are applied to the smoothing coefficient vector to obtain the final smoothing coefficient vector; Using the final smoothing coefficient vector, the sparse route weights at the current time are weighted and smoothed together with the smoothed route weights at the previous time. The TopK sparse selection and normalization are then performed on the weighted smoothed result to obtain the smoothed route weights at the current time.

[0012] Furthermore, determining the smooth region at the current moment based on the change in complexity and the change in the sub-network state includes: If the change in complexity is less than the first complexity threshold and the change in the state of the sub-network is less than the first state threshold, then it is determined to be a continuous preservation region; If the change in complexity is not less than the first complexity threshold and less than the second complexity threshold, or the change in the sub-network state is not less than the first state threshold and less than the second state threshold, then it is determined to be a transition zone. If the change in complexity is not less than the second complexity threshold, or the change in the sub-network state is not less than the second state threshold, then it is determined to be a fast update region.

[0013] Furthermore, the step of applying constraints to the smoothing coefficient vector based on the smoothing region includes: In the continuous holding region, smoothing is performed according to the smoothing coefficient vector output by the smoothing control network; In the transition region, the lower limit of each element in the smoothing coefficient vector is constrained to a preset transition threshold. In the fast update region, the smoothing coefficient vector is set to an all-1 vector.

[0014] Furthermore, the multiple prediction subnetworks in the sparse hybrid prediction network include: The trend prediction subnetwork is configured to use inputs with extended time lengths and employs a self-attention mechanism to model medium- to long-term electricity price trends. The periodic prediction subnetwork is configured to introduce periodic position encoding and use a self-attention mechanism to model the intraday and cross-day periodic patterns of electricity prices; The fluctuation prediction subnetwork is configured to use inputs with shortened time lengths and employs a convolutional neural network with a local attention mechanism to model high-frequency fluctuations in electricity prices. The supply and demand forecasting subnetwork is configured to use a cross-attention mechanism to model the coupling relationship between electricity price characteristics and supply and demand characteristics; The external disturbance prediction subnetwork is configured to use a cross-attention mechanism to model the dynamic relationship between electricity price features and external disturbance features; An abnormal scene prediction subnetwork is configured to introduce a modulation vector based on the complexity vector and the market state to modulate the input features, and to use a self-attention mechanism to handle extreme scenes.

[0015] Secondly, an electricity price forecasting system based on state-awareness and hybrid forecasting networks is provided, including: The feature construction module is used to construct multi-scale input features based on the acquired multi-source power time-series data; The vector construction module is used to construct a complexity vector representing the current operating status of the electricity market based on historical electricity price sequences and load data. The feature fusion module is used to perform feature interaction through a cross-feature attention mechanism based on the multi-scale input features, and to use a task-adaptive network to modulate the interacted features with the complexity vector and the market state determined by it, so as to obtain a task-adaptive fused feature representation. A hybrid prediction module is used to input the fused feature representation into a sparse hybrid prediction network. The sparse hybrid prediction network includes multiple prediction sub-networks with different structures and a gating network. The gating network generates sparse routing weights based on the fused feature representation, the complexity vector, and the historical operating state of each prediction sub-network to select and activate at least one prediction sub-network, and the activated prediction sub-network generates a preliminary electricity price prediction result. The final prediction module is used to smooth the sparse routing weights of the current time and the previous time based on the change of the complexity vector in adjacent time and the change of the historical operating status of each prediction sub-network in adjacent time, and to weight the preliminary electricity price prediction result based on the smoothed routing weights, and output the final electricity price prediction result.

[0016] Compared with the prior art, the present invention has the following beneficial effects: 1. The electricity price prediction method based on state perception and hybrid prediction network provided by this invention explicitly quantifies the market state by constructing a complexity vector. The complexity vector serves as a unified state perceiver, which runs through and modulates subsequent cross-feature attention fusion, feature recalibration of task adaptive network, gated routing of hybrid prediction network, and final routing smoothing decision. This makes the model no longer a static fixed structure, but can dynamically adjust its internal feature focus, sub-network combination weights, and output time smoothing inertia according to different market states such as stability, fluctuation, and anomalies. This solves the technical problem in the prior art that a single model is difficult to adapt to the changing market state and that the prediction error is amplified when the state changes. It improves the overall robustness and scenario adaptability of the electricity price prediction model in complex and changing market environments.

[0017] 2. This invention designs a six-dimensional complexity vector comprising electricity price volatility, range, trend slope, net load change, price jump indication, and constraint strength indication. Based on this vector, a comprehensive score is calculated, and judgment rules are established, enabling refined and quantifiable real-time diagnosis of the electricity market's operational status. Continuous features reflect the intensity and direction of market changes, while binary and statistical features capture discrete market events and boundary conditions. By normalizing and comprehensively weighting these heterogeneous features, the model can break free from dependence on a single indicator and form a stable comprehensive state score. Based on this score and the judgment rules for key events and boundary conditions, the market state can be reliably classified as stable, volatile, or abnormal. This solves the problem of existing methods lacking explicit and structured representations of market states, providing clear and reliable state input signals for all subsequent adaptive modules, and is the cornerstone of the entire scheme's state perception capability.

[0018] 3. This invention achieves deep and dynamic feature fusion by employing a cross-feature attention mechanism to interact with grouped multi-source features and introducing a task-adaptive network to perform channel-level modulation on the fused features. The cross-feature attention mechanism allows features from different groups, such as time attributes, historical prices, and supply and demand variables, to interact and compute within a unified representation space. By dynamically characterizing the correlation strength between different features through attention weights, a more information-rich fused feature representation is learned, overcoming the shortcomings of simple feature concatenation or single sequence encoding in modeling complex relationships between features. Furthermore, the task-adaptive network generates a channel modulation vector based on the complexity vector and market state, recalibrating the importance of each channel of the fused features. It can adaptively enhance or suppress the feature channels most relevant to the current state prediction in the fused features according to the current specific market state, realizing on-demand customization of feature representation and effectively improving the discriminative ability and scenario-specificity of the model's feature expression.

[0019] 4. This invention achieves a division-of-labor, collaborative, and intelligent prediction architecture for electricity price forecasting by designing six prediction sub-networks with distinct structures and functions, combined with a gating network that integrates global feature information, complexity, and the historical states of the sub-networks. The six sub-networks force the learning of different intrinsic patterns in electricity prices through various network structures such as long-window attention, periodic encoding, local convolution, and cross-attention, avoiding interference between different patterns within a single model and improving model capacity and pattern coverage. The gating network does not simply select experts based on current input features; instead, it innovatively introduces a sub-network state vector. This vector contains the recent activation frequency, average load, and output stability of each sub-network, enabling routing decisions to perceive the real-time operating status of the sub-network cluster. This routing mechanism, combining business input and system state, allows for more intelligent and balanced allocation of expert resources.

[0020] 5. This invention creatively solves the key engineering problem of discontinuous prediction output caused by the easy jump in routing weights in sparse hybrid prediction models by designing a continuous routing smoothing mechanism based on the change in complexity and the change in sub-network state. The input of the smoothing control network not only includes the current state, but more importantly, it introduces two dynamic indicators: the change in complexity and the change in sub-network state at adjacent time points. This can quantitatively evaluate the intensity of instantaneous fluctuations in market state and the expert system itself. In addition, three smoothing regions are defined: a continuous maintenance region, a transition region, and a rapid update region. Different constraint strategies are applied to maintain routing inertia to pursue output smoothness when the state is stable, limit the lower limit of inertia to ensure a smooth transition when the state changes gradually, and adopt a completely new route for rapid response when the state changes abruptly. This ensures that the smoothed routing weights used for weighting maintain the necessary continuity in the time series to reduce non-physical jumps, while not losing the ability to respond quickly to real market changes. This significantly improves the engineering usability and stability of the prediction output sequence and meets the strict requirements of power trading and dispatch for the continuity of prediction results. Attached Figure Description

[0021] 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 structural diagram of the sparse hybrid prediction network in Embodiment 1 of the present invention; Figure 3 This is a graph showing the prediction results of Experiment 0 in Embodiment 1 of the present invention; Figure 4 This is a graph showing the prediction results of Experiment 1 in Embodiment 1 of the present invention; Figure 5 This is a graph showing the prediction results of Experiment 2 in Embodiment 1 of the present invention; Figure 6 This is a graph showing the prediction results of Experiment 3 in Embodiment 1 of the present invention; Figure 7 This is a graph showing the predicted results of Experiment 4 in Embodiment 1 of the present invention; Figure 8 This is a system block diagram in Embodiment 2 of the present invention. Detailed Implementation

[0022] 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.

[0023] Example 1: A method for predicting electricity prices based on state-aware and hybrid prediction networks, such as... Figure 1 As shown, it includes the following steps: S1: Construct multi-scale input features based on acquired multi-source power time-series data; S2: Based on historical electricity price sequences and load data, construct a complexity vector to characterize the current operating status of the electricity market; S3: Based on multi-scale input features, feature interaction is performed through a cross-feature attention mechanism, and a task-adaptive network is used to modulate the interacted features with the complexity vector and the market state determined by it, so as to obtain a task-adaptive fusion feature representation. S4: Input the fused feature representation into the sparse hybrid prediction network. The sparse hybrid prediction network includes multiple prediction sub-networks with different structures and a gating network. The gating network generates sparse routing weights based on the fused feature representation, complexity vector and the historical running state of each prediction sub-network to select and activate at least one prediction sub-network. The activated prediction sub-network generates the preliminary electricity price prediction result. S5: Based on the change in complexity vector at adjacent time points and the change in the historical operating status of each prediction sub-network at adjacent time points, the sparse routing weights at the current time point and the previous time point are smoothed, and the preliminary electricity price prediction results are weighted based on the smoothed routing weights to output the final electricity price prediction results.

[0024] In step S1, firstly, multi-source power data is collected. Multi-source power time-series data for the target region over a certain historical period are simultaneously extracted from the source databases of the power market operation system, energy management system (EMS), and renewable energy output forecasting system. Specifically, the multi-source power time-series data includes: historical electricity price sequences as the model prediction target, and actual load sequences, renewable energy output sequences, and non-market-based output sequences as exogenous input variables for the model. Renewable energy output includes, but is not limited to, wind power and photovoltaic power, while non-market-based output includes, but is not limited to, nuclear power and run-of-river hydropower. The historical electricity price sequences reflect the price changes of electricity over time; the actual load sequences and renewable energy output sequences are used to calculate net load to characterize the real-time supply and demand balance of the power system; and the non-market-based output sequences serve as boundary conditions affecting market clearing results. In a preferred embodiment, the original time granularity of the multi-source power time-series data is uniformly set to 15 minutes to match the clearing and settlement cycle of the electricity spot market.

[0025] Next, the collected multi-source power time-series data undergoes timestamp standardization and consistency processing. Since the data may originate from different business systems, their timestamp formats may differ. This step converts all data timestamps to a standardized format. Subsequently, for each type of data sequence, it is sorted in ascending order by timestamp, and records that are completely duplicated due to data transmission or recording errors—that is, records where both the timestamp and data value are identical—are checked and deleted to ensure the monotonicity of the time series. For individual time points where data is missing due to communication interruptions or other reasons, forward padding or linear interpolation is used to complete the data, ensuring the continuity of the time series.

[0026] Then, based on the unified timestamps, all multi-source power time-series data are aligned and fused along the time dimension. Specifically, a complete and continuous unified time axis with 15-minute intervals is created, covering the time range of all data sequences. Historical electricity price sequences, actual load sequences, renewable energy output sequences, and non-market-based output sequences are all indexed onto this unified time axis according to their timestamps. For time points on the unified time axis where data sources are missing at specific moments, the interpolation strategy from the previous step is used to fill in the missing data. Finally, a well-structured, time-aligned multi-source power time-series structured dataset is generated, where each row corresponds to a specific 15-minute moment, and each column corresponds to the specific values ​​of variables such as electricity price, actual load, renewable energy output, and non-market-based output at that moment.

[0027] After completing data alignment to obtain a multi-source power time-series structured dataset, multi-scale input features for model input are constructed based on this dataset. Multi-scale input features It is constructed as a set containing five sets of feature channels, namely The subscript t represents the current time, and the specific construction method is as follows.

[0028] Constructing time attribute features Information related to date and time is directly extracted from the unified timestamp. Specifically, the hour and minute values ​​corresponding to the current time t are extracted. The minute values ​​are typically 0, 15, 30, and 45 minutes at a 15-minute granularity, serving as features characterizing the absolute time within a day. Simultaneously, based on the date information, it is determined whether the current date is a workday (e.g., Monday to Friday are workdays, Saturday and Sunday are non-workdays), and a binary identifier variable is generated, such as 1 for a workday and 0 for a non-workday. These features together constitute... This provides the model with basic time positioning information.

[0029] Constructing periodic features To enhance the model's ability to identify intraday cyclical patterns in electricity prices, the hourly variable is periodically encoded. The current hourly value is divided by the period length of 24 and normalized to obtain the phase ratio. This phase ratio is then input into sine and cosine functions to generate a pair of continuous, smooth periodic encoded values. This encoding ensures that 0:00 and 24:00 have the same encoded value, enabling the model to perceive cyclical patterns in time. This pair of sine and cosine values ​​together constitute... .

[0030] Build business operation characteristics This set of features aims to characterize the supply and demand dynamics of the power system. First, based on the actual load sequence and the renewable energy output sequence, the net load at the current time t is calculated. The calculation formula is as follows: .in, This represents the actual load value at time t. Represents the output value of new energy sources at time t. Net load. This reflects the load level that needs to be met by conventional dispatchable power sources. Furthermore, the net load differential change between adjacent time points is calculated. This is to capture short-term fluctuations. Simultaneously, the difference between the current net load and the net load at the same time the previous day is calculated: There are 96 15-minute intervals in a day to represent the changing trends across the day. , and Together constitute .

[0031] Constructing autoregressive features This set of features directly utilizes historical electricity price series to capture its own changing trends and memory. The core feature is the historical electricity price lag value, specifically including the electricity price at the same time the previous day. This allows for the modeling of daily cycle similarity. Furthermore, price momentum features can be constructed, such as calculating a simple moving average of electricity prices over a recent time window (e.g., the past 4 hours, or 16 time steps), or calculating the price difference between adjacent times. As an indicator depicting the direction of short-term changes, these characteristics, directly derived from historical electricity price series, collectively constitute... .

[0032] Constructing statistical and fluctuation characteristics This set of features characterizes the local statistical properties and volatility of historical electricity price sequences by performing statistical calculations within a sliding time window. Within a sliding window of length W time steps, the rolling standard deviation of historical electricity prices is calculated to measure price volatility. Simultaneously, the rolling maximum and rolling minimum values ​​within this window are also calculated. Furthermore, to more directly characterize volatility, the standard deviation of electricity prices can be calculated within a shorter window, and the lagged value of this volatility indicator is also included as a feature. These statistics collectively constitute... It provides a statistical profile of electricity price series at different time scales.

[0033] Finally, all constructed features are truncated. Since the construction of autoregressive and statistical / fluctuation features relies on data within historical time windows, the initial time points of the sequence cannot form complete feature vectors. Therefore, these incomplete samples from the initial stage of the sequence need to be truncated and discarded to ensure that each sample ultimately used for model training corresponds to a multi-scale input feature. All are complete and effective.

[0034] In step S2, firstly, based on historical electricity price sequences and load data, the original feature values ​​of the six dimensions are calculated respectively.

[0035] Calculate the characteristics of electricity price volatility A sliding window with a length of 8 time steps is used to calculate the rolling standard deviation of the historical electricity price series. The expression is as follows: .in, This represents the electricity price at the current time t. The function calculates the standard deviation of a sequence. to This represents the electricity price sequence for the most recent 8 moments within the window. Electricity price volatility characteristics. This reflects the recent volatility in electricity prices.

[0036] Calculate the range characteristics of electricity prices Using a sliding window with the same characteristics as volatility, the difference between the highest and lowest electricity prices within that window is calculated. The expression is: .in, Indicates from time t The electricity price sequence from time 7 to time t. and Calculate the maximum and minimum values ​​of the sequence respectively. Electricity price range characteristics. This reflects the largest fluctuation range in electricity prices recently.

[0037] Calculate the slope characteristics of electricity price trends A sliding window of 16 time steps is used to perform a first-order linear fit on the electricity price series within the window, and the slope of the fitted line is obtained using the least squares method. Its expression is: .in, The function performs a least-squares linear fit and returns the slope value. This feature represents the slope characteristic of the electricity price trend. This reflects the short- to medium-term trend of electricity price changes.

[0038] Calculate the characteristics of net load change The net load variation characteristic is defined as the absolute difference in net load between adjacent one-hour periods: Characteristics of net load changes It reflects the magnitude of changes in net demand of the power system over a short period of time and is related to system regulation pressure.

[0039] Calculate price transition indicator features This is a binary feature used to indicate whether a significant price jump has occurred. The criterion is: if the absolute difference in electricity prices between adjacent time points exceeds twice the rolling standard deviation of the past 24 hours, a jump is considered to have occurred. Its expression is: if... ,but ;otherwise .in, Calculate the rolling standard deviation of electricity prices over the past 96 time periods. This indicates an abnormal price jump.

[0040] Calculate constraint strength indication characteristics This feature indirectly reflects the stress level of network constraints by measuring the relative position of the current net load within the statistical interval of the historical training set. The calculation formula is: .in, , These represent the 10th and 90th percentiles of the net payload data calculated on the training set, respectively. It is a very small positive number added to prevent the denominator from being zero. The function will value It is restricted to the interval [0,1]. The closer it is to 1, the closer the current net load is to historical highs, suggesting that the system may be approaching transmission or generation capacity constraints.

[0041] Next, the continuous original features are normalized. For the four continuous features mentioned above... , , , A truncation and standardization method based on training set statistics is adopted. The original value of the k-th feature at time t is... The normalization process consists of two steps: first, calculate... ,in and These are the mean and standard deviation of the feature on the training set, respectively; the number 3 indicates that the truncation is performed using three times the standard deviation. Then, calculate... ,Will The range of values ​​is linearly mapped from [-1, 1] to [0, 1]. For binary features... Features already in the [0,1] interval No further normalization is required; it can be used directly.

[0042] Then, concatenate them to obtain a six-dimensional complexity vector. The four normalized continuous features... With two features that do not require normalization , By concatenating them in a fixed order, the final six-dimensional complexity vector is formed: , Corresponding to , , , .

[0043] To quantify the intensity of instantaneous changes in market conditions, a change in complexity is defined. The calculation formula is as follows: That is, to calculate the time t and t The absolute values ​​of the differences in the complexity vector at time 1 across all dimensions are then averaged.

[0044] Market status is determined and encoded based on complexity vectors. First, a comprehensive complexity score is calculated based on a six-dimensional complexity vector. This serves as the scalar basis for overall judgment. Its calculation formula is: The weighting coefficients reflect the prior settings for the importance of different features. Then, based on... , and Establish judgment rules: 1) Steady state: when and Time determination; 2) Fluctuation state: when ,or but Time-based determination; 3) Abnormal state: when ,or and The decision is made in real time. Finally, the discrete state of the decision is encoded into a three-dimensional one-hot vector. For example, if it is a steady state, then If it is in a fluctuating state, then If it is an abnormal state, then .

[0045] In step S3, firstly, the multi-scale input features are uniformly represented and grouped. The multi-scale input features are then... The five feature channels are grouped and processed. An input sequence of length 96 time steps is used. Each feature group is first passed through an independent linear mapping layer, projecting it onto a unified feature dimension. For any time step in the sequence After projection, the five sets of features are uniformly represented as At each time step, the model obtains a unified feature matrix containing 5 feature "terms", each with a dimension of 64.

[0046] Next, cross-feature attention computation is performed. Cross-feature attention employs a standard multi-head self-attention (MHSA) structure. Specific parameters are preferably set as follows: feature dimension... Attention count Dimensions of each attention head For each time step Unified feature representation , respectively with the learnable query mapping matrix Key mapping matrix Sum value mapping matrix Multiplying them yields a query, key, and value vector: , , The formula for calculating attention weights is: ; Among them, divided by The operation is called scaling the dot product attention, used to prevent the dot product from becoming too large and causing the gradient of the Softmax function to vanish. The calculated attention output is then passed through an output mapping matrix. A linear transformation is performed to obtain the results of feature interactions at each time step. Finally, average pooling is performed along the feature group dimension to compress the interaction results at each time step into a 64-dimensional vector. This process is repeated for each time step in a sequence of length 96 to obtain a fused feature representation across time series. ,in .

[0047] Then, construct the task context vector. Task context vector Its function is to provide the conditional information required for modulation in task-adaptive networks. It is constructed using a fixed splicing method: .in, This represents the above-mentioned fusion features. The result obtained by global average pooling across all 96 time steps represents a global summary of the fused features within the entire historical window. This is the six-dimensional complexity vector constructed earlier. Concatenating these three parts yields a task context vector with dimensions 64 + 6 + 3 = 73. .

[0048] Finally, feature modulation is performed using a Task Adaptive Network (TAN). The Task Adaptive Network is a small conditional modulation network whose input is the task context vector constructed in the previous step. TAN preferably uses a two-layer fully connected neural network structure. The calculation formula for the first layer is: ,in, It is the weight matrix of the first layer. It is a bias term. It is the Gaussian error linear unit activation function, which can be replaced by ReLU, etc. The calculation formula for the second layer is: ,in, , , The function compresses the output values ​​to the (0,1) interval. (Network output) This is called the channel modulation vector. This modulation vector is applied to the fused feature representation of the aforementioned cross-feature attention output through channel-wise scaling. Above: Features for each time step τ in the sequence ,calculate ,in, This represents element-wise multiplication. This operation is equivalent to dynamically enhancing or suppressing the importance of each of the 64 channels of the fused feature representation Z based on the current market complexity and state. After modulation over all time steps, the final task-adaptive fused feature representation is obtained. ,in .

[0049] In step S4, firstly, a multi-step direct prediction method is adopted, setting the output of each activated prediction sub-network to be the electricity price forecast for the next hour. Therefore, each prediction sub-network... The output is defined as ,in These correspond to six different prediction subnetworks, such as Figure 2 As shown.

[0050] Trend prediction subnetwork This subnetwork is specifically designed for modeling the medium- to long-term trend components of electricity prices. Its input window is expanded to 192 time steps, padding with boundary values ​​if the original sequence length is insufficient. This subnetwork employs a single-layer 4-head self-attention mechanism to model the expanded sequence, with each head having a dimension of 16, capturing long-range dependencies. This is followed by a two-layer multilayer perceptron, with the following structure: an input dimension of 64, mapped to 128 dimensions via a linear layer, then mapped back to 64 dimensions via a GELU activation function, and finally outputting the prediction result through a linear layer. The dimensions changed from 64 to 4.

[0051] Periodic prediction subnetwork This is specifically designed for modeling intraday and interday cyclical patterns in electricity prices. Its input is a standard 96-step historical feature set. First, periodic position encoding is performed on the hourly information at each time step in the sequence: Calculation ,in This is the corresponding learnable weight matrix. For the corresponding bias, This is pi. Encode this periodic vector. Input features at the corresponding time step Element-wise addition is performed. The fused sequence then passes through a four-head self-attention mechanism and two MLP layers with the same structure as the trend expert, finally outputting the prediction result. .

[0052] Fluctuation Prediction Subnetwork This system is specifically designed to capture high-frequency fluctuations and short-term spikes in electricity prices. It uses only the local feature windows from the most recent 32 time steps as input to focus on short-term dynamics. The sub-network employs a structure combining convolutional neural networks and local attention: first, local features are extracted through two one-dimensional convolutional layers. The first layer has a kernel size of 3 and padding of 1; the second layer has a kernel size of 5 and padding of 2. Both convolutional layers have 64 output channels, and the activation function is ReLU. Subsequently, a local attention mechanism is applied to the sequence of convolutional outputs using a sliding window approach. Each local window is 8 time steps long and uses 2 attention heads. The processed features are then mapped through a three-layer MLP to output the prediction result. .

[0053] Supply and demand forecasting subnetwork It is specifically designed for modeling the coupling relationship between electricity prices and power system supply and demand variables. First, from the input... The model uses linear projection to separate the price-related feature subspace and the supply-demand-related feature subspace: , ,in Let be the learnable projection matrix, and represent the corresponding weights and biases, respectively. Then, a cross-attention mechanism is employed, using price features... As a query, based on supply and demand characteristics Simultaneously serving as both key and value, the cross-attention calculation result... for: ,in , , The cross-attention output is processed using the same two-layer MLP as the trend expert to obtain the prediction result. .

[0054] External disturbance prediction subnetwork This is specifically designed for modeling the dynamic relationship between electricity prices and external disturbances. Its structure is similar to the supply and demand forecasting subnetwork, but it focuses on different feature interactions. First, the disturbance feature subspace is constructed: ,in , which is the corresponding learnable weight matrix. Similarly, a cross-attention mechanism is used, with price features... For querying, based on perturbation characteristics For keys and values, calculate cross-attention. The subsequent MLP structure is then... Same, output prediction results .

[0055] Abnormal Scene Prediction Subnetwork It is specifically designed to handle abnormal scenarios such as extreme price fluctuations and severe supply-demand imbalances. Its input is a complete 96-step feature set. First, an anomalous modulation mechanism is introduced: based on the complexity vector obtained in step S2... Unique heat vector of market status Calculate an anomalous modulation vector ,in , , where are learnable model parameters, and represent the corresponding weights and biases, respectively. Then, this modulation vector is used to modulate the features of the input sequence at each time step channel-by-channel: ⊙ represents element-wise multiplication. The modulated features are then passed through a 4-head self-attention mechanism and a standard two-layer MLP to output the prediction result. .

[0056] Next, the sub-network state vectors are defined and constructed. To reflect the recent operational status of each predictive sub-network and to provide a decision-making basis for the gating network, sub-network state vectors are constructed. For any predictive subnetwork Within a sliding window of the most recent 16 time steps, three state variables are statistically analyzed: activation frequency, average routing load, and output stability.

[0057] The formula for calculating activation frequency is: ; in, For a moment The set of predictive subnetworks selected by the gating network, this value reflects the frequency with which the subnetworks have been called recently.

[0058] The formula for calculating average routing load is: ; in, It is a moment Normalized subnetwork The routing weight is 0 if not selected, and this value reflects the average contribution of the subnetwork in recent times.

[0059] The formula for calculating output stability is: ; in, and Calculate the standard deviation and mean absolute value of the output values ​​of this subnetwork over the last 16 time steps. To prevent division by zero for extremely small positive numbers, this value is used to quantify the volatility of the recent predicted output of the subnetwork; the smaller the value, the more stable the output. This represents the output value of the i-th subnetwork over the last 16 consecutive time steps.

[0060] By concatenating the three state variables of the six sub-networks in sequence, the sub-network state vector is formed. .

[0061] Next, the gated network structure and sparse routing rules are designed. The gated network is responsible for generating sparse weights for selecting the prediction subnetwork based on the current input and system state. Its input vector Constructed by piecing together: .in, The task-adaptive fusion feature representation is the first pooled feature vector obtained by global average pooling over 96 time steps. This is a complexity vector. For the subnetwork state vector, therefore The gated network is a two-layer fully connected network, with the first layer output... ,in , These are the corresponding weights and biases; the output of the second layer. ,in , , which represent the corresponding weights and biases, respectively. Output These are the original routing weight vectors corresponding to the six sub-networks. To achieve conditional calculation and efficiency improvement, [the following is omitted]. Perform TopK sparse selection, preferably setting K=2. This means retaining only the two largest weight values ​​and setting the rest to zero, resulting in a sparse weight vector. Subsequently, on The weights of the non-zero values ​​are normalized: This yields the final sparse route weights. Only the selected prediction subnetwork will be activated and forward computed.

[0062] Finally, the initial output of the sparse hybrid prediction network is calculated. The normalized sparse route weights are then... The output of the corresponding activated prediction subnetwork By performing weighted summation, we obtain the preliminary electricity price prediction results from the sparse hybrid prediction network: ,in This is a preliminary electricity price forecast for the next four time points.

[0063] In step S5, firstly, two key change quantities used to trigger smoothing decisions are calculated, including the change in complexity and the change in sub-network state.

[0064] Change in complexity The formula used to measure the instantaneous and dramatic changes in the state of the electricity market is as follows: ; in, and Let represent the values ​​of the complexity vectors at the current time t and the previous time t-1 in the k-th dimension, respectively. First, calculate the absolute value of the difference between the two vectors in each dimension, and then average the absolute values ​​over all six dimensions. The larger the value, the more dramatic the leap in market complexity within a short period of time.

[0065] Sub-network state changes It is used to measure the overall change in the operating state of each prediction subnetwork over a short period of time. Its calculation formula is: ; in, and Let represent the values ​​of the subnetwork state vectors at the current time t and the previous time t-1 in the j-th dimension, respectively. The larger the value, the more significant the overall shift in the activation frequency, load, or output stability of the predicted sub-network cluster has occurred in a short period of time.

[0066] Next, the input vector for the smoothing control network is constructed. The smoothing control network is a small neural network whose input needs to include both the static features and dynamic changes at the current time step. Input vector Constructed by splicing: .in, This is the second pooled feature vector obtained by performing global average pooling across all 96 time steps on the fused feature representation. It provides global contextual information for the current input features. The concatenated smoothing control input vector is then obtained. The dimension is 64 + 6 + 1 + 1 = 72, that is... .

[0067] Then, a smoothing coefficient vector is generated through a smoothing control network. The smoothing control input vector is then used. The input is fed into a smoothing control network. This network preferably employs a two-layer fully connected structure, with the output of the first layer being... ,in , These are the corresponding weights and biases; the output of the second layer is... ,in , , which represent the corresponding weights and biases, respectively. Network output This is called the smoothing coefficient vector, and each element of it... Corresponding to the i-th predicted sub-network, and with its value constrained within the (0,1) interval by the Sigmoid function, it initially characterizes the inertia strength of smoothing the routing weights of this sub-network.

[0068] Subsequently, the smoothing region is determined based on the amount of change, and constraints are imposed on the smoothing coefficient. To achieve intelligent smoothing that maintains inertia during stable conditions and responds quickly to abrupt changes, this invention uses the amount of change... and Determine the current smooth region and adjust the smoothing coefficient vector accordingly. Apply hard constraints. The decision rules are as follows: Continuous maintenance zone: when and Time-based determination. This region indicates that both the market and the forecast subnetwork state are very stable with minimal changes. Within this region, the original coefficients of the smoothing control network output are not... Imposing additional constraints allows it to perform smoothing based on the network's predicted values, i.e., it tends to maintain routing inertia.

[0069] Transition zone: when the conditions are met or The decision is made when any of the following conditions are met. This region indicates that the system state has changed to some extent, but not drastically. Within this region, a lower bound constraint is applied to the smoothing coefficient, that is... The value of each element in the vector is set to be no less than a preset transition threshold, which ensures that the smooth inertia is not too strong and allows the routing weight to keep up with the state changes at a relatively fast speed.

[0070] Fast update zone: When the conditions are met or The decision is made when any of the following conditions are met. This region indicates a drastic change in market complexity or the state of the predictive subnetwork. Within this region, the smoothing coefficient vector is directly set to an all-1 vector, i.e. This allows the smoothing formula to degenerate into one that fully utilizes the newly calculated routing weights at the current moment, completely eliminating historical inertia and achieving rapid response and updates to the routes. After the above region determination and constraints, the final smoothing coefficient vector is obtained, which is used for subsequent weighting.

[0071] Finally, weighted smoothing and re-sparsening are performed to obtain the final route weights. The final smoothing coefficient vector is then used. For the sparse route weight vector generated by the gating network at the current moment Compared with the smoothed route weight vector from the previous time step. Perform convex combination weighted smoothing. The smoothing update formula is: Where ⊙ denotes element-wise multiplication, for each predictive subnetwork, its current routing weight is a weighted average of the current sparse weights and the historical smoothed weights, and the weighting coefficients are determined by the corresponding smoothing coefficients. Dynamic control. To ensure the sparsity of the output, smoothing of the results is performed. Perform TopK sparse selection (K=2) and normalization again to obtain the final smoothed route weight vector at the current time step. At the initial moment, it can be set Equal to the initial sparse route weights .

[0072] Finally, the output is the electricity price prediction result based on smoothed weights. The resulting smoothed routing weights are then used to calculate the final smoothed routing weights. Compared with the preliminary electricity price forecasts generated by each prediction subnetwork By performing a weighted summation, we obtain the final electricity price forecast result for the system: ,in This is a forecast of electricity prices for the next hour. Let be the smoothed routing weight of the i-th prediction subnetwork at time t. Through the above smoothing mechanism, the continuity of the prediction output is maintained when the system state is stable, and it can be quickly adjusted when the state changes abruptly, effectively improving the engineering stability of the prediction sequence.

[0073] Experimental verification: Experiment 0: The model was trained using only the TCN-LSTM network, and a single model was used for training and prediction.

[0074] Experiment 1: Six experts (sub-networks) were used, and six algorithms were designed and trained for each. The prediction results were then fused according to their weights, without using a complexity vector. The functional parameters of each expert model are compared in Table 1. Table 1 Comparison of Functional Parameters of Various Expert Models

[0075] in, - All fields were used as training fields, and the prediction field y was the real-time clearing electricity price.

[0076] Experiment 2: In Experts added a complexity vector to the training to correct for learning overly high points. All other conditions remained the same as in Experiment 1. The E6 model incorporated One-Hot encoding of the complexity vector during training. The complexity vector is shown in Table 2.

[0077] Table 2 Complexity Vector Table

[0078] Experiment 3: Different fields were used for training with different experts, and the training results were weighted and averaged. The model architecture remained unchanged, and the experts... and Employing a cross-feature attention mechanism and adjusting... , Time step This ensures the correspondence between the Q, K, and V matrices. Table 4 shows a comparison of the parameter fields of the Q, K, and V matrices in the cross-feature attention mechanism. Full-field learning is employed, including a complexity vector for anomaly correction. Other conditions are the same as in Experiment 2. The training fields after adding cross-feature attention are shown in Table 3, and the parameter fields of the Q, K, and V matrices using the cross-attention mechanism are shown in Table 4.

[0079] Table 3. Detailed list of training fields after adding cross-feature attention.

[0080] Table 4 Comparison of parameter fields of Q, K, and V matrices using cross-attention mechanism

[0081] Experiment 4: Based on Experiment 3, a continuous network routing mechanism is introduced and dynamically smoothed by time step. Expert weights are dynamically allocated at each time step, and the two best experts are selected to perform multi-expert model fusion according to their weight ratio. The prediction performance is dynamically optimized by using a gated routing method.

[0082] ; in, The original weights of the experts selected for Top-K. This corresponds to the expert's predicted value. The final integrated prediction result is the output of the prediction field y from Experiment 4. For example: It is 0.39. It is 0.44, after norm The values ​​are 0.39 / 0.83, after norm. The values ​​are 0.44 / 0.83. = 0.39 / 0.83 +0.44 / 0.83 .

[0083] The experimental comparison results are shown in Table 5. From the perspective of parameter design, the dynamic routing mechanism introduced in Experiment 4 achieves the core breakthrough of "on-demand scheduling" in multi-expert systems. Traditional integration methods, such as those in Experiment 1, use fixed weights (…). 0.25 0.30 0.20 0.05 0.05 (0.15) This static allocation essentially assumes that the electricity price fluctuation pattern is consistent across the entire time axis, but actual electricity data exhibits significant time-period heterogeneity—drastic price changes during the morning peak, gradual fluctuations at midday, and stable low prices at night. Fixed weights cannot adapt to this dynamic change and instead generate prediction conflicts among experts when the pattern switches. This is the fundamental reason why MAE increased instead of decreasing in Experiment 1. The dynamic routing in Experiment 4 independently calculates the original weights of the six experts at each time step, activating only the two experts with the highest weights and merging them according to a normalized ratio. This Top-2 sparse activation mechanism has a clear physical meaning: during periods of rapid price drops, such as from 1100 to 300 yuan / MWh, the short window... Wave models and modulation gating with complexity The weights of the outlier model naturally increase because their temporal receptive fields match the scale of abrupt changes; during periods of stable fluctuations, the longer window... Trend models and cycle coding The model takes the lead. The continuous network routing in this application essentially transforms the expert selection problem into a time-series classification problem. Routers automatically learn the expert combinations to be activated under different electricity price modes through training. This allows model parameters to evolve from being shared throughout the entire time to being adaptive across different time periods, greatly improving parameter utilization efficiency. The RMSE in experiments 2 through 4 drops sharply from 0.214 to 0.099, fully demonstrating that the parameter allocation strategy of dynamic routing is more effective in suppressing large biases than fixed weights or complexity vector modulation alone.

[0084] A longitudinal comparison of the model architecture evolution reveals that the performance improvement from Experiment 0 to Experiment 4 clearly demonstrates the contribution and synergistic mechanism of each module. The baseline TCN-LSTM model in Experiment 0 had an R² of only 0.660. This is because while the dilated convolution of TCN can expand the receptive field, the globally shared weights of its convolution kernels cause a smoothing bias at peaks and valleys. Although the 6-sub-network ensemble in Experiment 1 captured electricity price features across multiple time scales (192 / 96 / 32 steps), the R² only improved to 0.702, indicating that simple weighted averaging cannot resolve the prediction phase conflict among experts: when... Already responded to the downward trend When the long-term upward trend is still maintained, the fusion result produces sawtooth fluctuations. Experiment 2, after introducing a complexity vector, saw R² jump to 0.855. The key to this leap lies in the 6-dimensional complexity features (electricity price volatility, range, trend slope, net load change, transition indicator, and constraint strength) providing "time-period state labels" for the E6 anomaly model. This allows the model to distinguish between normal fluctuations and anomalous transitions, thereby activating modulation gating to suppress historical memory weights at abrupt change points. Experiment 3, through... - Assign differentiated feature fields ( Only 5 trend features Only 3 cycle characteristics Focusing on seven fluctuating features and introducing cross-feature attention, the R² was improved to 0.869, confirming the effectiveness of decoupling feature learning and conditional association retrieval. Experiment 4 ultimately surpassed previous experiments with R²=0.928 and RMSE=0.099, proving that dynamic routing can automatically avoid failed experts during mode switching. Its RMSE of 0.099 is 80.8% lower than Experiment 0's 0.517, meaning that this invention almost eliminates the large "order-of-magnitude error" bias common in traditional models.

[0085]

[0086] For example, the prediction results are... Figures 3-7 As shown, the method of this invention achieves a progressively higher fitting accuracy at three key time points in the electricity price sequence: peaks, troughs, and abrupt changes. The core challenge of electricity price forecasting lies in its simultaneous influence by both macroeconomic trends of supply and demand balance and microeconomic disturbances of short-term fluctuations, which traditional methods often struggle to address simultaneously. For example... Figure 3As shown, TCN-LSTM exhibits a significant lag in tracking across the entire timeframe: when the actual electricity price plummeted from 610 yuan / MWh to -80 yuan during the period (March 5th-6th), the prediction curve remained at a high level until it began to decline after 3-4 time steps. This lag stems from the unidirectional information flow mechanism of TCN causal convolution—the convolution kernel can only slide in the forward direction of time. Future electricity price information cannot be propagated back to the current prediction. When electricity prices experience a sharp change due to sudden supply and demand shocks (such as a surge in renewable energy output), the model lacks early warning capabilities and can only rely on a limited historical window for extrapolation, leading to a significant deviation of the predicted value from the actual trajectory. Figure 4 As shown, after introducing a 6-expert weighted integration, the fit of the electricity price curve improved in the stable segment, but a significant over-averaging phenomenon still occurred in the deep V-shaped segment (March 9-10: 300 yuan → -80 yuan → 380 yuan): the predicted valley value exceeded the actual value by about 150 yuan / MWh. The mechanism of this deviation is as follows: The trend model uses a 192-step window to capture long-term price patterns, and still maintains the judgment of an upward trend; while The volatility model, with its 32-step short window, keenly sensed that prices had reached their peak and begun to decline; the predictions of the two models were completely opposite in phase. Experiment 1 used fixed weights ( 0.25 0.30 Using a weighted average of 0.20... essentially forces a reconciliation between two contradictory predictions, resulting in a prediction that cannot fully reflect the actual situation. The rapid decline could not be sustained. The smooth output creates unnecessary spikes at the peak values. For example... Figure 5 As shown, after adding the price jump indicator, this feature identifies price jump events by detecting whether the electricity price exceeds twice the standard deviation of the rolling window. During periods of sudden price changes, the jump indicator is activated. The model's modulation gating automatically reduces the weights for remembering historical highs, significantly reducing overshoot error in the abrupt change phase. However, a slight shift still exists in the continuous bimodal structure. This is because the complexity vector provides a switching signal for anomalies, but fails to address the issue of which general model to use as a replacement. Figure 6 As shown, after introducing a cross-feature attention mechanism, The model uses trend features (price moving average, yesterday's price, price lag of 24 steps, etc.) as the query matrix and supply and demand features (net load, reserve capacity, hydropower output, etc.) as the key / value matrix, enabling the model to dynamically retrieve historical supply and demand scenarios similar to the current price pattern. When electricity prices are transitioning from the first peak to the second peak in a bimodal structure, the attention weight automatically focuses on similar historical "post-peak rebound" samples, resulting in a significantly tighter fit of the curve in multi-peak segments. However, Attention retrieval is still a soft-weighted method and cannot completely eliminate interference from irrelevant historical samples. For example... Figure 7 As shown, the predicted curve almost perfectly overlaps with the actual electricity price curve. The continuous network routing method of this invention dynamically calculates the original weights of six experts at each time step based on the current input characteristics, activating only the two experts with the highest weights and merging them according to a normalized ratio. When the router detects that the electricity price has entered a period of rapid fluctuation through the net load change rate, it automatically... (Volatility Model) and The weights of the (abnormal model) are increased, enabling the prediction to closely follow the true trajectory of the steep sequence; when the electricity price enters a stable phase, the router switches back. (Trend Model) and The slow-varying prediction dominated by the (periodic model) avoids short-term noise interference with normal output. This mechanism fundamentally solves the expert conflict problem of fixed weights during mode switching in Experiment 1, and also makes up for the shortcomings of soft weighting in expert selection in Experiments 2 and 3, which cannot completely eliminate the interference of irrelevant historical samples. Compared with the limitation of cross-feature attention mechanism in Experiment 3, which still cannot completely eliminate the interference of irrelevant historical samples, the continuous network routing mechanism in Experiment 4 dynamically selects the best Top-2 experts at each time step and hard-fuses them according to the weight ratio. This enables the prediction curve to achieve a qualitative leap from smooth approximation to close tracking at the peak-valley abrupt change. It fundamentally solves the phase conflict and fusion failure problems of traditional methods during mode switching. Although there is an error of 15-30 yuan / MWh in the prediction of individual high points, the overall prediction pattern is optimal and can better fit the curve pattern in 93% of the data. Moreover, all indicators are the best compared with other algorithms, thus demonstrating that the method of this invention has the best comprehensive electricity price prediction performance.

[0087] Example 2: A power price forecasting system based on state-aware and hybrid forecasting networks. This system is used to implement the power price forecasting method based on state-aware and hybrid forecasting networks described in Example 1, such as... Figure 8 As shown, it includes a feature construction module, a vector construction module, a feature fusion module, a hybrid prediction module, and a final prediction module.

[0088] The system comprises the following modules: a feature construction module for building multi-scale input features based on acquired multi-source power time-series data; a vector construction module for constructing a complexity vector representing the current power market operating status based on historical electricity price sequences and load data; a feature fusion module for interacting with multi-scale input features through a cross-feature attention mechanism and using a task-adaptive network to modulate the interacted features based on the complexity vector and the market status determined by it, resulting in a task-adaptive fused feature representation; and a hybrid prediction module for inputting the fused feature representation into a sparse hybrid prediction network. The prediction network comprises multiple structurally distinct prediction subnetworks and a gating network. The gating network generates sparse routing weights based on the fusion feature representation, complexity vector, and the historical operating states of each prediction subnetwork to select and activate at least one prediction subnetwork. The activated prediction subnetwork then generates a preliminary electricity price prediction result. The final prediction module smooths the sparse routing weights between the current and previous time steps based on the changes in the complexity vector and the changes in the historical operating states of each prediction subnetwork between adjacent time steps. Based on the smoothed routing weights, the module weights the preliminary electricity price prediction result and outputs the final electricity price prediction result.

[0089] Working principle: This invention explicitly quantifies and represents the market state by constructing a complexity vector. The complexity vector serves as a unified state perceptron, which runs through and modulates subsequent cross-feature attention fusion, feature recalibration of the task adaptive network, gated routing of the hybrid prediction network, and the final routing smoothing decision. This makes the model no longer a static, fixed structure, but can dynamically adjust its internal feature focus, sub-network combination weights, and output time smoothing inertia according to different market states such as stability, fluctuation, and anomalies. This solves the technical problem in existing technologies where a single model is difficult to adapt to changing market states and where prediction errors are amplified during state transitions. It improves the overall robustness and scenario adaptability of the electricity price prediction model in complex and volatile market environments.

[0090] 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.

[0091] 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.

[0092] 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.

[0093] 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.

[0094] 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 electricity price forecasting based on state-aware and hybrid prediction networks, characterized in that, Includes the following steps: Multi-scale input features are constructed based on the acquired multi-source power time-series data; Based on historical electricity price sequences and load data, a complexity vector is constructed to characterize the current operating status of the electricity market. Based on the multi-scale input features, feature interaction is performed through a cross-feature attention mechanism, and a task-adaptive network is used to modulate the interacted features with the complexity vector and the market state determined by it as conditions, so as to obtain a task-adaptive fusion feature representation. The fused feature representation is input into a sparse hybrid prediction network, which includes multiple prediction subnetworks with different structures and a gating network. The gating network generates sparse routing weights based on the fused feature representation, the complexity vector, and the historical operating state of each prediction subnetwork to select and activate at least one prediction subnetwork, and the activated prediction subnetwork generates a preliminary electricity price prediction result. Based on the changes in the complexity vector at adjacent time points and the changes in the historical operating status of each prediction sub-network at adjacent time points, the sparse routing weights at the current time point and the previous time point are smoothed, and the preliminary electricity price prediction results are weighted based on the smoothed routing weights to output the final electricity price prediction results.

2. The electricity price forecasting method based on state-aware and hybrid prediction networks according to claim 1, characterized in that, The construction of the complexity vector used to characterize the current operating state of the electricity market includes: Calculate the current moment's electricity price volatility characteristics, electricity price range characteristics, electricity price trend slope characteristics, net load change characteristics, price jump indication characteristics, and constraint strength indication characteristics; The electricity price volatility feature, the electricity price range feature, the electricity price trend slope feature, and the net load change feature are normalized based on training set statistics. The normalized electricity price volatility feature, electricity price range feature, electricity price trend slope feature, and net load change feature are concatenated with the price jump indicator feature and the constraint strength indicator feature to obtain a six-dimensional complexity vector.

3. The electricity price forecasting method based on state-aware and hybrid prediction networks according to claim 2, characterized in that, The method also includes: Calculate the overall complexity score based on the complexity vector; Based on the comprehensive complexity score, the price transition indication feature, and the constraint strength indication feature, the current market state is determined to be a stable state, a fluctuating state, or an abnormal state, and the market state is encoded as a one-hot vector.

4. The electricity price forecasting method based on state-aware and hybrid prediction networks according to claim 3, characterized in that, The process of using a task-adaptive network to modulate the features after interaction, based on the complexity vector and the market state determined by it, includes: The interactive features are averaged over time to obtain pooled features. The pooled features, the complexity vector, and the one-hot vector are concatenated to obtain the task context vector. The task context vector is input into the task adaptive network, and the task adaptive network outputs a one-channel modulation vector. The channel modulation vector is used to perform channel-by-channel scaling modulation on the interactive features.

5. The electricity price forecasting method based on state-aware and hybrid prediction networks according to claim 1, characterized in that, The gated network generates sparse routing weights based on the fused feature representation, the complexity vector, and the historical operating states of each prediction sub-network, including: For each predicted subnetwork, calculate its activation frequency, average routing load, and output stability within the most recent predetermined time window, and construct a subnetwork state vector based on the activation frequency, average routing load, and output stability of all predicted subnetworks. The fused feature representation is averaged in the time dimension to obtain the first pooled feature vector. The first pooling feature vector, the complexity vector, and the sub-network state vector are concatenated to obtain the gating network input vector; The gating network input vector is input into the gating network to obtain the original routing weight vector; The original routing weight vector is subjected to TopK sparse selection and normalization processing to obtain the sparse routing weights.

6. The electricity price forecasting method based on state-aware and hybrid prediction networks according to claim 1, characterized in that, The smoothing process for the sparse routing weights between the current and previous time steps, based on the changes in the complexity vector and the changes in the historical operating states of each predicted sub-network between adjacent time steps, includes: Calculate the average of the absolute values ​​of the differences in each dimension between the complexity vector at the current time step and the complexity vector at the previous time step, and use this as the change in complexity. Calculate the Euclidean distance between the current subnetwork state vector and the previous subnetwork state vector, and use it as the subnetwork state change. The fused feature representation is then subjected to global average pooling in the time dimension to obtain a second pooled feature vector. The second pooling feature vector, the complexity vector, the complexity change, and the sub-network state change are concatenated to obtain the smoothing control input vector; The smoothing control input vector is input into a smoothing control network to obtain a smoothing coefficient vector; Based on the change in complexity and the change in the state of the sub-network, determine the smooth region at the current moment; Based on the smoothed region, constraints are applied to the smoothing coefficient vector to obtain the final smoothing coefficient vector; Using the final smoothing coefficient vector, the sparse route weights at the current time are weighted and smoothed together with the smoothed route weights at the previous time. The TopK sparse selection and normalization are then performed on the weighted smoothed result to obtain the smoothed route weights at the current time.

7. The electricity price prediction method based on state-aware and hybrid prediction networks according to claim 6, characterized in that, Determining the smooth region at the current moment based on the change in complexity and the change in the sub-network state includes: If the change in complexity is less than the first complexity threshold and the change in the state of the sub-network is less than the first state threshold, then it is determined to be a continuous preservation region; If the change in complexity is not less than the first complexity threshold and less than the second complexity threshold, or if the change in the sub-network state is not less than the first state threshold and less than the second state threshold, then it is determined to be a transition zone. If the change in complexity is not less than the second complexity threshold, or the change in the sub-network state is not less than the second state threshold, then it is determined to be a fast update region.

8. The electricity price prediction method based on state-aware and hybrid prediction networks according to claim 7, characterized in that, The step of applying constraints to the smoothing coefficient vector based on the smoothing region includes: In the continuous holding region, smoothing is performed according to the smoothing coefficient vector output by the smoothing control network; In the transition region, the lower limit of each element in the smoothing coefficient vector is constrained to a preset transition threshold. In the fast update region, the smoothing coefficient vector is set to an all-1 vector.

9. The electricity price forecasting method based on state-aware and hybrid prediction networks according to claim 1, characterized in that, The multiple prediction subnetworks in the sparse hybrid prediction network include: The trend prediction subnetwork is configured to use inputs with extended time lengths and employs a self-attention mechanism to model medium- to long-term electricity price trends. The periodic prediction subnetwork is configured to introduce periodic position encoding and use a self-attention mechanism to model the intraday and cross-day periodic patterns of electricity prices; The fluctuation prediction subnetwork is configured to use inputs with shortened time lengths and employs a convolutional neural network with a local attention mechanism to model high-frequency fluctuations in electricity prices. The supply and demand forecasting subnetwork is configured to use a cross-attention mechanism to model the coupling relationship between electricity price characteristics and supply and demand characteristics; The external disturbance prediction subnetwork is configured to use a cross-attention mechanism to model the dynamic relationship between electricity price features and external disturbance features; An abnormal scene prediction subnetwork is configured to introduce a modulation vector based on the complexity vector and the market state to modulate the input features, and to use a self-attention mechanism to handle extreme scenes.

10. A power price forecasting system based on state-awareness and hybrid forecasting networks, characterized in that, include: The feature construction module is used to construct multi-scale input features based on the acquired multi-source power time-series data; The vector construction module is used to construct a complexity vector representing the current operating status of the electricity market based on historical electricity price sequences and load data. The feature fusion module is used to perform feature interaction through a cross-feature attention mechanism based on the multi-scale input features, and to use a task-adaptive network to modulate the interacted features with the complexity vector and the market state determined by it, so as to obtain a task-adaptive fused feature representation. A hybrid prediction module is used to input the fused feature representation into a sparse hybrid prediction network. The sparse hybrid prediction network includes multiple prediction sub-networks with different structures and a gating network. The gating network generates sparse routing weights based on the fused feature representation, the complexity vector, and the historical operating state of each prediction sub-network to select and activate at least one prediction sub-network, and the activated prediction sub-network generates a preliminary electricity price prediction result. The final prediction module is used to smooth the sparse routing weights of the current time and the previous time based on the change of the complexity vector in adjacent time and the change of the historical operating status of each prediction sub-network in adjacent time, and to weight the preliminary electricity price prediction result based on the smoothed routing weights, and output the final electricity price prediction result.