Electricity price prediction method and system based on converter and bidirectional gating circulation network
The electricity price prediction method using converters and bidirectional gated recurrent networks solves the difficulty of electricity price prediction under renewable energy grid integration using traditional models. It achieves efficient nonlinear modeling of electricity price data and captures global spatiotemporal dependencies, thereby improving prediction accuracy and robustness.
Patent Information
- Application Number
- CN202510487462.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-18
- Publication Date
- 2025-11-25
AI Technical Summary
Traditional electricity price forecasting methods are ill-suited to the nonlinearity, non-stationarity, and multi-scale coupling characteristics of grid load and electricity price data caused by renewable energy grid integration. They cannot effectively capture the dynamic nonlinear relationship between wind and solar power output fluctuations and electricity prices, and lack the ability to model grid topology and inter-regional electricity price interactions.
A method for predicting electricity prices based on transformers and bidirectional gated recurrent networks is adopted. By using hierarchical multi-head attention mechanism, global attention mechanism and cross attention mechanism, combined with Transformer encoder and BiGRU layer, the feature extraction and prediction model of electricity price data are optimized.
It significantly improves the accuracy and stability of electricity price forecasting, breaks through the limitations of static feature extraction in traditional models, effectively captures the nonlinear fluctuation patterns and global spatiotemporal dependencies of electricity price sequences, and enhances the fusion and generalization performance of multi-source heterogeneous features.
Smart Images

