A multi-task power market price prediction method, system, device and medium based on multi-scale convolution and Transformer coding
Patent Information
- Application Number
- CN202610603394.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-06
- Publication Date
- 2026-09-18
AI Technical Summary
[0006]因此,本发明所要解决的问题在于如何解决现有循环神经网络在处理含长周期结构的电价时间序列时,因序列递归计算导致的训练并行化效率低下及信息稀释问题;现有单任务电价预测模型因忽视价格趋势方向和波动强度等结构化信息,致使模型对训练数据噪声产生过度拟合的问题
[0017] The beneficial effects of this invention are as follows: Through a multi-granularity local temporal perception stage, this invention uses parallel multi-scale depth-separable convolutions to simultaneously perceive the short-term oscillations, medium-term trends, and long-term cyclical components of the electricity price sequence, overcoming the problem that a single receptive field convolution cannot simultaneously consider local structures at different time granularities. The subsequent two-dimensional saliency calibration stage uses a cascaded weighted approach of channel attention and time step attention to dynamically focus on the input variables most relevant to the current market state in the feature dimension, and highlight key historical moments with judgmental value for electricity price trends in the time dimension, thereby increasing the information density of the input in the subsequent encoding stage. The Transformer encoder models the dependencies between all time steps in parallel across the entire sequence, avoiding the problem of long-distance information attenuation caused by the recursive transmission of hidden states in recurrent neural networks, and stably capturing long-range structural correlations such as cross-day cycles. In the final multi-dimensional price behavior joint prediction stage, two auxiliary tasks, direction classification and volatility prediction, are introduced. Structured regularization constraints are applied to the shared parameters to improve the overfitting tendency of the main regression task to training noise. Without increasing inference costs, the invention simultaneously outputs point prediction values, trend direction probabilities, and uncertainty measures, meeting the actual needs of market participants for multi-dimensional decision-making.
Smart Images

