Power market abnormal data reconstruction method, system, device and medium
The abnormal data reconstruction method, which integrates convolutional neural networks and attention mechanisms, solves the problems of insufficient detection accuracy and low reconstruction consistency of abnormal data in the power market. It enables efficient migration and real-time repair of the model under different market environments, improving the reliability and market adaptability of data repair.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-09
- Publication Date
- 2026-03-17
AI Technical Summary
Existing technologies for reconstructing abnormal data in the power market suffer from insufficient anomaly detection accuracy, low consistency of reconstructed data, limited model generalization ability, and insufficient transferability under different market environments.
A convolutional neural network is used to extract features from electricity market data. The feature weights are calculated by combining the attention mechanism, and an anomaly data reconstruction model is constructed. The adaptability of the model in different market environments is optimized through feature transfer, parameter transfer and instance transfer. The model parameters are optimized by exponential normalization and backpropagation algorithms.
It improves the accuracy of anomaly detection and the rationality of repair, enhances the model's adaptability to different market environments, and ensures the stability and reliability of market data.
Smart Images

Figure CN119961845B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of power market anomaly data reconstruction technology, specifically to power market anomaly data reconstruction methods, systems, equipment, and media. Background Technology
[0002] With the development of the Global Energy Internet, the electricity market is gradually evolving from centralized dispatch to intelligent and autonomous trading. Real-time data analysis and intelligent forecasting have become key to optimizing grid dispatch and improving market stability. Electricity market data is characterized by high dimensionality, nonlinearity, and strong temporal volatility. The generation of abnormal data may affect market settlement, grid security, and trading fairness. Currently, statistical analysis, time series modeling, and machine learning methods have been applied to the processing of abnormal electricity market data. However, due to the complexity of the data and the capabilities of the models, it is difficult to accurately detect and repair abnormal data. In recent years, deep learning technologies, such as convolutional neural networks (CNN) and recurrent neural networks (RNN), have shown advantages in time series data analysis. However, existing technologies still have shortcomings in terms of the accuracy of abnormal data reconstruction, cross-market adaptability, and data consistency. There is an urgent need for more efficient methods for abnormal data reconstruction to ensure the quality and stability of electricity market data.
[0003] Existing methods for processing abnormal data in the power market mainly rely on statistical analysis, time series modeling, and traditional machine learning techniques, but they still have many limitations. Statistical methods (such as moving averages and outlier removal) have limited ability to detect complex time-series anomalies and are difficult to capture short-term mutations and periodic anomalies. Time series modeling (such as ARIMA and GRU) relies on the assumption of stationarity, making it difficult to cope with the non-stationary and multi-scale characteristics of electricity market data. Machine learning-based anomaly detection methods (such as SVM and decision trees) are limited by feature extraction capabilities and cannot fully utilize the spatiotemporal features of the data, resulting in insufficient anomaly identification and low reconstruction accuracy. Although deep learning technology has improved anomaly detection capabilities, it still faces problems such as low reconstruction quality and insufficient generalization ability. Existing methods usually only focus on anomaly detection and lack precise repair mechanisms for anomaly data, resulting in a lack of market consistency in the repaired data. Deep learning models rely on a large amount of labeled data, but the cost of obtaining anomaly data samples is high, which limits the generalization ability of the model. At the same time, existing methods have poor adaptability to different market conditions and lack cross-market transferability, which limits the application of the model in different electricity market environments. Therefore, there is an urgent need for an anomaly data reconstruction method that combines convolutional neural networks and attention mechanisms to improve the accuracy of anomaly data detection and repair, and to optimize the model's adaptability to different market environments through transfer learning. Summary of the Invention
[0004] In view of the above-mentioned problems, the present invention is proposed.
[0005] Therefore, the technical problem solved by this invention is that existing power market anomaly data reconstruction technologies suffer from insufficient anomaly detection accuracy, low consistency of reconstructed data, limited model generalization ability, and the problem of how to effectively transfer the reconstruction model under different market environments.
[0006] To address the aforementioned technical problems, this invention provides the following technical solution: a method for reconstructing abnormal data in the power market, comprising: extracting power market data features using a convolutional neural network; calculating attention weights for features based on an attention mechanism; fusing the convolutional neural network and the attention mechanism to construct an abnormal data reconstruction model; transferring the trained abnormal data reconstruction model to the target power market; calculating the attention weights for features includes calculating abnormal data weights, constructing query, key, and value vectors, and optimizing feature correlation; using exponential normalization to optimize attention allocation and introducing an abnormal data weight factor to dynamically adjust the weights; constructing the abnormal data reconstruction model includes constructing an abnormal data reconstruction model with an input layer, a convolutional feature extraction layer, an attention mechanism layer, and a reconstruction output layer; fusing CNN to extract features, optimizing the representation of outliers using the attention mechanism, and adjusting parameters through error optimization and backpropagation; the transfer includes feature transfer, parameter transfer, and instance transfer, freezing the CNN feature layer, and only fine-tuning the attention mechanism layer and the output layer.
[0007] As a preferred embodiment of the method for reconstructing abnormal electricity market data according to the present invention, the step of extracting electricity market data features includes: collecting electricity market time-series data and normalizing the data; and extracting multi-level features from the electricity market data through a convolutional neural network and multiple convolutional and pooling layers.
[0008] As a preferred embodiment of the power market abnormal data reconstruction method of the present invention, the convolutional neural network includes: in the first convolutional layer, using a convolutional kernel of a set size to perform sliding window calculation on the input power market time series data, the size of the sliding window is set to a fixed value, the convolutional kernel slides in the time dimension according to a set step size, performs local pattern matching on each time step, extracts the time series features of the power market data, and within the sliding window, performs linear transformation on the data according to set parameter weights and applies a nonlinear activation function to obtain time series feature information.
[0009] In the pooling layer, based on the time-series features extracted from the first convolutional layer, the convolutional power market data is dimensionality-reduced using either max pooling or average pooling. In max pooling mode, the maximum value of outlier data points is selected within a set time window. In weighted average pooling mode, the weighted average within a set window is calculated, and outlier points are assigned higher weights.
[0010] In subsequent convolutional layers, long-term dependencies are calculated based on the temporal features extracted from the first convolutional layer, and high-level temporal features are extracted. During the feature extraction process, an adaptive anomaly detection mechanism is introduced to automatically adjust the convolutional kernel parameters by monitoring the distribution changes of data features.
[0011] As a preferred embodiment of the method for reconstructing abnormal electricity market data according to the present invention, the calculation of attention weights for features includes introducing an attention mechanism, constructing query vectors, key vectors, and value vectors based on the features of abnormal electricity market data, and extracting key correlation information between different time points and variables in the electricity market data.
[0012] The query vector, key vector, and value vector are obtained from electricity market time-series data through linear transformation, and the parameter transformation uses a trainable weight matrix.
[0013] Match scores are calculated by performing a dot product operation on the query vector and key vector, and the relevance between different time steps is evaluated.
[0014] A correlation score matrix based on anomaly weights is constructed. By combining the feature data extracted by the convolutional neural network, the correlation between time steps is calculated, and anomalies in the power market data are assigned higher weights.
[0015] The correlation at different time points is normalized by using the exponential normalization method. The matching scores in the matrix are subjected to exponential transformation, all values in the same row are summed, and the matrix rows are normalized to optimize the attention allocation method.
[0016] An outlier weight factor is introduced during the attention calculation process to dynamically adjust the weight of outlier data points. Based on the feature distribution in the attention calculation stage, the calculation method of the attention mechanism is optimized in the feature extraction stage.
[0017] The attention weighting result is calculated based on the normalized attention weights. The normalized values are used as weights and multiplied element-wise with the value vector. The product results are then summed over time to form a new set of weighted feature vectors.
[0018] As a preferred embodiment of the abnormal data reconstruction method for the power market described in this invention, the abnormal data reconstruction model includes an input layer, a convolutional feature extraction layer, an attention mechanism layer, and a reconstruction output layer.
[0019] The input layer receives preprocessed electricity market time-series data, including historical electricity market transaction data, electricity load data, grid operation data, and market quotation data, and performs normalization processing to eliminate dimensional differences between different data sources.
[0020] The convolutional feature extraction layer extracts multi-level time-series features of electricity market data through multiple convolutional and pooling layers. The convolutional layers extract local data patterns based on a set sliding window, and the pooling layers reduce data dimensionality and remove redundant information.
[0021] The attention mechanism layer calculates the weights of abnormal features in the power market data, introduces a self-attention mechanism to perform weighted calculations on features at different time steps, constructs query vectors, key vectors, and value vectors, and obtains the correlation between time series by calculating the matching degree between query vectors and key vectors, assigning higher weights to key abnormal features in the power market.
[0022] The output layer is reconstructed, including reconstructing abnormal data using weighted features calculated based on the attention mechanism, generating normal data through time series prediction methods, calculating the deviation between predicted data and actual data using error optimization methods, and adjusting the parameters of the abnormal data reconstruction model based on the backpropagation algorithm to minimize the prediction error.
[0023] As a preferred embodiment of the power market abnormal data reconstruction method described in this invention, the migration includes feature migration, applying a trained abnormal data reconstruction model to the target market, performing parameter freezing operation on the weights of specific layers of the pre-trained model to maintain the general feature extraction capability, and only allowing the parameters of the attention mechanism layer and the output layer to be updated on the target market data.
[0024] Parameter transfer involves transferring the model parameters trained in the source market to the target market and fine-tuning them using the target market data.
[0025] Instance migration involves selecting a portion of source market data and mixing it into the target market data according to a preset ratio, then training on the mixed dataset of target market data and source market data.
[0026] The reconfigured model after migration is evaluated in the target electricity market. The error of the model is calculated by comparing the actual data and the reconfigured data. Based on the evaluation results, the model is optimized and its parameters and structure are adjusted.
[0027] The optimized refactoring model is deployed to practical applications to acquire electricity market data in real time, perform online anomaly data refactoring, and update and optimize the model in a timely manner by continuously monitoring the refactoring results and market data.
[0028] As a preferred embodiment of the electricity market abnormal data reconstruction method described in this invention, the fine-tuning of the target market data includes: setting a learning rate and performing small-batch training using the target market data; calculating the loss function value of the target market data and adjusting the parameters of the attention mechanism layer and the output layer through backpropagation; monitoring error changes during training and adjusting the training strategy to prevent the model from overfitting or getting trapped in local optima.
[0029] Another objective of this invention is to provide a power market anomaly data reconstruction system that can construct an anomaly data reconstruction model by integrating convolutional neural networks and attention mechanisms through the calculation of attention weights of features based on attention mechanisms. This solves the problems of insufficient accuracy in anomaly point identification, unreasonable anomaly data repair, and limited time series correlation modeling capabilities in current power market anomaly data detection technologies.
[0030] As a preferred embodiment of the power market abnormal data reconstruction system of the present invention, it includes: a feature extraction module, a weight calculation module, and a migration optimization module; the feature extraction module includes a data preprocessing module and a multi-level feature extraction module. The data preprocessing module is used to collect power market time-series data and normalize the data. The multi-level feature extraction module is used to extract multi-level features from the data through a convolutional neural network, using multiple convolutional layers and pooling layers. The weight calculation module includes a correlation weight calculation module and an abnormal data reconstruction model construction module. The correlation weight calculation module is used to construct query vectors, key vectors, and value vectors through an attention mechanism, establish the correlation between different time steps, and combine... The abnormal data weighting factor dynamically adjusts the attention allocation method to optimize the weighting process of abnormal data. The abnormal data reconstruction model building module is used to generate the final feature representation based on the weighting result of the attention mechanism. It adopts a combination of convolutional feature extraction, attention allocation, and reconstruction output to build a complete abnormal data reconstruction model. The transfer optimization module includes a model transfer module and a fine-tuning optimization module. The model transfer module is used to transfer the trained abnormal data reconstruction model to the target electricity market through feature transfer, parameter transfer, and instance transfer. The fine-tuning optimization module is used for mini-batch training on the target market dataset, dynamically adjusting the model based on the loss function value, and using the backpropagation algorithm to optimize the model parameters to prevent overfitting or local optima.
[0031] A computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program as steps to implement a method for reconstructing abnormal data in the power market.
[0032] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of a method for reconstructing abnormal data in the power market.
[0033] The beneficial effects of this invention are as follows: The power market anomaly data reconstruction method provided by this invention utilizes convolutional neural networks to extract features from power market data, achieving efficient feature extraction and ensuring accurate identification of anomalies. Based on an attention mechanism, the attention weights of features are calculated, and the convolutional neural network and attention mechanism are integrated to construct an anomaly data reconstruction model. This makes the repaired anomaly data more consistent with market operating rules, reducing the impact of anomalies on market analysis and decision-making. The trained anomaly data reconstruction model can be transferred to the target power market, achieving efficient transfer of the model. It can adapt to different market environments, improve the model's versatility and real-time anomaly repair capability, ensure the stability of market data, and improve the reliability of data repair. This invention achieves better results in terms of anomaly detection accuracy, data repair rationality, and cross-market adaptability. Attached Figure Description
[0034] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the 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.
[0035] Figure 1 The overall flowchart of the electricity market abnormal data reconstruction method provided in the first embodiment of the present invention is shown. Detailed Implementation
[0036] 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.
[0037] Example 1, referring to Figure 1 As an embodiment of the present invention, a method for reconstructing abnormal data in the electricity market is provided, comprising:
[0038] S1: Extract features from electricity market data using a convolutional neural network.
[0039] Furthermore, the features of electricity market data are extracted, including collecting time-series electricity market data and normalizing the data. Through convolutional neural networks, multiple convolutional layers and pooling layers are used to extract multi-level features from the electricity market data.
[0040] It should be noted that the convolutional neural network includes, in the first convolutional layer, using a convolutional kernel of a set size to perform sliding window calculation on the input electricity market time series data. The size of the sliding window is set to a fixed value. The convolutional kernel slides along the time dimension according to a set step size, performs local pattern matching on each time step, extracts the time series features of the electricity market data, and performs linear transformation on the data according to set parameter weights within the sliding window, and applies a nonlinear activation function to process and obtain time series feature information.
[0041] It should also be noted that a preferred scheme for extracting the time-series characteristics of electricity market data specifically includes calculating the first... Feature extraction results at time step , is represented as:
[0042] ;
[0043] in, This represents the relative time steps covered by the current convolutional operation in the time dimension. `size` represents the window size for the convolution operation, and `length` represents the length of the convolution kernel. The kernel weights represent the trainable parameters in the convolutional neural network used to learn patterns in electricity market data. Indicates time step Electricity market data.
[0044] In the pooling layer, based on the time-series features extracted from the first convolutional layer, the convolutional power market data is dimensionality-reduced using either max pooling or average pooling. In max pooling mode, the maximum value of outlier data points is selected within a set time window. In weighted average pooling mode, the weighted average within a set window is calculated, and outlier points are assigned higher weights.
[0045] In subsequent convolutional layers, long-term dependencies are calculated based on the temporal features extracted from the first convolutional layer, and high-level temporal features are extracted. During the feature extraction process, an adaptive anomaly detection mechanism is introduced to automatically adjust the convolutional kernel parameters by monitoring the distribution changes of data features.
[0046] It should also be noted that, in max pooling mode, a preferred scheme for selecting the maximum value of outlier data points within a set time window specifically includes calculating the first... Eigenvalues of max pooling at time step , is represented as:
[0047] ;
[0048] in, For max pooling operation, For electricity market data in time windows arrive A subset within, This is the pooled window size.
[0049] It should also be noted that, in the weighted average pooling mode, a preferred scheme for calculating the weighted average within a set window range specifically includes calculating the first... Eigenvalues of weighted pooling at time step , is represented as:
[0050] ;
[0051] in, The window size for weighted pooling operations, representing the length of the pooling window. This represents the relative time step covered by the current pooling operation in the time dimension.
[0052] It should also be noted that by employing convolutional neural networks (CNNs) to extract features from electricity market data, the model's ability to capture market fluctuations and anomalies is improved. First, data from market transactions, electricity load, and grid operation are collected and normalized to eliminate dimensional differences between different data sources. Then, by setting convolutional kernel sizes and sliding windows, the model slides along the time dimension with a step size, performing local pattern matching at each time step to extract short-term and anomaly features. In the pooling layer, max pooling or weighted average pooling is used to reduce data dimensionality; max pooling highlights abnormal peaks, while weighted average pooling... Exponential normalization enhances the influence of outliers; in subsequent convolutional layers, long-term dependencies are further extracted, improving the ability to identify market trends and abnormal patterns; the adaptive anomaly detection mechanism dynamically adjusts convolutional kernel parameters by monitoring changes in data distribution, optimizing the outlier extraction effect; through multi-level feature extraction of convolutional neural networks, the model can capture market dynamics at different time scales, ensuring that outlier data is not smoothed or ignored, providing high-quality input data for subsequent model reconstruction, which not only improves the accuracy and computational efficiency of feature extraction, but also enhances the model's robustness and sensitivity to outlier data.
[0053] S2: Based on the attention mechanism, the attention weights of features are calculated, and the convolutional neural network and the attention mechanism are integrated to construct an abnormal data reconstruction model.
[0054] Furthermore, the attention weights of the calculated features include introducing an attention mechanism to construct query vectors, key vectors, and value vectors based on the features of abnormal electricity market data, and extracting key correlation information between different time points and variables in the electricity market data.
[0055] The query vector, key vector, and value vector are obtained from electricity market time-series data through linear transformation, and the parameter transformation uses a trainable weight matrix.
[0056] Match scores are calculated by performing a dot product operation on the query vector and key vector, and the relevance between different time steps is evaluated.
[0057] A correlation score matrix based on anomaly weights is constructed. By combining the feature data extracted by the convolutional neural network, the correlation between time steps is calculated, and anomalies in the power market data are assigned higher weights.
[0058] The correlation at different time points is normalized by using the exponential normalization method. The matching scores in the matrix are subjected to exponential transformation, all values in the same row are summed, and the matrix rows are normalized to optimize the attention allocation method.
[0059] An outlier weight factor is introduced during the attention calculation process to dynamically adjust the weight of outlier data points. Based on the feature distribution in the attention calculation stage, the calculation method of the attention mechanism is optimized in the feature extraction stage.
[0060] The attention weighting result is calculated based on the normalized attention weights. The normalized values are used as weights and multiplied element-wise with the value vector. The product results are then summed over time to form a new set of weighted feature vectors.
[0061] It should be noted that the abnormal data reconstruction model includes an input layer, a convolutional feature extraction layer, an attention mechanism layer, and a reconstruction output layer.
[0062] The input layer receives preprocessed electricity market time-series data, including historical electricity market transaction data, electricity load data, grid operation data, and market quotation data, and performs normalization processing to eliminate dimensional differences between different data sources.
[0063] The convolutional feature extraction layer extracts multi-level time-series features of electricity market data through multiple convolutional and pooling layers. The convolutional layers extract local data patterns based on a set sliding window, and the pooling layers reduce data dimensionality and remove redundant information.
[0064] The attention mechanism layer calculates the weights of abnormal features in the power market data, introduces a self-attention mechanism to perform weighted calculations on features at different time steps, constructs query vectors, key vectors, and value vectors, and obtains the correlation between time series by calculating the matching degree between query vectors and key vectors, assigning higher weights to key abnormal features in the power market.
[0065] The output layer is reconstructed, including reconstructing abnormal data using weighted features calculated based on the attention mechanism, generating normal data through time series prediction methods, calculating the deviation between predicted data and actual data using error optimization methods, and adjusting the parameters of the abnormal data reconstruction model based on the backpropagation algorithm to minimize the prediction error.
[0066] It should also be noted that a preferred scheme for normalization calculation specifically includes calculating the weights in the weighted pooling using an exponential normalization method, expressed as:
[0067] ;
[0068] in, For the first Pooling weights at each time step This represents the exponential transformation result at each time step within the pooling window. This represents the index of the time step within the pooling window.
[0069] It should also be noted that a preferred approach for dynamically adjusting the weights of outlier data points specifically includes calculating attention scores. , is represented as:
[0070] ;
[0071] in, Indicates the current time step. This indicates the target time step that is being monitored. For query vector, This is the transpose of the key vector. Let be the dimension of the key vector. As an adjustment factor for outlier data, This is a weighting factor for outlier data.
[0072] It should also be noted that a preferred approach to forming a new set of weighted feature vectors specifically includes calculating the normalized attention weights and calculating the final weighted features.
[0073] The normalized attention weights are calculated and expressed as follows:
[0074] ;
[0075] in, For the current time step For the target time step Normalized attention weights The attention score for the exponential transformation. As a normalization term, it ensures that the attention score is non-negative and gives higher weight to larger relevance values.
[0076] Calculate the final weighted features , is represented as:
[0077] ;
[0078] in, This is a weighted set of feature vectors used for data reconstruction. Assign a matrix to the attention. This is a value vector used for the final feature representation.
[0079] It should also be noted that a preferred scheme for calculating the deviation between predicted and actual data using error optimization methods specifically includes calculating the loss function value. , is represented as:
[0080] ;
[0081] in, The loss function value measures the deviation between predicted and actual data, and is used to optimize model parameters so that the corrected outlier data more closely resembles real market data. Outlier data weighting factor This represents electricity market data under real market conditions, including electricity prices, load, and transaction volume data. This refers to the repair data generated by reconstructing the model from abnormal data. Squared error is used to measure the magnitude of the error between the reconstructed data and the real data.
[0082] It should also be noted that a preferred approach to minimizing prediction error by adjusting the parameters of the model based on the backpropagation algorithm to reconstruct the model from outlier data includes constructing a model parameter matrix, represented as follows:
[0083] ;
[0084] in, Indicates the first The model parameter matrix after one round of training. Indicates the first The model parameter matrix during the first round of training. The learning rate controls the step size for each parameter update. Represents the loss function For model parameters The gradient is used to measure the current model parameters. The impact on the overall loss is used to determine the direction of parameter optimization.
[0085] It should also be noted that by integrating CNN and attention mechanisms, a complete structure for local and global feature modeling is constructed, resulting in stronger anomaly detection and data reconstruction capabilities. CNN is responsible for extracting the basic feature structure, while the attention mechanism enhances the model's performance and adaptability under complex market conditions by dynamically weighting and optimizing feature relevance, thereby improving anomaly detection and reconstruction effects. Based on the features extracted by the convolutional neural network, a query vector is constructed. Key vector Sum value vector The model extracts correlation information between different time points through linear transformation; calculates attention scores using dot product operations to measure the correlation between time steps; uses exponential normalization to prevent excessively large or small attention scores from causing learning instability; introduces anomaly data weighting factors to dynamically adjust attention allocation based on the deviation of data from the normal distribution, ensuring that the model prioritizes anomalies; increases the proportion of anomalies in feature representation through attention weighting, forming a new set of weighted feature vectors; and improves the reconstruction effect of anomaly data by strengthening the expressive power of anomalies. This step, by optimizing attention distribution, highlights the criticality of anomalies, enabling the model to maintain efficient capture and repair capabilities of anomaly patterns in complex market environments. The dynamic adjustment capability based on the attention mechanism ensures that the model can flexibly respond to different market conditions.
[0086] S3: Transfer the trained model reconstructed from outlier data to the target electricity market.
[0087] Furthermore, transfer, including feature transfer, applies trained anomalous data to the target market to reconstruct the model, performs parameter freezing on specific layer weights of the pre-trained model to maintain general feature extraction capabilities, and only allows the parameters of the attention mechanism layer and the output layer to be updated on the target market data.
[0088] Parameter transfer involves transferring the model parameters trained in the source market to the target market and fine-tuning them using the target market data.
[0089] Instance migration involves selecting a portion of source market data and mixing it into the target market data according to a preset ratio, then training on the mixed dataset of target market data and source market data.
[0090] The reconfigured model after migration is evaluated in the target electricity market. The model error is calculated by comparing actual data and reconfigured data. Based on the evaluation results, the model is optimized by adjusting the model parameters and structure. The optimized reconfigured model is then deployed to practical applications. Electricity market data is acquired in real time, and online anomaly data reconstruction is performed. The model is updated and optimized in a timely manner by continuously monitoring the reconstruction results and market data.
[0091] It should be noted that fine-tuning on the target market data includes setting a small learning rate and using the target market data for small-batch training; calculating the loss function value of the target market data and adjusting the parameters of the attention mechanism layer and the output layer through backpropagation; monitoring error changes during training and adjusting the training strategy to prevent the model from overfitting or getting stuck in local optima.
[0092] It should also be noted that transferring the trained anomaly data reconstruction model to the target electricity market enhances the model's adaptability and generalization ability across different electricity markets through transfer learning. A feature transfer strategy is employed, freezing the convolutional feature extraction layers trained in the source market to maintain the model's ability to extract basic market features, while optimizing only the attention mechanism layer and output layer in the target market. Parameter transfer is performed, transferring the training parameters from the source market to the target market and fine-tuning them using target market data to ensure the model adapts to the new market environment. Instance transfer is used, mixing some source market data with target market data for training, giving the model stronger adaptability in the new market environment. Online optimization allows the model to monitor and adjust in real time during operation in the target market, ensuring repair accuracy and stability. This effectively reduces the model's training time in the new market, lowers data requirements and computational costs, while maintaining a high level of anomaly detection and repair capabilities. Transfer learning enables the model to quickly adapt to different market environments, maintaining efficient identification and repair of market anomalies, and improving the model's cross-market versatility and stability.
[0093] Example 2 is an embodiment of the present invention, which provides a method for reconstructing abnormal data in the power market. In order to verify the beneficial effects of the present invention, scientific demonstration is carried out through economic benefit calculation and simulation experiments.
[0094] First, historical time-series data of the electricity market in a certain region were selected, including electricity transaction data, electricity load data, grid operation data, and market quotation data, spanning 30 days with a data frequency of 15 minutes, totaling 2880 time steps. The collected data underwent preprocessing to eliminate outliers and missing values. A normalization method was used to map the data to the [0,1] interval, eliminating dimensional differences between different data sources. Next, a convolutional neural network (CNN) structure was established, with the kernel size of the first convolutional layer set to 3 and the stride to 1. A sliding window method was used to perform convolution operations on the input electricity market data, with the sliding window moving along the time dimension. Short-term features and abnormal patterns were extracted through local pattern matching. A linear transformation was performed on the data during the convolution operation. The ReLU (Modified Linear Unit) activation function is combined to enhance nonlinear expressive power. In the pooling layer, max pooling and weighted average pooling are used to reduce the dimensionality of the convolutional data. In max pooling, the maximum value within the window is taken. In weighted average pooling, the data within the window is weighted according to exponential normalization to enhance the weight of outlier data in feature representation. In subsequent convolutional layers, long-term dependencies are further extracted based on the short-term features extracted in the first convolutional layer to enhance the model's ability to capture long-term trends and cyclical fluctuations in the power market. An adaptive anomaly detection mechanism is used to dynamically adjust the convolution kernel parameters and adaptively optimize the feature extraction effect based on the distribution changes of market data. Finally, an attention mechanism is used to calculate the attention weights of the features. First, query vectors, key vectors, and value vectors are constructed, and the correlation between different time steps is established through linear transformation. Matching scores are calculated using dot products, and weighted by anomaly data weighting factors. Exponential normalization is used to normalize attention scores at different time steps, optimizing the attention distribution. Based on the attention distribution, a weighted feature representation is generated to provide optimized input for anomaly data reconstruction. Finally, the trained anomaly data reconstruction model is transferred to other electricity markets. A feature transfer strategy is employed, freezing the parameters of the convolutional feature extraction layer and fine-tuning only the attention mechanism layer and output layer. Parameter fine-tuning in the target market environment ensures the model can quickly adapt to the new market data distribution. Instance transfer is combined with mixing some source market data with target market data to further enhance the model's adaptability. After the model runs in the target market, an online optimization mechanism continuously monitors the model reconstruction effect and dynamically adjusts the model parameters based on feedback. The experimental data is recorded and analyzed according to Table 1.
[0095] Table 1 Experimental Data Recording Table
[0096] Time step Input electrical load (MW) Input electricity price (RMB / MWh) Convolutional feature extraction values Maximum pooling value Weighted pooling value Reconstruction error (%) Attention-weighted results 1 320 45 0.67 0.68 0.65 2.50% 0.66 2 315 47 0.7 0.72 0.69 2.00% 0.71 3 310 44 0.66 0.67 0.65 2.20% 0.67 4 322 48 0.73 0.74 0.72 1.80% 0.73 5 318 46 0.69 0.71 0.68 2.10% 0.7 6 325 49 0.74 0.75 0.73 1.50% 0.74
[0097] Experimental data shows that, in terms of convolutional feature extraction, the sliding window and convolution kernel operations successfully extracted short-term cyclical features and anomalies from the electricity market data. For example, from time step 1 to time step 6, the extracted convolutional feature values remained stable between 0.66 and 0.74, indicating that the model has a strong ability to identify market data features at different time steps. Regarding pooling operations, max pooling effectively highlights extreme outliers in the market data. For example, in time step 2, the max pooling value was 0.72, higher than the extracted convolutional feature value, indicating that the model has good performance in detecting anomalies in electricity market price fluctuations. The model exhibits high sensitivity; the weighted pooling method enhances the influence of outliers through exponential normalization. For example, at the second time step, the weighted pooling value is 0.69, indicating that the model can highlight the contribution of outliers in feature representation. In the attention mechanism, the attention weighting result is basically consistent with the convolutional feature extraction value and the pooling result, indicating that the model effectively preserves the integrity of features during the weighting process. For example, at the fourth time step, the attention weighting result is 0.73, close to the convolutional feature extraction value and the pooling value, indicating that the model has strong stability and robustness in multi-level feature extraction. Furthermore, the reconstruction error is between 1.5% and 2%. The accuracy rate is between 0.5%, indicating that the model has high precision in reconstructing abnormal data. Through model transfer, the reconstruction model maintains high performance under different market environments, as evidenced by low error rate and stable attention-weighted results. For example, at the 6th time step, the model's reconstruction error in the target market is 1.5%, indicating that through feature transfer and parameter fine-tuning, the model's ability to repair anomalies in the target market environment is effectively maintained. Compared with existing technologies, this invention combines convolutional neural networks with attention mechanisms, effectively improving the detection and repair capabilities of abnormal data in the power market. Traditional methods often ignore the periodicity and short-term fluctuations of the market in anomaly identification, resulting in insufficient sensitivity in anomaly detection. This invention, by introducing attention mechanisms and adaptive anomaly detection mechanisms, enhances the model's attention to anomalies, ensuring that abnormal data is not weakened or lost during reconstruction. At the same time, transfer learning improves the model's adaptability to different market environments, reduces training costs and time, and enhances the model's practicality and scalability. In summary, this invention, through convolutional neural network feature extraction, attention mechanism optimization, and transfer learning, effectively improves the accuracy, stability, and adaptability of abnormal data reconstruction in the power market, demonstrating innovation and application value.
[0098] Example 3, an embodiment of the present invention, provides a power market abnormal data reconstruction system, including a feature extraction module, a weight calculation module, and a migration optimization module.
[0099] The feature extraction module includes a data preprocessing module and a multi-level feature extraction module. The data preprocessing module is used to collect time-series data of the power market and normalize the data. The multi-level feature extraction module is used to extract multi-level features from the data through the operation of multiple convolutional layers and pooling layers in a convolutional neural network.
[0100] It should be noted that after receiving time-series data from the electricity market, the system performs preliminary processing by the feature extraction module. Specifically, the data preprocessing module is responsible for collecting historical market transaction data, electricity load data, power grid operation data, and market quotation data, and normalizing the data from different data sources to eliminate dimensional differences between different data and ensure consistency after the data is input into the model. Then, the normalized data is processed by the multi-level feature extraction module through a convolutional neural network (CNN). The convolution operation extracts short-term periodic features through a sliding window mechanism, and the pooling operation further reduces dimensionality and enhances feature expression through max pooling and weighted pooling, thereby extracting local patterns and abnormal features from the data.
[0101] The feature extraction module provides the basic feature input for the weight calculation module. In the initial stage of system operation, the data preprocessing module receives historical data from the electricity market (including electricity load, electricity price, transaction volume, and grid operation status), cleans the data, completes missing values, and normalizes it to eliminate dimensional differences between different data sources, ensuring the consistency and integrity of the data input. The preprocessed input data is then transmitted to the multi-level feature extraction module, which extracts short-term periodic features and long-term trend features from the data using a convolutional neural network (CNN). In the convolutional layer, a sliding window combined with convolutional kernels extracts dynamic features and outliers from the electricity market through local pattern matching. The feature matrix generated by the convolutional operation is further dimensionality-reduced in the pooling layer using max pooling and weighted pooling to enhance the expressive power of outlier features. Weighted pooling, through exponential normalization, gives outlier data points higher weights in the feature representation. The extracted feature matrix is then directly transmitted to the weight calculation module. At this point, the feature matrix not only contains the overall dynamic features of the market but also the feature representation enhanced by anomaly enhancement, thus providing high-quality input for the attention mechanism calculation.
[0102] The weight calculation module includes an association weight calculation module and an anomaly data reconstruction model building module. The association weight calculation module is used to construct query vectors, key vectors, and value vectors through an attention mechanism, establish the correlation between different time steps, and dynamically adjust the attention allocation method by combining anomaly data weight factors to optimize the weighting process of anomaly data. The anomaly data reconstruction model building module is used to generate the final feature representation based on the weighting result of the attention mechanism. It uses a combination of convolutional feature extraction, attention allocation, and reconstruction output to build a complete anomaly data reconstruction model.
[0103] It should be noted that after feature extraction is completed, the system transmits the generated feature vectors to the weight calculation module. First, the association weight calculation module constructs query vectors, key vectors, and value vectors through an attention mechanism to establish the correlation between different time steps. It calculates the matching score through dot product operation and weights the matching score by combining the anomaly data weight factor to generate an association score matrix based on the anomaly data weight. Subsequently, the attention distribution is optimized using the exponential normalization method to ensure that the model pays more attention to the contribution of anomalies in feature representation. The anomaly data reconstruction model building module generates the final feature representation based on the weighted feature vectors. It uses a combination of convolutional feature extraction, attention allocation, and reconstruction output to build a complete anomaly data reconstruction model to ensure the model's ability to identify and repair anomalies.
[0104] The weight calculation module provides the model training and optimized feature representation for the transfer optimization module. In the weight calculation module, the final feature matrix after weighting by convolution operation and attention mechanism is input into the reconstruction model. The trained reconstruction model contains the dynamic features and abnormal patterns of the power market and forms the ability to identify and repair anomalies. The trained model is directly used as the input of the transfer optimization module.
[0105] The transfer optimization module includes a model transfer module and a fine-tuning optimization module. The model transfer module is used to transfer the reconstructed model from the trained abnormal data to the target electricity market through feature transfer, parameter transfer and instance transfer. The fine-tuning optimization module is used for mini-batch training on the target market dataset, dynamically adjusting the model based on the loss function value, and using the backpropagation algorithm to optimize the model parameters to prevent overfitting or local optima.
[0106] It should be noted that after the model completes its initial training, the system enters the transfer optimization module to enable rapid adaptation of the model to different electricity market environments. First, the model transfer module transfers the trained model reconstructed from the abnormal data to the new target market through feature transfer, parameter transfer, and instance transfer. To prevent performance degradation of the model in the new market environment, the system performs small-batch training on the target market dataset through the fine-tuning optimization module. Based on the dynamic changes in the loss function value, the system automatically adjusts the model parameters through the backpropagation algorithm, optimizes the attention weights and reconstruction accuracy, and ensures that the model maintains stable anomaly detection and repair capabilities in the new market environment.
[0107] After the migration optimization module runs in the new market environment, the optimization results will further adjust the parameters of the feature extraction module. During the migration and fine-tuning process, the system will dynamically adjust the receptive field of the convolution kernel, the stride of the sliding window, and the pooling strategy according to the fluctuation pattern of the new market data to adapt to the dynamic changes of the new market. The system may adjust the max pooling and weighted pooling strategies according to the characteristics of abnormal patterns in the target market to improve the accuracy of abnormal data identification. Through this reverse adjustment, the system achieves a complete closed-loop optimization from feature extraction to weight calculation and then to model migration.
[0108] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this 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 of the various embodiments of this 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.
[0109] 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-including 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.
[0110] More specific examples (a non-exhaustive list) of computer-readable media 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 programs can be printed, because programs can be obtained electronically, for example, by optically scanning the paper or other media, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.
[0111] It should be understood that various parts of the present invention can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented using 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. It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended 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 reconstructing abnormal data in an electricity market, characterized by, The application relates to a method for reconstructing abnormal data in a target power market based on a trained abnormal data reconstruction model in a source power market. The method comprises the following steps:
1. Extracting power market data features by using a convolutional neural network (CNN); 2. Calculating attention weights of the features based on an attention mechanism, and fusing the convolutional neural network and the attention mechanism to construct an abnormal data reconstruction model; 3. Migrating the trained abnormal data reconstruction model to the target power market; 4. Calculating the attention weights of the features, which includes calculating abnormal data weights, constructing query, key and value vectors, and optimizing feature correlation; 5. Optimizing attention allocation by using exponential normalization, and introducing an abnormal data weight factor to dynamically adjust the weights; 6. Constructing the abnormal data reconstruction model, which includes constructing an input layer, a convolutional feature extraction layer, an attention mechanism layer and a reconstruction output layer; ; wherein, is the pooling weight for the th time step, denotes the exponential transformation result for each time step within the pooling window, denotes the time step index within the pooling window. dynamically adjusting the weight of the abnormal data points, calculating the attention score is represented as: ; wherein, denotes the current time step, denotes the target time step of interest, is the query vector, is the transpose of the key vector, is the dimension of the key vector, is the anomaly data adjustment factor, is the anomaly data weight factor; 7. Fusing CNN to extract features, optimizing abnormal point representation by using the attention mechanism, and adjusting parameters through error optimization and back propagation; 8. Migration, which includes feature migration, parameter migration and instance migration, freezing the CNN feature layer, and only fine-tuning the attention mechanism layer and the output layer; ; where, is the current time step is the target time step of interest is the normalized attention weight, is the exponentiated attention score, is the normalization term, ensuring the attention score is non-negative and giving higher weight to larger correlation values; Computing final weighted features is represented as: ; wherein, is a set of weighted feature vectors, used for data reconstruction, is an attention assignment matrix, is a value vector, used for final feature representation; Computing loss function values is represented as: ; wherein, is a loss function value, measuring the deviation between the predicted data and the real data, used to optimize the model parameters to make the repaired abnormal data closer to the real market data, an abnormal data weight factor, represents the power market data under real market conditions, including power price, load, and transaction volume data, represents the repaired data generated by the abnormal data reconstruction model, is a square error, used to measure the error size between the reconstructed data and the real data; 9. Calculating the weights in the weighted pooling by using an exponential normalization method, which is expressed as: ; wherein, represents the model parameter matrix of the i-th iteration, represents the model parameter matrix of the i-th iteration, represents the model parameter matrix of the i-th iteration, represents the model parameter matrix of the i-th iteration, represents the learning rate, controlling the step size of each parameter update, represents the loss function the gradient of the model parameters , used to measure the influence of the current model parameters on the overall loss, thereby determining the direction of parameter optimization; 10. Calculating the normalized attention weights, and calculating the final weighted features; 11. Calculating the normalized attention weights, which is expressed as:
12. Constructing a model parameter matrix, which is expressed as: The abnormal data reconstruction model comprises: an input layer, a convolutional feature extraction layer, an attention mechanism layer and a reconstruction output layer; The input layer receives preprocessed power market time series data, including historical power market transaction data, power load data, power grid operation data and market quotation data, and performs normalization processing to eliminate the dimensional differences between different data sources; The convolutional feature extraction layer extracts multi-level time series features of the power market data through multiple convolutional layers and pooling layers, the convolutional layer extracts local data patterns based on a set sliding window, and the pooling layer reduces the data dimension and removes redundant information; The attention mechanism layer calculates the abnormal feature weights of the power market data, introduces a self-attention mechanism to weight calculate the features at different time steps, constructs query vectors, key vectors and value vectors, and obtains the correlation between the time series by calculating the matching degree of the query vectors and the key vectors, and gives higher weights to the key abnormal features of the power market; The reconstruction output layer includes weighted features calculated based on the attention mechanism, abnormal data reconstruction, generation of normal data by using a time series prediction method, calculation of the deviation between the predicted data and the actual data by using an error optimization method, and adjustment of the parameters of the abnormal data reconstruction model based on a back propagation algorithm to minimize the prediction error; Migration includes: feature migration, parameter migration and instance migration, freezing the CNN feature layer, and only fine-tuning the attention mechanism layer and the output layer; parameter migration, migrating the model parameters trained in the source market to the target market, and fine-tuning in the target market data; instance migration, selecting part of the source market data, mixing the data into the target market data according to a preset proportion, and training in the mixed data set of the target market data and the source market data. The reconstructed model after migration is evaluated on the target power market. By comparing the actual data and the reconstructed data, the error of the model is calculated. According to the evaluation result, the model is optimized, and the model parameters and structure are adjusted. The optimized reconstructed model is deployed to actual application, real-time acquisition of power market data is carried out, online abnormal data reconstruction is carried out, and the model is updated and optimized in time through continuous monitoring of the reconstruction result and the market data. Fine-tuning on the target market data, including, Setting the learning rate, using the target market data for small batch training; Calculate the loss function value of the target market data, and adjust the parameters of the attention mechanism layer and the output layer through back propagation; Monitor the error change during training, and adjust the training strategy to prevent the model from overfitting or falling into local optimum.
2. The power market abnormal data reconstruction method of claim 1, wherein: The power market data features are extracted, including, Collecting power market time series data and normalizing the data, extracting multi-level features in power market data through convolutional neural network through multiple convolutional layers and pooling layers.
3. The power market abnormal data reconstruction method of claim 2, wherein: The convolutional neural network includes, In the first convolutional layer, a convolution kernel of a certain size is used to perform sliding window calculation on the input power market time series data. The size of the sliding window is set to a fixed value, and the convolution kernel slides in the time dimension according to the set step size. Local pattern matching is performed on each time step to extract the time series features of the power market data. Within the sliding window, linear transformation is performed on the data according to the set parameter weight, and a nonlinear activation function is applied for processing to obtain time series feature information. In the pooling layer, based on the time series features extracted by the first convolutional layer, the convolutional power market data is processed by dimension reduction using maximum pooling or average pooling. In the maximum pooling mode, the maximum value of the abnormal data points within the set time window is selected. In the weighted average pooling mode, the weighted average value within the set window is calculated, and the abnormal points are assigned a higher weight. In the subsequent convolutional layer, based on the time series features extracted by the first convolutional layer, the long-time dependence relationship is calculated, and the high-level time series features are extracted. In the feature extraction process, an adaptive anomaly detection mechanism is introduced to automatically adjust the convolution kernel parameters by monitoring the distribution change of the data features.
4. The power market abnormal data reconstruction method of claim 1 or 3, wherein: The attention weight of the feature is calculated, Including, Introducing attention mechanism, constructing query vector, key vector and value vector based on the features of power market abnormal data, extracting key association information between different time points and variables of power market data; The query vector, key vector and value vector are obtained by linear transformation of the power market time series data, and the parameter transformation uses a trainable weight matrix; By performing dot product operation on the query vector and the key vector, the matching score is calculated, and the correlation between different time steps is evaluated; Build a correlation score matrix based on the abnormal weight, calculate the correlation between time steps combined with the feature data extracted by the convolutional neural network, and give higher weight to the abnormal points in the power market data; Exponential normalization method is used to normalize the correlation of different time points. The matching score in the matrix is subjected to exponential transformation, the sum of all values in the same row is calculated, and the matrix row is normalized to optimize the attention allocation method; An abnormal data weight factor is introduced in the attention calculation process to dynamically adjust the weight of the abnormal data points, and the attention calculation method is optimized in the feature extraction stage according to the feature distribution in the attention calculation stage. The attention weighted result is calculated based on the normalized attention weight, the normalized value is taken as the weight, element-wise multiplication is performed with the value vector, and the product result is summed in the time dimension to form a new weighted feature vector set.
5. A power market abnormal data reconstruction system using the power market abnormal data reconstruction method according to any one of claims 1 to 4, characterized by: It comprises a feature extraction module, a weight calculation module and a migration optimization module. The feature extraction module comprises a data preprocessing module and a multi-level feature extraction module. The weight calculation module comprises a correlation weight calculation module and an abnormal data reconstruction model construction module. The migration optimization module comprises a model migration module and a fine-tuning optimization module. 6.A computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the computer device is configured to perform the method according to any one of claims 1-6 when the computer program is executed by the processor. The processor executes the computer program to realize the steps of the power market abnormal data reconstruction method in any one of claims 1 to 4.
7. A computer-readable storage medium having stored thereon a computer program, characterized in that The computer program is executed by the processor to realize the steps of the power market abnormal data reconstruction method in any one of claims 1 to 4.
Citation Information
Patent Citations
Semi-supervised anomaly detection method based on transfer learning
CN113128613A
Federal learning-based power data anomaly detection method
CN116451117A
Sequence recommendation method based on attention mechanism and contrast learning
CN119739923A