Figure CN121010400A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of power system and artificial intelligence prediction technology, specifically to a method and system for predicting electricity prices based on converters and bidirectional gated cyclic networks. Background Technology
[0002] Traditional forecasting methods based on time series analysis, statistical methods, and basic machine learning models typically assume stable linear correlations or recurring patterns among historical data. However, the large-scale grid integration of renewable energy sources, especially wind power generation, which experiences dramatic fluctuations in power output due to the variability of natural conditions, disrupts the original linear relationships, making it difficult for traditional forecasting models to capture the impact of renewable energy on grid load characteristics and electricity price trends.
[0003] The main technical deficiencies in existing technologies are that traditional prediction methods, based on the assumption of linear correlation and static feature extraction mechanisms, are ill-suited to the nonlinear, non-stationary, and multi-scale coupling characteristics of grid load and electricity price data caused by renewable energy grid integration. Firstly, traditional time series models (such as ARIMA) and basic machine learning methods rely on stable linear relationships or fixed patterns in historical data, failing to effectively characterize the dynamic nonlinear correlation between wind and solar power output fluctuations and electricity prices. Secondly, conventional recurrent neural networks (such as unidirectional LSTM / GRU) suffer from gradient decay in long-sequence modeling, and unidirectional time series processing mechanisms struggle to capture the forward and backward global dependencies in the electricity price sequence. Thirdly, existing methods lack the ability to model graph-structured data such as grid topology and inter-regional electricity price interactions, and fail to achieve collaborative optimization of multi-source heterogeneous features (such as time series features and graph features), significantly limiting the model's generalization performance for complex spatiotemporal coupling relationships and anomalous disturbances.
[0004] To address the aforementioned issues, this patent proposes a multimodal spatiotemporal coupling prediction method based on deep learning, which constructs a hybrid neural network architecture that integrates dynamic spatiotemporal feature extraction and physical information embedding. Summary of the Invention
[0005] In view of the above-mentioned problems, the present invention is proposed.
[0006] Therefore, this invention aims to solve the problem of electricity price fluctuations caused by the grid connection of renewable energy and improve the accuracy and stability of electricity price forecasting.
[0007] To solve the above-mentioned technical problems, the present invention provides the following technical solution: a method for predicting electricity prices based on a converter and a bidirectional gated cyclic network, comprising the following steps:
[0008] Obtain historical electricity price data, construct the historical dataset, and preprocess the historical dataset;
[0009] The preprocessed data is input into the Transformer encoder layer in the hierarchical multi-head attention mechanism;
[0010] Bidirectional gated recurrent neural network optimized with global attention mechanism;
[0011] The cross-attention mechanism is used to combine the outputs of the Transformer encoder and the BiGRU layer;
[0012] The performance of the prediction results is evaluated using mean absolute error, mean square error, and root mean square error.
[0013] As a preferred embodiment of the electricity price prediction method based on converter and bidirectional gated cyclic network described in this invention, the preprocessing includes processing missing values and outliers using interpolation.
[0014] For the missing values, mean imputation and median imputation strategies are implemented;
[0015] For the outliers, clean or transform them, group them according to the time-series characteristics of the data, calculate the mean, and use the calculated mean as a substitute for the missing values.
[0016] Obtain the electricity price dataset, set the input and output data, and divide the electricity price dataset into training and test sets.
[0017] As a preferred embodiment of the electricity price prediction method based on converters and bidirectional gated recurrent networks described in this invention, the hierarchical multi-head attention mechanism includes:
[0018] The input sequence is converted into a fixed-size vector through an embedding layer, and positional encoding is added to capture the sequence's order information;
[0019] The data enters a multi-head self-attention mechanism, where the input is split into multiple heads. Each head computes the query matrix, key matrix, and value matrix vector in parallel, and uses Scaled Dot-Product Attention to calculate attention weights, capturing dependencies at different positions within the sequence.
[0020]
[0021] Where Q is the query matrix, K is the key matrix, V is the value matrix, and d k The dimension of the key is usually the number of columns in matrix K. The core of the formula is to calculate the similarity (dot product) between the query matrix Q and the key matrix K, then scale it, apply the softmax function to obtain the attention weights, and then use these weights to perform a weighted summation on the value matrix V to finally obtain the output.
[0022] In the multi-head attention mechanism, the query matrix, key matrix, and value matrix are first linearly mapped to h different subspaces. For each original Q, K, V, it will be divided into 1 to h sub-vectors, where h is the number of heads.
[0023] Each head independently performs attention calculations to obtain its own self-attention output, resulting in the output matrices of h heads. These output matrices are then concatenated into a single matrix. A linear transformation is then applied to integrate the information from all heads and transform it back to the desired dimension, yielding the final output matrix.
[0024] Q = XW Q K = XW K V = XW V
[0025] head i =Attention(QW Q ,KW K VW V )
[0026] MultiHead(Q,K,V)=Concat(head1,...,head h W o
[0027] Among them, W Q W K W V These are linear transformation matrices, used to convert input data into query, key, and value matrices to adapt to different subspaces; Attention is the attention mechanism, and MultiHead is a multi-head attention mechanism. i Let X be the i-th attention head, and W be the input data matrix. Q W K W V These are the weight matrices for the query matrix, key matrix, and value matrix, respectively, used to linearly transform the input data matrix X into a query.
[0028] As a preferred embodiment of the electricity price prediction method based on converter and bidirectional gated recurrent network described in this invention, the global attention mechanism includes a BiGRU layer and a decoding stage.
[0029] The preprocessed sequence data is passed as input to the BiGRU layer. The BiGRU layer consists of two independent GRU units. The first GRU unit processes the data in the forward order of the time series, while the second GRU unit performs a reverse traversal of the time series, including update gates, reset gates, and new candidate states.
[0030] Update Gate Z t=(W z ·[h t-1 ,x t ]+b z );
[0031] Reset door r t =σ(W r ·[h t-1 ,x t ]+b r );
[0032] New candidate state
[0033] Update hidden status
[0034] Among them, W z W r W h These are the weight matrices for the update gate, reset gate, and hidden state, respectively. z b r b h Here, σ represents the biases for the update gate, reset gate, and hidden state, respectively; σ is the Sigmoid activation function; tanh is the hyperbolic tangent activation function; [h t-1 ,x t [h] represents the hidden state at the previous moment. t-1 and the current input x t splicing, r t ·h t-1 This is the value after the previous hidden state has been adjusted by resetting the gate.
[0035] As a preferred embodiment of the electricity price prediction method based on converters and bidirectional gated recurrent networks described in this invention, the global attention mechanism further includes:
[0036] During the decoding phase, the global attention mechanism calculates the correlation between the output of each BiGRU layer and the current decoder state, by updating the target hidden state h. t With each source hidden state h s By comparing the results, a dynamically adjusted alignment vector a is derived. t a t The dimension directly corresponds to the number of time steps in the source sequence:
[0037]
[0038] a t The vector is passed to the output layer, and in the last layer of the output layer, a linear activation function is used to generate the predicted values for the regression task, where... Let s be the normalized source hidden state, and s and s' be the indices of the source sequence.
[0039] As a preferred embodiment of the electricity price prediction method based on converters and bidirectional gated recurrent networks described in this invention, the transaction attention mechanism includes:
[0040] The output values of the Transformer encoder and the BiGRU network are integrated through a cross-attention mechanism, where the Transformer's encoding vector acts as Q, and the hidden state of the BiGRU takes into account both K and V.
[0041] The matching degree between Q and K is calculated using the dot product, and the attention distribution matrix is initialized.
[0042] The softmax function is applied to achieve probabilistic normalization, generate attention weights, guide the weighted summation of V, and generate the final predicted value.
[0043] As a preferred embodiment of the electricity price prediction method based on converters and bidirectional gated cyclic networks described in this invention, the performance evaluation includes:
[0044] The predicted output is compared with the actual observed values, and the performance is evaluated using quantitative indicators, including mean absolute error, mean square error, and root mean square error.
[0045] Among them, the core indicator for calculating prediction error is the mean absolute error, and the ideal minimum value is expected to be 0, which indicates that the predicted value is exactly the same as the actual value. When the mean absolute error increases, it indicates that the prediction deviation is aggravated.
[0046] The root mean square error is calculated, and the quantization interval is set within [0, +∞). When the value is 0 under ideal conditions, it indicates that the predicted value is completely consistent with the actual situation. As the value of the root mean square error increases, the error intensifies.
[0047] Another objective of this invention is to provide an electricity price forecasting system based on a converter and a bidirectional gated cyclic network.
[0048] To solve the above-mentioned technical problems, the present invention provides the following technical solution: an electricity price prediction system based on a converter and a bidirectional gated recurrent network, comprising: a data processing module, an attention mechanism module, and an evaluation module;
[0049] The data processing module acquires historical electricity price datasets, constructs historical datasets, and preprocesses the historical datasets.
[0050] The attention mechanism module includes a multi-head attention mechanism unit, a global attention mechanism unit, and a cross-attention mechanism unit;
[0051] The multi-head attention mechanism unit inputs the preprocessed data into the Transformer encoder layer in the hierarchical multi-head attention mechanism;
[0052] The global attention mechanism unit is a bidirectional gated recurrent neural network optimized by the global attention mechanism;
[0053] The cross-attention mechanism unit uses a cross-attention mechanism to combine the outputs of the Transformer encoder and the BiGRU layer;
[0054] The evaluation module uses mean absolute error, mean square error, and root mean square error to evaluate the performance of the prediction results.
[0055] The present invention provides a computer device, including a memory and a processor, wherein the memory stores a computer program, characterized in that the processor executes the computer program to implement the steps of the electricity price prediction method based on converter and bidirectional gated cyclic network.
[0056] The present invention provides a computer-readable storage medium having a computer program stored thereon, characterized in that, when the computer program is executed by a processor, it implements the steps of the electricity price prediction method based on a converter and a bidirectional gated cyclic network.
[0057] The beneficial effects of this invention are: significantly improved nonlinear dynamic correlation modeling capability. Based on a hierarchical multi-head self-attention mechanism, multi-scale decoupling representation of intraday high-frequency fluctuations and weekly trend components in electricity price sequences is achieved, overcoming the limitations of static feature extraction in traditional linear models. By parallelizing multiple time-series feature extraction units, the nonlinear fluctuation patterns of electricity prices caused by renewable energy grid connection are effectively captured, solving the problem of insufficient adaptability of traditional methods to non-stationary data.
[0058] Cooperative optimization of global spatiotemporal dependencies. A bidirectional gated recurrent network (BiGRU) is introduced. Through forward and backward time series modeling strategies, it simultaneously captures the forward trend of the electricity price series and the time series inversion phenomenon caused by the wind and solar anti-peak characteristics. This overcomes the gradient decay defect of unidirectional recurrent neural networks in long series modeling and significantly improves the model's ability to resolve complex time series dependencies.
[0059] Efficient fusion and generalization enhancement of multi-source heterogeneous features. This module integrates the global feature capture capability of Transformer and the local temporal modeling advantages of BiGRU through a dynamic weight allocation mechanism, realizing the embedded expression of power system physical constraints and significantly improving the model's generalization performance for multi-source uncertainties.
[0060] The prediction accuracy and robustness have been thoroughly validated. Through systematic analysis of quantitative evaluation indicators (MAE, MSE, RMSE), the prediction accuracy advantage of this method in scenarios with high renewable energy penetration has been verified. Experimental results show that compared with the traditional ARIMA model and the one-way LSTM / GRU method, the prediction error of this patented technology is significantly reduced, especially exhibiting stronger robustness under extreme fluctuation scenarios, providing reliable technical support for real-time dispatch and risk management in the power market. Attached Figure Description
[0061] 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.
[0062] Figure 1 The above is a flowchart of an electricity price prediction method based on a converter and a bidirectional gated cyclic network, provided as an embodiment of the present invention.
[0063] Figure 2 This diagram illustrates the working principle of the GlobalAttention mechanism in an electricity price prediction method based on a converter and a bidirectional gated recurrent network, as provided in an embodiment of the present invention.
[0064] Figure 3 This is a comparison chart of the predicted and actual values of an electricity price prediction method based on a converter and a bidirectional gated recurrent network, provided in an embodiment of the present invention. Detailed Implementation
[0065] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the protection scope of the present invention.
[0066] Example 1, referring to Figures 1-3 This is the first embodiment of the present invention, which provides a method for predicting electricity prices based on a converter and a bidirectional gated recurrent network, including:
[0067] S1: Obtain historical electricity price dataset, construct historical dataset, and preprocess historical dataset.
[0068] Specifically, to improve the quality of historical datasets and ensure model stability and accuracy, imputation is used to handle missing and outlier values.
[0069] For the missing values, mean imputation and median imputation strategies are implemented.
[0070] For the outliers, statistical methods are used to accurately identify them and perform appropriate cleaning or transformation. When calculating the mean, the data is grouped according to the time-series characteristics, and the calculated mean is used as a substitute for missing values to maintain data integrity and consistency.
[0071] This process yields a complete electricity price dataset. After setting the input and output data, the entire dataset is divided into training and test sets.
[0072] The training set comprises 80% and the test set comprises 20%. This method allows professionals to adjust the numerical processing method according to specific needs.
[0073] S2: The preprocessed data is input into the Transformer encoder layer based on a hierarchical multi-head attention mechanism.
[0074] Furthermore, the input sequence is converted into a fixed-size vector through an embedding layer, and positional encoding is added to capture the sequence's order information;
[0075] The data enters a multi-head self-attention mechanism, where the input is split into multiple heads. Each head computes the query matrix, key matrix, and value matrix vector in parallel, and uses Scaled Dot-Product Attention to calculate attention weights, capturing dependencies at different positions within the sequence.
[0076]
[0077] Where Q is the query matrix, K is the key matrix, V is the value matrix, and d k The dimension of the key is usually the number of columns in matrix K;
[0078] In the multi-head attention mechanism, the query matrix, key matrix, and value matrix are first linearly mapped to h different subspaces. For each original Q, K, V, it will be divided into 1 to h sub-vectors, where h is the number of heads.
[0079] Each head independently performs attention calculations to obtain its own self-attention output, resulting in the output matrices of h heads. These output matrices are then concatenated into a single matrix. A linear transformation is then applied to integrate the information from all heads and transform it back to the desired dimension, yielding the final output matrix.
[0080] Q = XW Q, K = XW K, V = XW V
[0081] head i =Attention(QW Q ,KW K VW V )
[0082] MultiHead(Q,K,V)=Concat(head1,...,head h W o
[0083] Among them, W Q W K W V These are linear transformation matrices, used to convert input data into query, key, and value matrices to adapt to different subspaces; Attention is the attention mechanism, and MultiHead is a multi-head attention mechanism. i Let X be the i-th attention head, and W be the input data matrix. Q W K W V These are the weight matrices for the query matrix, key matrix, and value matrix, respectively, used to linearly transform the input data matrix X into a query.
[0084] It's important to note that after adding the output of the multi-head self-attention layer to the original input, layer normalization is applied. The feedforward neural network further extracts and transforms features from the normalized output. During this process, residual connections directly add input data to the output of the feedforward neural network, ensuring that information is not lost during inter-layer propagation. Finally, to prevent overfitting, the Dropout layer randomly sets nodes in the network to zero with a certain probability. This entire workflow, by combining multi-head attention, residual connections, layer normalization, and Dropout, effectively improves the data processing capabilities of the Transformer encoder layer and the performance of the model.
[0085] S3: Introduces a bidirectional GatedRecurrentUnit network optimized by the GlobalAttention mechanism; that is, a bidirectional gated recurrent neural network optimized by the global attention mechanism.
[0086] It should be noted that the global attention mechanism includes a BiGRU layer and a decoding stage; wherein, BiGRU, as a variant of a recurrent neural network (RNN), incorporates a bidirectional processing mechanism.
[0087] Specifically, the preprocessed sequence data is passed as input to the BiGRU layer. The BiGRU layer consists of two independent GRU units. The first GRU unit processes the data in the forward order of the time series, while the second GRU unit traverses the time series in reverse, including update gates, reset gates, and new candidate states. GRU (Gated Recurrent Unit) is a type of gated recurrent neural network unit.
[0088] Update Gate Z t =(W z ·[h t-1 ,x t ]+b z );
[0089] Reset door r t =σ(W r ·[h t-1 ,x t ]+b r );
[0090] New candidate state
[0091] Update hidden status
[0092] Among them, W z W r W h These are the weight matrices for the update gate, reset gate, and hidden state, respectively. z b r b h Here, σ represents the biases for the update gate, reset gate, and hidden state, respectively; σ is the Sigmoid activation function; tanh is the hyperbolic tangent activation function; [h t-1 ,x t [h] represents the hidden state at the previous moment. t-1 and the current input x t splicing, r t ·h t-1 This is the value after the previous hidden state has been adjusted by resetting the gate.
[0093] Furthermore, the Global Attention mechanism calculates the correlation between each BiGRU output and the current decoder state. Global Attention is a type of attention mechanism whose core idea is to consider global contextual information when processing information, rather than focusing solely on information from a local region or specific location. This mechanism enables the model to better capture and understand information from the entire input sequence, thereby improving model performance.
[0094] During the decoding phase, the global attention mechanism calculates the correlation between the output of each BiGRU layer and the current decoder state, by updating the target hidden state h. t With each source hidden state h s By comparing these values, an attention weight 'a' is derived for a dynamically adjusted alignment vector. t a t The dimension directly corresponds to the number of time steps in the source sequence:
[0095]
[0096] a t The vector is passed to the output layer, and in the last layer of the output layer, a linear activation function is used to generate the predicted values for the regression task, where... Let s be the normalized source hidden state, and s and s' be the indices of the source sequence.
[0097] It should also be noted that, such as Figure 2 As shown, the Global Attention mechanism works as follows:
[0098] ① The source hidden state h of the input sequence s At the bottom of the diagram, there is a series of blocks representing the input sequence h. s These blocks can be viewed as hidden states or feature representations from different time steps.
[0099] ② Context vector c t The diagram shows a context vector c. t It is calculated through an attention mechanism. Specifically, the Global Attention mechanism calculates the source hidden state h for each input sequence. s and the target hidden state h at the current time step t The similarity between the input sequences determines how to weight the different parts of the input sequence. These weights (attention weights a) are then used to calculate the weights. t Generate the context vector c for the current time step. t .
[0100] ③ Calculate attention weight a t The image shows a pointer to 'a'. t The arrows indicate each h s With the target hidden state h t The similarity between them is calculated through an attention layer to obtain a weight 'a'. t These weights determine the degree of influence each input sequence has in generating the current context vector.
[0101] ④ Output the updated target hidden state h tThe output h for the current time step is generated by weighted summation of the hidden states of each input. t and with the context vector c t Combine them to form the final output.
[0102] ⑤ Final prediction y t After the above processing, the final target prediction y is obtained. t It represents the model prediction output at that time step.
[0103] In summary, the Global Attention mechanism calculates the similarity between each hidden state and the target hidden state, uses the resulting attention weights to weight the input sequence, generates a context vector, and then combines it with the current hidden state to obtain the final prediction result. This mechanism helps the model capture important information in the sequence and assigns it more weight during processing, such as... Figure 3 The figure shown is a comparison chart of the predicted value and the actual value provided by the present invention.
[0104] S4: Use a cross-attention mechanism to bridge the outputs of the Transformer encoder and the BiGRU network.
[0105] Among them, the cross-attention mechanism is used to combine the outputs of different neural network models to capture complementary information between them.
[0106] It should be noted that the output values of the Transformer encoder and the BiGRU network are integrated through a cross-attention mechanism, where the Transformer's encoding vector acts as Q, and the hidden state of the BiGRU takes into account both K and V.
[0107] The matching degree between Q and K is calculated using the dot product, and the attention distribution matrix is initialized.
[0108] The softmax function is applied to achieve probabilistic normalization, generate attention weights, guide the weighted summation of V, and generate the final predicted value.
[0109] This strategy efficiently integrates the global feature capture capability of Transformer with the sequence understanding advantage of BiGRU, optimizing pattern recognition and dependency handling of sequence data.
[0110] S5: The performance of the prediction results is evaluated using mean absolute error, mean square error, and root mean square error.
[0111] Specifically, the predicted output is compared with the actual observed value, and the performance is evaluated using quantitative indicators, including mean absolute error, mean square error, and root mean square error.
[0112] The core indicator for calculating prediction error is the mean absolute error (MAE). Ideally, the minimum value is expected to be 0, indicating that the predicted value is exactly the same as the actual value. When the mean absolute error increases, it indicates that the prediction deviation worsens, thereby verifying the high accuracy advantage of the method of this invention.
[0113]
[0114] The mean squared error (MSE) was calculated. MSE is more sensitive to outliers or extreme errors and can more comprehensively measure how well the model fits the dataset.
[0115]
[0116] The more stringent evaluation metric of root mean square error (RMSE) can be used to reflect the dispersion of prediction error.
[0117] The quantization interval is set within [0, +∞). In ideal conditions, a single value of 0 indicates that the predicted value is completely consistent with the actual value. As the root mean square error increases, the error worsens.
[0118]
[0119] Where n is the number of samples, y i Represents the true value of the sample. This represents the predicted value of the sample.
[0120] Example 2 is the second embodiment of the present invention, which differs from the previous embodiment in that:
[0121] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0122] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device.
[0123] More specific examples of computer-readable media (a non-exhaustive list) include: electrical connections (electronic devices) having one or more wires, portable computer disk drives (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable media can even be paper or other suitable media on which the program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.
[0124] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0125] Example 3 is the third embodiment of the present invention. This embodiment provides an electricity price prediction system based on a converter and a bidirectional gated recurrent network, including: a data processing module, an attention mechanism module, and an evaluation module;
[0126] The data processing module acquires historical electricity price datasets, constructs historical datasets, and preprocesses the historical datasets.
[0127] The attention mechanism module includes a multi-head attention mechanism unit, a global attention mechanism unit, and a cross-attention mechanism unit;
[0128] The multi-head attention mechanism unit inputs the preprocessed data into the Transformer encoder layer in the hierarchical multi-head attention mechanism;
[0129] The global attention mechanism unit is a bidirectional gated recurrent neural network optimized through a global attention mechanism.
[0130] The cross-attention mechanism unit combines the outputs of the Transformer encoder and the BiGRU layer using a cross-attention mechanism.
[0131] The evaluation module uses mean absolute error, mean square error, and root mean square error to evaluate the performance of the prediction results.
[0132] 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 method for predicting electricity prices based on converters and bidirectional gated recurrent networks, characterized in that: include, Obtain historical electricity price data, construct the historical dataset, and preprocess the historical dataset; The preprocessed data is input into the Transformer encoder layer in the hierarchical multi-head attention mechanism; Bidirectional gated recurrent neural network optimized with global attention mechanism; The cross-attention mechanism is used to combine the outputs of the Transformer encoder and the BiGRU layer; The performance of the prediction results is evaluated using mean absolute error, mean square error, and root mean square error.
2. The electricity price prediction method based on converter and bidirectional gated cyclic network as described in claim 1, characterized in that: The preprocessing includes using interpolation to handle missing and outlier values; For the missing values, mean imputation and median imputation strategies are implemented; For the outliers, clean or transform them, group them according to the time-series characteristics of the data, calculate the mean, and use the calculated mean as a substitute for the missing values. Obtain the electricity price dataset, set the input and output data, and divide the electricity price dataset into training and test sets.
3. The electricity price prediction method based on converter and bidirectional gated cyclic network as described in claim 2, characterized in that: The hierarchical multi-head attention mechanism includes: The input sequence is converted into a fixed-size vector through an embedding layer, and positional encoding is added to capture the sequence's order information; The data enters a multi-head self-attention mechanism, where the input is split into multiple heads. Each head computes the query matrix, key matrix, and value matrix vector in parallel, and uses Scaled Dot-ProductAttention to calculate attention weights, capturing dependencies at different positions within the sequence. Where Q is the query matrix, K is the key matrix, V is the value matrix, and d k The dimension of the key is usually the number of columns in matrix K; In the multi-head attention mechanism, the query matrix, key matrix, and value matrix are linearly mapped to h different subspaces. For each original Q, K, V, it will be divided into 1 to h sub-vectors, where h is the number of heads. Each head independently performs attention calculations to obtain its own self-attention output, resulting in the output matrices of h heads. These output matrices are then concatenated into a single matrix. A linear transformation is then applied to integrate the information from all heads and transform it back to the desired dimension, yielding the final output matrix. Q=XW Q ,K=XW K ,V=XW V head i =Attention(QW Q ,KW K ,VW V ) MultiHead(Q,K,V)=Concat(head1,...,head h )W o Among them, W Q W K W V These are linear transformation matrices, used to convert input data into query, key, and value matrices to adapt to different subspaces; Attention is the attention mechanism, and MultiHead is a multi-head attention mechanism. i Let X be the i-th attention head, and W be the input data matrix. Q W K W V These are the weight matrices for the query matrix, key matrix, and value matrix, respectively, used to linearly transform the input data matrix X into a query.
4. The electricity price prediction method based on converter and bidirectional gated cyclic network as described in claim 3, characterized in that: The global attention mechanism includes a BiGRU layer and a decoding stage; The preprocessed sequence data is passed as input to the BiGRU layer. The BiGRU layer contains two independent GRU units. The first GRU unit processes the data in the forward order of the time series, while the second GRU unit performs a reverse traversal of the time series, including update gates, reset gates, and new candidate states. Update Gate Z t =(W z ·[h t-1 ,x t ]+b z ); Reset door r t =σ(W r ·[h r-1 ,x t ]+b r ); New candidate state Update hidden status Among them, W z W r W h These are the weight matrices for the update gate, reset gate, and hidden state, respectively. z b r b h Here, σ represents the biases for the update gate, reset gate, and hidden state, respectively; σ is the Sigmoid activation function; tanh is the hyperbolic tangent activation function; [h t-1 ,x t [h] represents the hidden state at the previous moment. t-1 and the current input x t splicing, r t ·h t-1 This is the value after the previous hidden state has been adjusted by resetting the gate.
5. The electricity price prediction method based on converter and bidirectional gated cyclic network as described in claim 4, characterized in that: The global attention mechanism also includes, During the decoding phase, the global attention mechanism calculates the correlation between the output of each BiGRU layer and the current decoder state, by updating the target hidden state h. t With each source hidden state h s By comparing the results, a dynamically adjusted alignment vector a is derived. t a t The dimension directly corresponds to the number of time steps in the source sequence: a t The vector is passed to the output layer, and in the last layer of the output layer, a linear activation function is used to generate the predicted values for the regression task, where... Let s be the normalized source hidden state, and s and s' be the indices of the source sequence.
6. The electricity price prediction method based on converter and bidirectional gated cyclic network as described in claim 4, characterized in that: The transaction attention mechanism includes, The output values of the Transformer encoder and the BiGRU network are integrated through a cross-attention mechanism, where the Transformer's encoding vector acts as Q, and the hidden state of the BiGRU takes into account both K and V. The matching degree between Q and K is calculated using the dot product, and the attention distribution matrix is initialized. The softmax function is applied to achieve probabilistic normalization, generate attention weights, guide the weighted summation of V, and generate the final predicted value.
7. The electricity price prediction method based on converter and bidirectional gated cyclic network as described in claim 4, characterized in that: The performance evaluation includes, The predicted output is compared with the actual observed values, and the performance is evaluated using quantitative indicators, including mean absolute error, mean square error, and root mean square error. Among them, the core indicator for calculating prediction error is the mean absolute error, and the ideal minimum value is expected to be 0, which indicates that the predicted value is exactly the same as the actual value. When the mean absolute error increases, it indicates that the prediction deviation is aggravated. The root mean square error is calculated, and the quantization interval is set within [0, +∞). When the value is 0 under ideal conditions, it indicates that the predicted value is completely consistent with the actual situation. As the value of the root mean square error increases, the error intensifies.
8. A price prediction system based on a converter and a bidirectional gated cyclic network, employing the price prediction method based on a converter and a bidirectional gated cyclic network as described in any one of claims 1 to 7, characterized in that, include: Data processing module, attention mechanism module, and evaluation module; The data processing module acquires historical electricity price datasets, constructs historical datasets, and preprocesses the historical datasets. The attention mechanism module includes a multi-head attention mechanism unit, a global attention mechanism unit, and a cross-attention mechanism unit; The multi-head attention mechanism unit inputs the preprocessed data into the Transformer encoder layer in the hierarchical multi-head attention mechanism; The global attention mechanism unit is a bidirectional gated recurrent neural network optimized by the global attention mechanism; The cross-attention mechanism unit uses a cross-attention mechanism to combine the outputs of the Transformer encoder and the BiGRU layer; The evaluation module uses mean absolute error, mean square error, and root mean square error to evaluate the performance of the 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 electricity price prediction method based on converter and bidirectional gated cyclic network 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 electricity price prediction method based on converter and bidirectional gated cyclic network as described in any one of claims 1 to 7.
Citation Information
Cited By
Electric power spot day-ahead electricity price prediction method based on bidding space analysis
CN121526688A