Figure CN122779903A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of electricity market price forecasting technology, and in particular to a multi-task electricity market price forecasting method, system, device and medium based on multi-scale convolution and Transformer coding. Background Technology
[0002] In an open electricity market, accurate day-ahead price forecasts are crucial for power generation companies, electricity retailers, and large users to make bidding decisions, manage risks, and plan operations. Electricity price time series typically exhibit high nonlinearity, volatility, and multiple cyclical characteristics, and are influenced by a multitude of complex factors such as load, renewable energy output, and fuel prices, making accurate forecasting extremely challenging.
[0003] Traditional prediction methods, such as time series models and shallow machine learning models (support vector machines, random forests), have limited representational capabilities when dealing with such high-dimensional nonlinear dynamic systems. In recent years, deep recurrent neural networks, represented by long short-term memory networks and gated recurrent units, have been widely introduced. However, their sequential recursive computation mode has two inherent limitations: first, the training process cannot be fully parallelized, leading to low computational efficiency when dealing with long sequences; second, their mechanism of gradually passing hidden states is prone to information dilution or gradient vanishing when facing the long-term dependence of electricity prices in the electricity market, making it difficult to effectively model long-distance structural correlations.
[0004] Furthermore, most existing research focuses on single-point prediction tasks, improving numerical accuracy by optimizing metrics such as mean squared error. This approach ignores the rich structured information contained in electricity price data, such as price trends and fluctuation patterns. A single regression objective can easily lead to the model overfitting the noise of the training data, making it difficult to simultaneously meet the dual requirements of prediction accuracy and robustness in the actual electricity market. Summary of the Invention
[0005] In view of the problems existing in the prior art, the present invention is proposed.
[0006] Therefore, the problem to be solved by this invention is how to address the low training parallelization efficiency and information dilution caused by recursive calculations of electricity price time series with long periodic structures in existing recurrent neural networks; and the problem that existing single-task electricity price prediction models overfit to training data noise because they ignore structured information such as price trend direction and fluctuation intensity.
[0007] To solve the above-mentioned technical problems, the present invention provides the following technical solution: In a first aspect, embodiments of the present invention provide a multi-task electricity market price prediction method based on multi-scale convolution and Transformer coding, which includes: acquiring multi-dimensional time series data of the electricity market, preprocessing it to construct time series training samples, performing multi-granularity local time series perception on the time series training samples, and extracting local time series structure features of the electricity price sequence from multiple time granularities. The local temporal structure features are sequentially weighted by channel dimension significance and time step dimension significance to obtain calibration features. The calibration features are then input into the Transformer encoder to establish global long-range temporal dependencies and obtain a global context representation of electricity price. Based on the global context representation of electricity prices, multi-dimensional price behavior joint prediction is performed, and the predicted value of electricity price points, the probability distribution of price trend direction, and the intensity of price fluctuations are output simultaneously. The losses corresponding to the three predicted outputs are summed with preset weights, and the parameters of each stage are updated collaboratively through backpropagation to obtain the electricity price prediction result.
[0008] As a preferred embodiment of the multi-task electricity market price prediction method based on multi-scale convolution and Transformer coding described in this invention, the multi-granularity local temporal perception includes setting multiple parallel convolution branches with different receptive field scales, each convolution branch sensing the local structural components corresponding to short-term oscillations, medium-term trends and long-term cycles in the electricity price sequence. The outputs of each branch are processed by nonlinear activation and then concatenated along the feature dimension. The spliced multi-scale features are then compressed and fused through channels to obtain unified local temporal structure features.
[0009] As a preferred embodiment of the multi-task electricity market price prediction method based on multi-scale convolution and Transformer coding described in this invention, wherein: the channel dimension saliency weighting and time step dimension saliency weighting include, channel dimension saliency weighting: global statistical compression of local temporal structure features along the time axis, generating importance weights for each channel through multi-layer transformation, and multiplying the weights with the local temporal structure features channel by channel to obtain channel calibration features; Time step dimension significance weighting: Linear projection is performed on the channel calibration features, and the importance weight of each time step is obtained by calculating the correlation between each time step. The time step calibration features are obtained after weighted aggregation. The calibration features are obtained by fusing the channel calibration features with the time step calibration features.
[0010] As a preferred embodiment of the multi-task electricity market price prediction method based on multi-scale convolution and Transformer coding described in this invention, wherein: the step of inputting calibration features into the Transformer encoder to establish global long-range temporal dependencies and obtain global context representation of electricity prices includes: linearly projecting the calibration features and superimposing position encoding, and introducing the position information of each time step in the sequence into the feature representation. The features after superimposed position encoding are processed sequentially through multiple encoding layers. Each layer performs global temporal relationship modeling and feature nonlinear transformation, and the stability of information transmission is maintained through residual connections. The output vector corresponding to the last time step in the final coding layer is extracted as a global context representation of electricity prices representing the entire historical sequence.
[0011] As a preferred embodiment of the multi-task electricity market price prediction method based on multi-scale convolution and Transformer coding described in this invention, the multi-dimensional price behavior joint prediction includes three dedicated prediction branches that share the global context representation of electricity prices. The main regression prediction branch outputs a continuous scalar through a fully connected layer as the predicted value of the electricity price at future time points. The directional classification prediction branch outputs a three-dimensional probability vector through a fully connected layer and a normalized exponential function, which corresponds to the probability that the future electricity price will rise, remain flat, or fall relative to the current time. The volatility prediction branch outputs a positive scalar through a fully connected layer and a positive activation function, which serves as a prediction of the volatility intensity of future electricity prices. The three prediction branches infer in parallel and each outputs its prediction result independently.
[0012] As a preferred embodiment of the multi-task electricity market price prediction method based on multi-scale convolution and Transformer coding described in this invention, the step of summing the losses corresponding to the three prediction outputs with preset weights and updating the parameters of each stage through backpropagation includes calculating the Huber loss of the main regression prediction branch, the cross-entropy loss of the directional classification prediction branch, and the mean squared error loss of the volatility prediction branch, respectively. The three losses are weighted and summed with preset weight coefficients to construct a multi-task joint loss. The weight coefficients are determined by cross-validation on the validation set. With multi-task joint loss as the optimization objective, the gradient signals of the three prediction branches are synchronously transmitted to the generation stage of the global context representation of electricity price through backpropagation, and all stage parameters are updated collaboratively. Among them, the training signals of the directional classification prediction branch and the volatility prediction branch apply regularization constraints to the shared parameters, thereby suppressing the overfitting of the main regression prediction branch to the training sample noise.
[0013] As a preferred embodiment of the multi-task electricity market price prediction method based on multi-scale convolution and Transformer coding described in this invention, the method includes: acquiring multi-dimensional time series data of the electricity market, performing preprocessing, and labeling each time series sample with the true value of electricity price, the category label of price trend direction, and the true value of price volatility, thereby constructing a multi-task labeled training dataset. A multi-task prediction model is constructed. The network structure of the multi-task prediction model sequentially includes a multi-granularity local feature extraction layer, a two-dimensional saliency calibration layer, a Transformer encoding layer, and a multi-dimensional price behavior joint prediction layer. Input the multi-task labeled training dataset into the multi-task prediction model, and calculate the Huber loss of the main regression prediction branch, the cross-entropy loss of the directional classification prediction branch, and the mean squared error loss of the volatility prediction branch, respectively. The three losses are weighted and summed with preset weight coefficients to obtain the multi-task joint loss. All parameters in the multi-task prediction model are then updated collaboratively using the multi-task joint loss through backpropagation. The convergence status of the multi-task joint loss is monitored on the validation set, and the weight coefficients are iteratively adjusted until the model converges, thus obtaining the trained multi-task electricity price prediction model.
[0014] Secondly, embodiments of the present invention provide a multi-task electricity market price prediction system based on multi-scale convolution and Transformer coding, which includes a data preprocessing module for acquiring and preprocessing multi-dimensional time series data of the electricity market, constructing time series training samples, and performing multi-granularity local time series perception on the time series training samples to extract local time series structural features of the electricity price sequence from multiple time granularities. The two-dimensional saliency calibration module is used to sequentially perform channel-dimensional saliency weighting and time-step-dimensional saliency weighting on local temporal structure features to obtain calibration features; The global dependency modeling module is used to process calibration features through a Transformer encoder to establish global long-range temporal dependencies and obtain a global context representation of electricity prices. The multi-dimensional price behavior joint prediction module is used to output the predicted value of electricity price points, the probability distribution of price trend direction, and the intensity of price fluctuation through three dedicated prediction branches, based on the global context representation of electricity prices. The joint optimization module is used to sum the losses corresponding to the three prediction outputs in a weighted manner and perform backpropagation to collaboratively update the parameters at each stage and obtain the electricity price prediction results.
[0015] Thirdly, embodiments of the present invention provide a computer device, including a memory and a processor, wherein the memory stores a computer program, wherein: when the computer program instructions are executed by the processor, they implement the steps of the multi-task electricity market price prediction method based on multi-scale convolution and Transformer encoding as described in the first aspect of the present invention.
[0016] Fourthly, embodiments of the present invention provide a computer-readable storage medium having a computer program stored thereon, wherein: when the computer program instructions are executed by a processor, they implement the steps of the multi-task electricity market price prediction method based on multi-scale convolution and Transformer coding as described in the first aspect of the present invention.
[0017] The beneficial effects of this invention are as follows: Through a multi-granularity local temporal perception stage, this invention uses parallel multi-scale depth-separable convolutions to simultaneously perceive the short-term oscillations, medium-term trends, and long-term cyclical components of the electricity price sequence, overcoming the problem that a single receptive field convolution cannot simultaneously consider local structures at different time granularities. The subsequent two-dimensional saliency calibration stage uses a cascaded weighted approach of channel attention and time step attention to dynamically focus on the input variables most relevant to the current market state in the feature dimension, and highlight key historical moments with judgmental value for electricity price trends in the time dimension, thereby increasing the information density of the input in the subsequent encoding stage. The Transformer encoder models the dependencies between all time steps in parallel across the entire sequence, avoiding the problem of long-distance information attenuation caused by the recursive transmission of hidden states in recurrent neural networks, and stably capturing long-range structural correlations such as cross-day cycles. In the final multi-dimensional price behavior joint prediction stage, two auxiliary tasks, direction classification and volatility prediction, are introduced. Structured regularization constraints are applied to the shared parameters to improve the overfitting tendency of the main regression task to training noise. Without increasing inference costs, the invention simultaneously outputs point prediction values, trend direction probabilities, and uncertainty measures, meeting the actual needs of market participants for multi-dimensional decision-making. Attached Figure Description
[0018] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 A flowchart of a multi-task electricity market price forecasting method based on multi-scale convolution and Transformer encoding; Figure 2 A computer setup diagram for a multi-task electricity market price forecasting method based on multi-scale convolution and Transformer encoding; Figure 3 A schematic diagram of a multi-task learning model framework for a multi-task electricity market price prediction method based on multi-scale convolution and Transformer encoding; Figure 4 A comparative analysis diagram of the performance of nine prediction methods for multi-task electricity market price prediction based on multi-scale convolution and Transformer encoding is provided. Detailed Implementation
[0020] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0021] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.
[0022] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The phrase "in one embodiment" appearing in different places in this specification does not necessarily refer to the same embodiment, nor is it a single or selective embodiment that is mutually exclusive with other embodiments.
[0023] Example 1 Reference Figure 1 This is the first embodiment of the present invention, which provides a multi-task electricity market price prediction method based on multi-scale convolution and Transformer encoding, including: S100: After acquiring multi-dimensional time series data of the electricity market and preprocessing it, construct time series training samples, perform multi-granularity local time series perception on the time series training samples, and extract local time series structural features of the electricity price series from multiple time granularities.
[0024] S200: The local time-series structural features are sequentially weighted by channel dimension significance and time step dimension significance to obtain calibration features. The calibration features are then input into the Transformer encoder to establish global long-range time-series dependencies and obtain the global context representation of electricity price.
[0025] S300: Based on the global context representation of electricity prices, it performs multi-dimensional joint prediction of price behavior and simultaneously outputs the predicted value of electricity price points, the probability distribution of price trend direction, and the intensity of price fluctuations.
[0026] S400: The losses corresponding to the three prediction outputs are summed with preset weights, and the parameters of each stage are updated collaboratively through backpropagation to obtain the electricity price prediction result.
[0027] It should be noted that the day-ahead electricity price time series of the electricity market contains structural components of multiple scales, such as short-term oscillations, intraday trends, and cross-day cycles. A convolutional kernel with a single receptive field cannot simultaneously perceive the local features of different granularities in a single forward calculation. While recurrent structures, such as Long Short-Term Memory networks, can process sequence inputs, their recursive calculation method causes the dependencies between distant time steps to gradually weaken as the sequence deepens, making it difficult to stably model the cross-day cycle correlation of electricity prices.
[0028] By extracting multi-scale local structural features from the original sequence through multi-granularity local temporal perception, and then performing dual weighted calibration of the channel dimension and time step dimension, the feature channels and key time positions that are valuable for judging the electricity price trend are highlighted. Subsequently, the Transformer encoder establishes the global dependency relationship between time steps in the entire sequence. Finally, the electricity price point value, the probability of rise and fall direction and volatility are output synchronously through three parallel prediction branches. The parameter update is driven by multi-task joint loss, so that the training signals of the two auxiliary tasks of direction and volatility form a regularization constraint on the shared parameters, reducing the fitting degree of the main regression branch to the noise of the training samples. Thus, without introducing additional inference costs, the prediction accuracy and the generalization ability in the face of market structure changes are improved simultaneously.
[0029] Example 2 Reference Figure 1 - Figure 4 This is the second embodiment of the present invention.
[0030] In this embodiment, step S100 involves acquiring multi-dimensional time series data of the electricity market, preprocessing it to construct time series training samples, performing multi-granularity local time series perception on the time series training samples, and extracting local time series structural features of the electricity price series from multiple time granularities. This includes the following A1 steps: A1: Multi-granularity local temporal perception includes setting up multiple parallel convolutional branches with different receptive field scales. Each convolutional branch perceives the local structural components corresponding to short-term oscillations, medium-term trends, and long-term cycles in the electricity price sequence. The outputs of each branch are processed by nonlinear activation and then concatenated along the feature dimension. The spliced multi-scale features are then compressed and fused through channels to obtain unified local temporal structure features.
[0031] This embodiment is based on the hourly day-ahead clearing electricity price data of the German electricity market for the entire year of 2019. The dataset contains 8760 hourly samples, with 13 input feature dimensions and the target variable being the day-ahead clearing electricity price. The 13 input features cover: actual load, solar power generation, solar power generation curve, total wind power generation, wind power generation curve, offshore wind power generation, offshore wind power generation curve, onshore wind power generation, onshore wind power generation curve, dry-bulb temperature, dew point temperature, wet-bulb temperature, and humidity. All of these features are aligned with the target electricity price at an hourly granularity, forming a multivariate time series input.
[0032] Specifically, the data cleaning phase first addresses the issue of missing values. Sample rows containing null values are directly deleted. The missing value ratio in the original 8760 hours of data is approximately 0.3%, and the impact on the overall dataset coverage after deletion is within an acceptable range, ensuring the stability of the subsequent deep learning model training process. Negative values appearing in the target electricity price sequence are considered normal market phenomena in the German electricity market under conditions of high renewable energy penetration and are retained. For outliers in the input features, a standard deviation threshold method is used, with a range of three standard deviations above and below the mean as the normal range. Feature values exceeding this range are replaced with corresponding boundary values to avoid extreme anomalies interfering with model parameter optimization.
[0033] Specifically, the feature engineering phase constructs three types of derived features to enhance the model's ability to perceive dynamic patterns in electricity prices. The first type is time features, which use sine and cosine functions to periodically encode hourly indices. This allows the model to perceive the continuity of adjacent time points and the similarity of the same hour on different days in the feature space, with the encoding dimension fixed at 2 dimensions, independent of the dataset's time span. The second type is price lag features, including 1-hour lag features. With 24-hour lag characteristics The former captures the short-term autocorrelation of electricity prices, while the latter captures daily cyclical patterns. The third category is moving statistical features, which calculate the moving mean and moving standard deviation over the past 24-hour window. The moving mean reflects the recent price equilibrium level, and the moving standard deviation reflects the recent price volatility; both provide the model with dynamic contextual information about the current market state. Let the sample time index be ( The electricity price at time t is The electricity price at the previous moment was p(t-1), and the electricity price at the same moment the previous day was... The calculation method for the moving average over the past 24 hours: How to calculate moving standard deviation: Specifically, in the data standardization stage, Z-score standardization is performed on all features and the target electricity price (Z-score standardization is a linear transformation method that maps data to zero mean and unit variance). For the input feature matrix X (dimension is the number of samples m × the number of features n), for each column of feature j, the mean is calculated based solely on the training set samples. : in, It is the sample size. For sample index.
[0034] with standard deviation : Then, the corresponding feature values of each sample are standardized to obtain... : in, These are the standardized feature values.
[0035] The mean and standard deviation are calculated uniformly from the training set, and the same parameters are reused in both the validation and test sets to avoid data leakage. The target electricity price is standardized simultaneously to ensure that the gradient optimization process is carried out within a reasonable numerical range. The dataset is divided chronologically: the first 80% (approximately 7000 hours) is the training set, the middle 10% (approximately 870 hours) is the validation set, and the last 10% (approximately 870 hours) is the test set.
[0036] Specifically, set the history window length. Hourly, predicted step size Hours. For each point in time. Construct a training sample: the input is the feature sequence of the past 24 hours. The output is the standardized electricity price for the next hour. The dataset is divided into three parts in chronological order: training set (first 80%, approximately 7000 hours), validation set (middle 10%, approximately 870 hours), and test set (last 10%, approximately 870 hours). A large number of ordered input-output sample pairs are generated on the training set using a sliding window, with the time steps between samples moving sequentially without overlap, strictly following the temporal causal relationship.
[0037] Specifically, the multi-granularity local temporal perception stage first maps the 13-dimensional original features to a 64-dimensional hidden space through an input projection layer, providing a unified representation basis for subsequent multi-scale convolutional operations in terms of feature dimensions. Projection operation: in, The projected features The projection weight matrix is... This is the bias vector.
[0038] The multi-scale depthwise separable-convolution module (a lightweight design that breaks down standard convolution into depthwise convolution and pointwise convolution) contains three parallel convolutional branches. The kernel sizes correspond to three temporal granularities: short-term (e.g., 3 time steps), medium-term (e.g., 7 time steps), and long-term (e.g., 14 time steps). For the input feature F (dimensions of batch size B × sequence length T × feature dimension d), the depthwise separable-convolution operation within each branch is as follows: in, For core size Depth-separable convolutions with the number of input channels equal to the number of input channels. For batch size, For sequence length, For feature dimensions, simultaneously output For the same input , respectively Depth-separable convolution After completion, you will get three feature maps. The three convolutional branches sense the local structural components of the electricity price sequence at different time scales. The small convolutional kernel corresponds to short-term fluctuation characteristics, while the large convolutional kernel corresponds to gradual trends and cross-day cycle characteristics, so that local information at each scale can be explicitly modeled.
[0039] Each branch output is activated by a Gaussian Error Linear Unit (GELU, a smooth nonlinear activation function). The calculation method of the GELU activation function is as follows: in, It is the input (scalar or tensor element). It is the cumulative distribution function of the standard normal distribution. It is generally approximated as: in, Let the error function be the formula: Its approximate expression is: The three activated feature maps are concatenated along the feature dimension. The concatenation operation is as follows: The resulting multi-scale features are expanded to 64×3=192. Subsequently, channel compression and fusion are performed on the multi-scale features using pointwise convolution (1×1 convolution). The fusion operation is as follows: The output dimension is reduced back to 64 dimensions, resulting in unified local temporal structure features. The weight parameters of the pointwise convolution adaptively learn during training, determining the optimal combination ratio of features at different scales. In stable market phases, it tends to assign higher weights to long-term trend features, while in phases of sharp price fluctuations, it aggregates more short-term fluctuation features.
[0040] In this embodiment, step S200 sequentially performs channel-dimensional saliency weighting and time-step-dimensional saliency weighting on the local temporal structure features to obtain calibration features. The calibration features are then input into the Transformer encoder to establish global long-range temporal dependencies and obtain a global context representation of electricity prices. This includes the following step B1: B1: Channel dimension saliency weighting and time step dimension saliency weighting include, channel dimension saliency weighting: global statistical compression of local temporal structure features along the time axis, multi-level transformation to generate importance weights for each channel, and multiplying the weights with the local temporal structure features channel by channel to obtain channel calibration features; Time step dimension significance weighting: Linear projection is performed on the channel calibration features, and the importance weight of each time step is obtained by calculating the correlation between each time step. The time step calibration features are obtained after weighted aggregation. The calibration features are obtained by fusing the channel calibration features with the time step calibration features.
[0041] Specifically, channel saliency weighting is implemented using a Squeeze-and-Excitation Network (SE network, an attention structure that adaptively models the importance of feature channels). Taking local temporal structure features (dimension B×T×64) as input, global average pooling is first performed along the time axis T, compressing the 24 time-step activation values of each feature channel into a single scalar to generate a channel descriptor z (dimension B×64). Pooling operation: in, This is the compressed channel descriptor, with the following shape: Each element represents the average activation intensity of the corresponding channel across all time steps.
[0042] The channel descriptor z generates channel importance weights through a gating network consisting of two fully connected layers. The first fully connected layer compresses z from 64 dimensions to 64 / r dimensions (compression ratio r=4, i.e., compressed to 16 dimensions), and then activates it with a Rectified Linear Unit (ReLU) function for dimensionality reduction. in, Compression ratio .
[0043] The second fully connected layer upscales the intermediate features to 64 dimensions, and the weights are constrained to the (0,1) interval by the Sigmoid function. Dimensional upscaling and activation operations: in , for The function outputs a channel weight vector s (dimension B×64). The channel weights s are multiplied channel by channel by the original features to complete channel recalibration, yielding the channel-calibrated features. in, This represents the features resulting from the splicing and fusion of the aforementioned features. Indicates channel weight, This indicates that each item is multiplied sequentially. Through channel attention weighting, the weight of load-related feature channels automatically increases during peak load periods; and the weight of wind power feature channels automatically increases during periods of high wind power output. The model thus achieves dynamic focusing on the feature channels most relevant to the current market state.
[0044] Specifically, the saliency weighting of the time step dimension is implemented through a multi-head self-attention mechanism. Taking channel-calibrated features as input, it is first processed through three sets of linear projection matrices. The channel calibration features are mapped to a query matrix Q, a key matrix K, and a value matrix V, respectively. Projection operation: in, Let H be the learnable projection matrix. Assume the number of attention heads H = 8, and the feature dimension d of the key vector for each attention head is... k =64 / 8=8. Calculation of attention weight matrix A: in, Let be the dimension of the key vector. Scaling factor The normalized exponential function is represented by the following formula: Output time-attention-weighted features. The value at position (i,j) in the attention matrix A (dimension T×T) encodes the importance of time step j to the prediction of time step i, reflecting various time series patterns such as daily cycle correlation (high correlation between time steps every 24 hours), short-term continuity (high correlation between adjacent time steps), and the propagation effect of special events.
[0045] The multi-head mechanism performs the above calculations on H=8 parallel attention heads, each head independently capturing different types of temporal dependencies. The outputs of the eight heads are then concatenated along the feature dimensions and mapped back to 64 dimensions via the output projection matrix, ultimately obtaining the time-step calibration features. The channel calibration features are added to and fused with the time-step calibration features to obtain calibration features that simultaneously contain saliency information from both the channel and time-step dimensions, serving as input to the subsequent Transformer encoder.
[0046] In this embodiment, step S300 performs multi-dimensional joint prediction of price behavior based on the global context representation of electricity prices, and simultaneously outputs the predicted value of electricity price points, the probability distribution of price trend direction, and the intensity of price fluctuations, including the following steps C1-C2: C1: Input the calibration features into the Transformer encoder to establish global long-range temporal dependencies and obtain the global context representation of electricity price, including linear projection of the calibration features and superimposing position encoding, and introducing the position information of each time step in the sequence into the feature representation; The features after superimposed position encoding are processed sequentially through multiple encoding layers. Each layer performs global temporal relationship modeling and feature nonlinear transformation, and the stability of information transmission is maintained through residual connections. The output vector corresponding to the last time step in the final coding layer is extracted as a global context representation of electricity prices representing the entire historical sequence.
[0047] Specifically, the Transformer (a sequence-to-sequence encoding framework based on self-attention) encoder performs global long-range dependency modeling on the calibration feature t. First, it linearly transforms the input projection matrix to the encoder's hidden dimension, and then overlays positional encoding (PE) to inject the absolute and relative position information at each time step. The input projection and positional encoding operations are as follows: The embedding vector E is obtained and used as the input to the first layer of the encoder. Each dimension of the positional encoding PE is generated using sine and cosine functions, enabling the model to distinguish different time steps in the sequence without introducing additional parameters.
[0048] Specifically, the Transformer encoder employs a two-layer stacked structure, with each layer containing two sub-layers: a multi-head self-attention sub-layer and a feed-forward network (FFN) sub-layer. The former computes global attention weights between all time-step pairs in parallel across the entire 24-step historical sequence, eliminating the need for recursive propagation of hidden states and fundamentally solving the information dilution problem in long-range dependencies. The latter performs non-linear transformations on the features of each time-step through two fully connected layers, enhancing representational power. Residual connections and layer normalization are introduced after each sub-layer. Residual connections ensure stable gradient propagation during backpropagation, while layer normalization accelerates training convergence. The output of the l-th encoding layer is as follows: Initial input The number of stacking times for the coding layers is L=2.
[0049] Specifically, the output vector corresponding to the last time step (step 24) in the final output of the second coding layer is taken as the global context representation g of the entire historical sequence, and the extraction operation is performed as follows: In the formula, For global context feature vectors, It is the output of the last coding layer, and its dimension is ,in It refers to the batch size. It is the sequence length. It is the feature dimension. It's an index operation; it selected... The global feature vector is obtained by analyzing all batches, the last time step, and features across all feature dimensions. The selection of the output of the last time step as the global representation is based on the characteristics of the electricity price prediction task: the encoder's output at each time step has integrated the attention information of the entire sequence, and the output of the last step is closest in position to the future time to be predicted, which is the most direct summary representation of the historical sequence. The 64-dimensional global feature vector condenses all the temporal structure information in the 24-hour multi-dimensional historical sequence into a unified contextual representation, providing a common feature input basis for the three parallel prediction branches.
[0050] C2: Multidimensional price behavior joint prediction includes three dedicated prediction branches that share the global context of electricity price. The main regression prediction branch outputs a continuous scalar through a fully connected layer as the predicted value of the electricity price at future time points. The directional classification prediction branch outputs a three-dimensional probability vector through a fully connected layer and a normalized exponential function, which corresponds to the probability that the future electricity price will rise, remain flat, or fall relative to the current time. The volatility prediction branch outputs a positive scalar through a fully connected layer and a positive activation function, which serves as a prediction of the volatility intensity of future electricity prices. The three prediction branches infer in parallel and each outputs its prediction result independently.
[0051] Specifically, the multi-dimensional price behavior joint prediction head, based on a shared global context representation g, sets up three parallel dedicated prediction branches, each responsible for one of the three tasks: electricity price point prediction, price trend direction classification, and price volatility prediction. These three branches execute in parallel during the inference phase, each independently outputting the prediction results for its corresponding dimension.
[0052] The main regression prediction branch performs a linear transformation on the global representation g through a fully connected layer, outputting a continuous scalar as the standardized electricity price prediction value for the future time (time t+1). : in, This indicates the predicted electricity price. This represents the weight matrix of the regression head. This represents the bias term of the regression head. The loss function used is Huber loss, with the threshold parameter δ set to 1.0. When the absolute value of the prediction error is less than δ, squared loss is used to provide a smooth gradient; when the error exceeds δ, absolute loss is switched to suppress the excessive influence of outliers on parameter updates. Huber loss calculation: in, This represents the loss value of the main regression task. For the actual electricity price, Huber loss threshold parameter controls the switching point between squared loss and absolute loss in the loss function. This occurs when the prediction error is less than or equal to... When the prediction error is greater than 1, use the squared loss; when the prediction error is greater than 1, use the squared loss When using absolute loss.
[0053] The directional classification prediction branch maps g to a 3D logistic vector through a fully connected layer, and then transforms it into a three-class probability distribution p(p0, p1, p2) through a normalized exponential function (Softmax), corresponding to three trends of future electricity prices relative to the current time: decreasing, remaining flat, and increasing, respectively. Classification head structure: in, The output probability distribution vector has a length of 3, corresponding to the three probabilities of electricity price change. The weight matrix represents the orientation classification head. This is the bias term for the direction classification head. The direction category labels are generated using a dynamic thresholding method based on training set statistics: the 95th percentile Δq of the absolute change in electricity price at all adjacent time points in the training set is calculated as the discrimination threshold. When the price change Δp < -Δq, it is labeled as decreasing; when |Δp| ≤ Δq, it is labeled as remaining unchanged; and when Δp > Δq, it is labeled as increasing. The loss function used is cross-entropy loss. in, The loss value for the direction classification task. One-hot encoding for the true direction. If the true direction is the first... Class, then =1, otherwise =0. The model predicts the first The probability of a class.
[0054] The volatility prediction branch maps g to a scalar through a fully connected layer, and then processes it through the Softplus function (Softplus is a smooth, positive-preserving activation function that always outputs a positive value), outputting a positive scalar σ̂ as the predicted value for the volatility of future electricity prices. Prediction head structure: In the formula, For the predicted positive scalar volatility, This is the weight matrix for the volatility forecast head. This is the bias term for the volatility forecast head. As a smooth activation function, ensuring a positive output value, it can maintain a positive predicted volatility. The formula is as follows: Motion rate truth label The standard deviation of electricity prices within the past 24 hours for each sample in the training set is calculated to characterize the price volatility within the current historical window, serving as a quantitative proxy for the model's predictive uncertainty. The loss function used is Mean Squared Error (MSE). in, The loss value for the volatility prediction task. For the first The true volatility of each sample For the first The predicted volatility of each sample This represents the number of samples.
[0055] In this embodiment, step S400 involves summing the losses corresponding to the three predicted outputs using preset weights, and then collaboratively updating the parameters at each stage through backpropagation to obtain the electricity price prediction result, including the following steps D1-D2: D1: The losses corresponding to the three prediction outputs are summed with preset weights, and the parameters of each stage are updated collaboratively through backpropagation, including calculating the Huber loss of the main regression prediction branch, the cross-entropy loss of the directional classification prediction branch, and the mean squared error loss of the volatility prediction branch. The three losses are weighted and summed with preset weight coefficients to construct a multi-task joint loss. The weight coefficients are determined by cross-validation on the validation set. With multi-task joint loss as the optimization objective, the gradient signals of the three prediction branches are synchronously transmitted to the generation stage of the global context representation of electricity price through backpropagation, and all stage parameters are updated collaboratively. Among them, the training signals of the directional classification prediction branch and the volatility prediction branch apply regularization constraints to the shared parameters, thereby suppressing the overfitting of the main regression prediction branch to the training sample noise.
[0056] Specifically, the multi-task joint loss function sums the losses of the three prediction branches using preset weighting coefficients to construct a unified optimization objective: in, To unify the weighted sum of multi-task loss functions, The weighting coefficients are preset for the corresponding main regression head, direction classification head, and volatility prediction head, and satisfy the following conditions: The specific values are determined through cross-validation. The specific weight values are determined by performing k-fold cross-validation (k=5) on the validation set, with the lowest main regression loss on the validation set as the selection criterion.
[0057] Specifically, during the backpropagation phase, L_total is used as the optimization objective, and the gradient of L_total relative to all trainable parameters of the model is calculated using automatic differentiation. Since the three prediction branches share the parameters of the preceding multi-scale convolutional layer, two-dimensional saliency calibration layer, and Transformer encoding layer, the gradient signals of the three branches are synchronously transmitted to these shared parameters during backpropagation, forming a multi-source gradient superposition update. The gradient signal of the directional classification branch requires the shared features to distinguish different price trend patterns, while the gradient signal of the volatility branch requires the shared features to be sensitive to price fluctuations. The gradients of these two auxiliary tasks work together on the shared parameters, effectively imposing a structured regularization constraint on the feature representation, thus suppressing the tendency of the main regression branch to overfit the training sample noise due to a single numerical error objective. The Adam optimizer (Adaptive Moment Estimation, which dynamically adjusts the learning rate of each parameter by combining first-order and second-order moment estimation) is used to update all parameters. The initial learning rate is set to 0.001. Every 20 training epochs, the learning rate is multiplied by a decay factor of 0.5 to promote convergence to a finer parameter space in later training.
[0058] After the model is trained, the predicted output is... (Standardized electricity price point forecast) is destandardized to restore the original electricity price units. Destandardization operation: in and These are the mean and standard deviation of the target electricity price on the training set, respectively. This represents the actual electricity price forecast. The directional classification branch simultaneously outputs three probability distributions p to support the bidding strategy decisions of market participants; the volatility prediction branch outputs σ, providing a quantitative measure of price uncertainty, which can be directly used for risk exposure assessment and the construction of confidence intervals for range forecasting.
[0059] D2: This includes acquiring multi-dimensional time series data of the electricity market, preprocessing it, and then labeling each time series sample with the true value of electricity price, the category label of price trend direction, and the true value of price volatility, thus constructing a multi-task labeling training dataset. A multi-task prediction model is constructed. The network structure of the multi-task prediction model includes, in sequence, a multi-granularity local feature extraction layer, a two-dimensional saliency calibration layer, a Transformer encoding layer, and a multi-dimensional price behavior joint prediction layer. Input the multi-task labeled training dataset into the multi-task prediction model, and calculate the Huber loss of the main regression prediction branch, the cross-entropy loss of the directional classification prediction branch, and the mean squared error loss of the volatility prediction branch, respectively. The three losses are weighted and summed with preset weight coefficients to obtain the multi-task joint loss. All parameters in the multi-task prediction model are then updated collaboratively using the multi-task joint loss through backpropagation. The convergence status of the multi-task joint loss is monitored on the validation set, and the weight coefficients are iteratively adjusted until the model converges, thus obtaining the trained multi-task electricity price prediction model.
[0060] Specifically, the construction of the multi-task labeled training dataset is carried out after data preprocessing and feature engineering in D1. For each time-series sample generated through a sliding window, three types of labels are simultaneously labeled at the corresponding output position: the ground truth value of the electricity price prediction (the standardized electricity price at time t+1), the price trend direction category label (integer labels classified into three categories: falling, flat, or rising according to dynamic threshold rules), and the ground truth value of price volatility (the standardized value of the standard deviation of the electricity price within the historical window). The three types of labels are encapsulated synchronously with the sample to form a one-to-one corresponding multi-task labeled sample set, ensuring that the supervision signals of the three tasks can be obtained simultaneously in each forward propagation, driving the calculation of the multi-task joint loss.
[0061] Specifically, the complete network structure of the multi-task prediction model consists of the following layers in the data flow direction: input projection layer (mapping the 13-dimensional original features to 64-dimensional features), multi-granularity local feature extraction layer (containing three parallel depthwise separable convolutional branches and pointwise fusion sub-layers), channel saliency calibration layer (SE module composed of global average pooling and a two-layer gated fully connected network), time-step saliency calibration layer (multi-head self-attention module composed of 8-head self-attention computation and output projection), Transformer encoding layer (two stacked layers, each containing a multi-head self-attention sub-layer and a feedforward network sub-layer, with residual connections and layer normalization), global feature extraction operation (taking the output vector of the last time step of the last layer), and three parallel task branches (main regression fully connected layer, orientation classification fully connected layer - Softmax, volatility fully connected layer - Softplus). The total number of model parameters is approximately 0.15M, and a single epoch training time on a workstation equipped with a GPU takes approximately 2 seconds, demonstrating high computational efficiency.
[0062] Specifically, the training process iterates for up to 100 epochs on the multi-task labeled training dataset, with a batch size of 32. Within each epoch, the training set is divided into batches, and for each batch, forward propagation (outputting the prediction results of the three branches) and multi-task joint loss calculation are performed sequentially. The training process consists of four steps: weighted summation, backpropagation (calculating gradients and propagating them to all shared parameters), and Adam parameter updates. After each epoch, the joint loss for the validation set is calculated and recorded, and a snapshot of the model parameters with the lowest validation loss is saved. If the validation loss does not decrease for 15 consecutive epochs, an early stopping strategy is triggered to terminate training early and prevent overfitting. After training, the snapshot of the best-performing model parameters on the validation set is loaded for evaluation on the test set and for real-world market prediction tasks.
[0063] Using the 2019 German electricity market dataset as the basis for this embodiment, a systematic comparative experiment was conducted between the method of this application and nine other comparative methods (including representative time series prediction models such as Recurrent Neural Networks (GRU) and Temporal Convolutional Networks (TCN). The results show that, compared with traditional recurrent neural networks, the method of this application reduces the mean absolute error (MAE) by 48.8% and the root mean square error (RMSE) by 39.9%, with a determination coefficient R0. 2 The accuracy improved from 0.7647 to 0.9306; compared with Temporal Convolutional Network (TCN), the MAE decreased by 45.2% and the RMSE decreased by 50.7%. The overall accuracy of the directional classification task reached 81.3%, with an accuracy of 84.2% for upward direction, 78.5% for downward direction, and 71.8% for flat direction, providing market participants with multi-dimensional quantitative information support beyond electricity price point prediction.
[0064] Example 3 To verify the effectiveness of the method in this application, a systematic comparative experiment was conducted on the 2019 dataset of the German electricity market. Figure 3 The image shown is from the application. The model structure diagram clearly illustrates the complete processing flow from input data to multi-task output, including: multi-scale deep convolutional modules, dual attention mechanisms, etc. Encoder and multi-task prediction head. Experiments were conducted on a workstation equipped with an NVIDIA RTX 5060 GPU, using Python 3.10, PyTorch 2.7.1, CUDA 12.8, and cuDNN 90701. Training parameters were uniformly set as follows: batch size 32, training epochs 100, sequence length 24, and prediction stride 1. All models used the same training set (first 80%), validation set (middle 10%), and test set (last 10%), strictly divided in chronological order.
[0065] The comparison method selected nine representative prediction algorithms: (Basic recurrent neural network) (Two-way gated loop unit) (Extended Causal Convolutional Network) (Temporal convolutional networks) (Temporal Fusion Transformer) (Graph Neural Network) , , These methods cover the main technical approaches to time series forecasting, including recurrent neural networks, convolutional neural networks, attention mechanisms, and graph neural networks, and are highly representative.
[0066] The evaluation index system includes point prediction accuracy and direction prediction performance. Point prediction accuracy uses three core indicators: mean absolute error. Reflects the average magnitude of the prediction error; root mean square error: More sensitive to larger errors; coefficient of determination: This reflects the proportion of variance explained by the model. Orientation prediction performance is expressed as classification accuracy. Computational efficiency considers training time and the number of model parameters.
[0067] The experimental results are shown in the table below: Table 1 records the performance comparison of nine forecasting methods in the day-ahead electricity price forecasting task in the German electricity market: Table 1. Prediction Performance of Different Algorithms on the Same Dataset Compared with the previous work of this application: In comparison, the method of this application Decreased by 27.0%. A decrease of 26.3%, The value increased from 0.8724 to 0.9306. This proves that... Replace with The improvements to the encoder's architecture are significant.
[0068] Compared to the single-task version: Compared to the single-task version, the method in this application... Decreased by 9.8%. Decreased by 9.6%, The value improved from 0.9152 to 0.9306. This validates the effectiveness of the multi-task learning framework, which significantly regularizes the main regression task by introducing directional classification and volatility prediction as auxiliary tasks.
[0069] Directional classification performance: The method in this application achieves an accuracy of 81.3% in a synchronously executed directional classification task, with an accuracy of 84.2% for upward direction, 78.5% for downward direction, and 71.8% for neutral direction. Directional prediction provides market participants with important decision-making information in addition to point prediction.
[0070] The experimental data above demonstrates that the electricity market price forecasting method based on hybrid architecture and multi-task learning proposed in this application effectively overcomes the limitations of traditional methods, exhibiting significant advantages in forecast accuracy, model generalization ability, and multi-task collaboration. Compared with the optimal single-task benchmark, Reduced by nearly 10%, It has been improved to 0.9306 and can simultaneously provide high-precision direction classification and volatility estimation, meeting the actual needs of electricity market participants for high-precision, multi-dimensional price forecasts.
[0071] Compared with traditional methods: The method in this application (highlighted in red in the table) is superior to traditional recurrent neural networks ( ), A decrease of 48.8%, Reduced by 39.9%, The performance improved from 0.7647 to 0.9306. Compared to temporal convolutional networks ( ), A decrease of 45.2%, A decrease of 50.7%.
[0072] Example 4 Reference Figure 2 This is the second embodiment of the present invention.
[0073] The above is an illustrative scheme of a multi-task electricity market price forecasting method based on multi-scale convolution and Transformer encoding. It should be noted that the technical solution of this system based on multi-scale convolution and Transformer encoding is based on the same concept as the aforementioned multi-task electricity market price forecasting method based on multi-scale convolution and Transformer encoding. Details not described in detail in this embodiment can be found in the description of the aforementioned multi-task electricity market price forecasting method based on multi-scale convolution and Transformer encoding.
[0074] This embodiment also provides a multi-task electricity market price prediction system based on multi-scale convolution and Transformer coding, including: a data preprocessing module, used to acquire and preprocess multi-dimensional time series data of the electricity market, construct time series training samples, used to perform multi-granularity local time series perception on the time series training samples, and extract local time series structure features of the electricity price series from multiple time granularities; The two-dimensional saliency calibration module is used to sequentially perform channel-dimensional saliency weighting and time-step-dimensional saliency weighting on local temporal structure features to obtain calibration features; The global dependency modeling module is used to process calibration features through a Transformer encoder to establish global long-range temporal dependencies and obtain a global context representation of electricity prices. The multi-dimensional price behavior joint prediction module is used to output the predicted value of electricity price points, the probability distribution of price trend direction, and the intensity of price fluctuation through three dedicated prediction branches, based on the global context representation of electricity prices. The joint optimization module is used to sum the losses corresponding to the three prediction outputs in a weighted manner and perform backpropagation to collaboratively update the parameters at each stage and obtain the electricity price prediction results.
[0075] This embodiment also provides an electronic device suitable for multi-task electricity market price forecasting based on multi-scale convolution and Transformer encoding, comprising: a memory and a processor; the memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the multi-task electricity market price forecasting method based on multi-scale convolution and Transformer encoding as proposed in the above embodiment.
[0076] This embodiment also provides a storage medium storing a computer program that, when executed by a processor, implements the multi-task electricity market price prediction method based on multi-scale convolution and Transformer encoding as proposed in the above embodiments.
[0077] The storage medium proposed in this embodiment and the multi-task electricity market price prediction method based on multi-scale convolution and Transformer coding proposed in the above embodiments belong to the same inventive concept. Technical details not described in detail in this embodiment can be found in the above embodiments, and this embodiment has the same beneficial effects as the above embodiments.
[0078] Based on the above description of the implementation methods, those skilled in the art can clearly understand that the present invention can be implemented using software and necessary general-purpose hardware, and of course, it can also be implemented using hardware. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk, or optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods of the various embodiments of the present invention.
[0079] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A multi-task electricity market price forecasting method based on multi-scale convolution and Transformer encoding, characterized in that: This includes acquiring multi-dimensional time series data from the electricity market, preprocessing it, and then constructing time series training samples. Multi-granularity local time-series perception is performed on time-series training samples to extract local time-series structural features of electricity price sequences from multiple time granularities; The local temporal structure features are sequentially weighted by channel dimension significance and time step dimension significance to obtain calibration features; The calibration features are input into the Transformer encoder to establish a global long-range temporal dependency and obtain a global contextual representation of the electricity price. Based on the global context representation of electricity prices, multi-dimensional price behavior joint prediction is performed, and the predicted value of electricity price points, the probability distribution of price trend direction, and the intensity of price fluctuations are output simultaneously. The losses corresponding to the three predicted outputs are summed with preset weights, and the parameters of each stage are updated collaboratively through backpropagation to obtain the electricity price prediction result.
2. The multi-task electricity market price prediction method based on multi-scale convolution and Transformer encoding as described in claim 1, characterized in that: The multi-granularity local temporal sensing includes setting up multiple parallel convolutional branches with different receptive field scales, each convolutional branch sensing the local structural components corresponding to short-term oscillations, medium-term trends and long-term cycles in the electricity price sequence; The outputs of each branch are processed by nonlinear activation and then concatenated along the feature dimension. The spliced multi-scale features are then compressed and fused through channels to obtain unified local temporal structure features.
3. The multi-task electricity market price prediction method based on multi-scale convolution and Transformer encoding as described in claim 2, characterized in that: The channel dimension saliency weighting and time step dimension saliency weighting include: channel dimension saliency weighting: global statistical compression of local temporal structure features along the time axis, generating importance weights for each channel through multi-level transformation, and multiplying the weights with the local temporal structure features channel by channel to obtain channel calibration features; Time step dimension significance weighting: Linear projection is performed on the channel calibration features, and the importance weight of each time step is obtained by calculating the correlation between each time step. The time step calibration features are obtained after weighted aggregation. The calibration features are obtained by fusing the channel calibration features with the time step calibration features.
4. The multi-task electricity market price forecasting method based on multi-scale convolution and Transformer encoding as described in claim 3, characterized in that: The calibration features are input into the Transformer encoder to establish global long-range temporal dependencies, thereby obtaining a global contextual representation of electricity prices. This includes linearly projecting the calibration features and superimposing position encoding to incorporate the position information of each time step in the sequence into the feature representation; The features after superimposed position encoding are processed sequentially through multiple encoding layers. Each layer performs global temporal relationship modeling and feature nonlinear transformation, and the stability of information transmission is maintained through residual connections. The output vector corresponding to the last time step in the final coding layer is extracted as a global context representation of electricity prices representing the entire historical sequence.
5. The multi-task electricity market price forecasting method based on multi-scale convolution and Transformer encoding as described in claim 4, characterized in that: The multidimensional price behavior joint prediction includes three dedicated prediction branches that share the global context representation of electricity prices. The main regression prediction branch outputs a continuous scalar through a fully connected layer as the predicted value of the electricity price at future time points. The directional classification prediction branch outputs a three-dimensional probability vector through a fully connected layer and a normalized exponential function, which corresponds to the probability that the future electricity price will rise, remain flat, or fall relative to the current time. The volatility prediction branch outputs a positive scalar through a fully connected layer and a positive activation function, which serves as a prediction of the volatility intensity of future electricity prices. The three prediction branches infer in parallel and each outputs its prediction result independently.
6. The multi-task electricity market price forecasting method based on multi-scale convolution and Transformer encoding as described in claim 5, characterized in that: The method involves summing the losses corresponding to the three prediction outputs with preset weights and updating the parameters of each stage through backpropagation, including calculating the Huber loss of the main regression prediction branch, the cross-entropy loss of the directional classification prediction branch, and the mean squared error loss of the volatility prediction branch. The three losses are weighted and summed with preset weight coefficients to construct a multi-task joint loss. The weight coefficients are determined by cross-validation on the validation set. With multi-task joint loss as the optimization objective, the gradient signals of the three prediction branches are synchronously transmitted to the generation stage of the global context representation of electricity price through backpropagation, and all stage parameters are updated collaboratively. Among them, the training signals of the directional classification prediction branch and the volatility prediction branch apply regularization constraints to the shared parameters, thereby suppressing the overfitting of the main regression prediction branch to the training sample noise.
7. The multi-task electricity market price prediction method based on multi-scale convolution and Transformer encoding as described in claim 6, characterized in that: This includes acquiring multi-dimensional time series data of the electricity market, preprocessing it, and then labeling each time series sample with the true value of electricity price, the category label of price trend direction, and the true value of price volatility, thus constructing a multi-task labeling training dataset; A multi-task prediction model is constructed. The network structure of the multi-task prediction model sequentially includes a multi-granularity local feature extraction layer, a two-dimensional saliency calibration layer, a Transformer encoding layer, and a multi-dimensional price behavior joint prediction layer. Input the multi-task labeled training dataset into the multi-task prediction model, and calculate the Huber loss of the main regression prediction branch, the cross-entropy loss of the directional classification prediction branch, and the mean squared error loss of the volatility prediction branch, respectively. The three losses are weighted and summed with preset weight coefficients to obtain the multi-task joint loss. All parameters in the multi-task prediction model are then updated collaboratively using the multi-task joint loss through backpropagation. The convergence status of the multi-task joint loss is monitored on the validation set, and the weight coefficients are iteratively adjusted until the model converges, thus obtaining the trained multi-task electricity price prediction model.
8. A multi-task electricity market price forecasting system based on multi-scale convolution and Transformer coding, based on the multi-task electricity market price forecasting method based on multi-scale convolution and Transformer coding as described in any one of claims 1 to 7, characterized in that: It also includes a data preprocessing module, which is used to acquire and preprocess multi-dimensional time series data of the electricity market, construct time series training samples, and perform multi-granularity local time series perception on the time series training samples to extract local time series structural features of the electricity price series from multiple time granularities. The two-dimensional saliency calibration module is used to sequentially perform channel-dimensional saliency weighting and time-step-dimensional saliency weighting on local temporal structure features to obtain calibration features; The global dependency modeling module is used to process calibration features through a Transformer encoder to establish global long-range temporal dependencies and obtain a global context representation of electricity prices. The multi-dimensional price behavior joint prediction module is used to output the predicted value of electricity price points, the probability distribution of price trend direction, and the intensity of price fluctuation through three dedicated prediction branches, based on the global context representation of electricity prices. The joint optimization module is used to sum the losses corresponding to the three prediction outputs in a weighted manner and perform backpropagation to collaboratively update the parameters at each stage and obtain the electricity price prediction results.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, it implements the steps of the multi-task electricity market price prediction method based on multi-scale convolution and Transformer encoding as described in any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by the processor, it implements the steps of the multi-task electricity market price prediction method based on multi-scale convolution and Transformer encoding as described in any one of claims 1 to 7.