An electric energy meter abnormal data repairing method based on double-channel feature fusion

By employing a dual-channel feature fusion method, combining Markov transition fields and recursive graphs, and using self-attention layers and cross-attention layers to extract and fuse features from wind power time series data, the problem of inaccurate data repair for wind power time series data is solved, achieving higher data repair accuracy and analytical capabilities.

CN119377746BActive Publication Date: 2025-11-04HUBEI ENERGY GRP QIYUESHAN WIND POWER CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411622072.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-14
Publication Date
2025-11-04
Estimated Expiration
2044-11-14

AI Technical Summary

Technical Problem

Existing technologies for wind power time series data repair are inaccurate. Traditional methods rely on expert experience or single feature-driven approaches, resulting in poor data repair performance, especially when analyzing the periodic or repetitive characteristics of wind fields as they change with the weather.

Method used

A dual-channel feature fusion method is adopted, which combines Markov transition fields and recursion graphs to extract features from wind power time series data. Features are fused through self-attention layers and cross-attention layers, and a long short-term memory network is constructed for data repair to enhance feature representation capabilities and accuracy.

Benefits of technology

It improves the accuracy and practicality of wind power time series data repair, effectively captures time dependence and state transition patterns, and enhances the accuracy of data repair and the analytical capabilities of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119377746B_ABST
    Figure CN119377746B_ABST
Patent Text Reader

Abstract

The application discloses a kind of based on dual-channel feature fusion's electric energy meter abnormal data repair method, comprising the following steps: obtaining wind power time series data of wind farm, using Markov transition field to wind power time series data is extracted, obtain short-term characteristics, and using recursive graph method to wind power time series data is extracted, obtain periodic characteristics;Dual-channel feature fusion module is constructed, and short-term characteristics and periodic characteristics are fused using dual-channel feature fusion module, and attention fusion feature is obtained;Time series data repair module is constructed, and attention fusion feature is processed using time series repair module, and the sample label corresponding to wind power time series data is obtained;Using abnormal data repair module, the wind power time series data of sample label for abnormal data is repaired, and wind power time series repair data is obtained.The application can improve the accuracy and practicality of electric energy meter abnormal data.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data processing, and relates to an electric energy meter abnormal data repairing method based on double-channel feature fusion. BACKGROUND

[0002] In recent years, wind power has realized large-scale and high-quality development, and its installed capacity is still expanding, and its proportion in the power system is getting higher and higher. However, since the wind farm site is mostly located in the area with relatively poor natural environment, in the data storage or transmission process, the extreme weather, unstable signal, hardware failure of sensors or other monitoring equipment can all cause interruption in data collection, resulting in a large amount of data missing. This makes the completeness of the collected wind power time series and the adequacy of the data be damaged to a certain extent, which directly affects the decision-making in power generation evaluation, reliability analysis, operation and maintenance, technical improvement and retirement. Therefore, it is necessary to study the automatic repairing method of wind farm monitoring data, so as to ensure the safe and stable operation of the power system and provide complete and accurate data support for realizing intelligent operation of the power grid.

[0003] The traditional knowledge-driven data repairing method is too dependent on expert experience and needs to carry out a lot of feature engineering work. The traditional data repairing method based on single type data driven features is mostly only suitable for some specific application scenarios. For example, the traditional Markov transition field (MTF) realizes one-dimensional time series data to two-dimensional image data conversion by calculating the transition probability before and after each time point. Although it is useful for analyzing the start-stop characteristics of the wind farm, it has low sensitivity to the distribution of time series data, and therefore has poor effect when analyzing the periodicity or repeatability characteristics of the wind farm fluctuating with weather changes. The recursive graph (RP) can effectively analyze the correlation information of samples in a long time span of the wind farm, i.e. the periodic fluctuation information of the wind power output with weather changes, by calculating the similarity between samples at each time point in the time series data. However, it is easily affected by abnormal data, which can cause errors in the conversion process parameters and affect the accuracy of data repairing. SUMMARY

[0004] In view of the above problems in the prior art, the present application provides an electric energy meter abnormal data repairing method based on double-channel feature fusion, which solves the problem of inaccurate wind power time series data repairing in the prior art.

[0005] In order to achieve the above-mentioned application purposes, the technical scheme adopted by the present application is as follows: an electric energy meter abnormal data repairing method based on double-channel feature fusion, comprising the following steps:

[0006] S1, acquire wind power time series data of a wind farm, use a Markov transition field to extract features from the wind power time series data to obtain short-term features, and use a recurrent graph method to extract features from the wind power time series data to obtain periodic features;

[0007] S2, construct a dual-channel feature fusion module, fuse the short-term features and the periodic features using the dual-channel feature fusion module to obtain attention fusion features;

[0008] The dual-channel feature fusion module includes a first self-attention layer, a second attention layer, a first cross-attention layer, a second cross-attention layer, and a third self-attention layer;

[0009] The first self-attention layer and the second attention layer are arranged side by side, the first cross-attention layer is connected with the first self-attention layer and the second attention layer respectively, the second cross-attention layer is connected with the first self-attention layer and the second attention layer respectively, and the third attention layer is connected with the first cross-attention layer and the second cross-attention layer respectively;

[0010] S3, construct a time series data repair module, process the attention fusion features using the time series repair module to obtain sample labels corresponding to the wind power time series data;

[0011] The sample labels include abnormal data and normal data;

[0012] S4, use an abnormal data repair module to repair the wind power time series data with abnormal data as the sample label to obtain wind power time series repair data.

[0013] The beneficial effects of the above scheme are: the present application simultaneously uses multiple feature extraction mechanisms to construct a dual-channel feature extraction system, which enhances the feature representation ability of the sample. On this basis, in view of the problem that the traditional multi-feature fusion model only performs simple feature splicing, resulting in the loss of some important but insignificant features, a multiple attention mechanism is introduced to enhance the important but insignificant features obtained by different feature extraction methods, realizing the mutual enhancement between different feature extraction methods. This method not only retains the ability of the data repair method to analyze the wind farm start-stop features, but also retains the ability of the data repair method to analyze the periodic fluctuation features of the wind farm with the weather. Finally, the fusion features are used as the input of the long short-term memory network model, compared with the traditional method of directly inputting time series data, the new architecture can enable the long short-term memory network model to directly focus on important features, realize more accurate repair of wind farm energy meter abnormal data, and improve the accuracy and practicality of data repair.

[0014] Further, in step S1, the Markov transition field is used to extract features from the wind power time series data to obtain short-term features, which specifically includes:

[0015] S11, dividing the wind power time series data to obtain a subsequence set of the wind power time series data;

[0016] S12, calculating a state transition probability between a first subsequence and a second subsequence in the subsequence set;

[0017] The first subsequence and the second subsequence are different, and the state transition probability includes a single-step transition probability and a multi-step transition probability;

[0018] S13, generating a Markov transition field according to the single-step transition probability and the multi-step transition probability, and taking the Markov transition field as a short-term feature.

[0019] The above further scheme has the beneficial effect that using the Markov transition field to extract features from the wind power time series data can effectively capture time dependence and state transition patterns, and improve prediction accuracy.

[0020] Further, in step S12, the calculation formula used for calculating the state transition probability between the first subsequence and the second subsequence in the subsequence set is:

[0021]

[0022] wherein P i,j is a multi-step transition probability, representing a probability that an element in the subsequence q i at this moment makes a multi-step transition to the subsequence q j at the next moment, P i,i-1 represents a probability that a state in the time series transitions to another state between adjacent time instants i and i-1, p i,j represents a probability that a state in the time series transitions to another state between non-adjacent time instants i and j, and p i,i-1 represents a one-step state transition probability (p i,i-1 ∈ P i,i-1 ) that a state in the time series transitions to another state between adjacent time instants, q i represents a subsequence reflecting the state of the sample at time instant i, x t represents an element in the subsequence at a certain time instant, i represents a certain specific time instant i, and j represents a specific time instant different from i.

[0023] In step S13, the calculation formula used for generating the Markov transition field according to the single-step transition probability and the multi-step transition probability is:

[0024]

[0025] wherein P i,j is a multi-step transition probability, representing a probability that an element in the subsequence q iThe elements in the inner sequence are multi-step transitioned to the subsequence q at the next time j The probability in the inner sequence is represented by M, which represents a Markov transition field.

[0026] The beneficial effect of the above further scheme is that wind power time series data usually has strong time dependence, and the Markov transition field can effectively capture this time dependence by constructing a matrix to represent the state transition probability between different time points, reveal the state transition pattern in the time series, and help identify the wind speed variation law in different time periods.

[0027] Further, in step S1, the recursive graph is used to extract features from the wind power time series data to obtain periodic features, specifically including:

[0028] S14, calculating the Euclidean distance between the first wind power time sample point and the second wind power time sample point in the wind power time series data;

[0029] The first wind power time sample point and the second wind power time sample point are different;

[0030] S15, generating a recursive graph according to the Euclidean distance, and taking the recursive graph as a periodic feature.

[0031] Further, in step S15, the calculation formula used by the recursive graph according to the Euclidean distance is:

[0032] R(i, j) = Θ (ε - ||x i -x j ||)

[0033] Where R(i,j) represents the recursive graph, Θ represents the Heaviside step function, x i represents the i-th sample, x j represents the j-th sample, and ε represents a predetermined threshold.

[0034] The beneficial effect of the above further scheme is that the periodic pattern and other complex structures in the wind power time series data can be effectively revealed, and through the recursive graph, not only the accuracy of the prediction model can be improved, but also the internal law of the wind power data can be better understood.

[0035] Further, in step S2, the calculation formula of the first self-attention layer is:

[0036]

[0037] Where X h represents the output feature vector of the previous layer network, represents the first output feature vector output by the first self-attention layer, and A tt(Q, K, V) represents an attention layer network function, Q represents a query matrix, K represents a key matrix, and V represents a value matrix;

[0038] The calculation formula of the second attention layer is:

[0039]

[0040] wherein, X h represents an output feature vector of the previous layer network, represents a first output feature vector output by the second self-attention layer, A tt (Q, K, V) represents an attention layer network function, Q represents a query matrix, K represents a key matrix, and V represents a value matrix;

[0041] The calculation formula of the first cross-attention layer is:

[0042]

[0043] wherein, represents a first cross-feature vector output by the first cross-attention layer, represents a first output feature vector output by the first self-attention layer, represents a first output feature vector output by the second self-attention layer, A tt (Q, K, V) represents an attention layer network function, Q represents a query matrix, K represents a key matrix, and V represents a value matrix;

[0044] The calculation formula of the second cross-attention layer is:

[0045]

[0046] wherein, represents a second cross-feature vector output by the second cross-attention layer, represents a first output feature vector output by the first self-attention layer, represents a first output feature vector output by the second self-attention layer, A tt (Q, K, V) represents an attention layer network function, Q represents a query matrix, K represents a key matrix, and V represents a value matrix;

[0047] The calculation formula of the third self-attention layer is:

[0048]

[0049] wherein, represents a third output feature vector output by the third self-attention layer, X cross represents a second cross-feature vector and a first cross-feature vector The third cross feature vector formed by splicing.

[0050] The beneficial effects of the above further scheme are that the self-attention layer and the cross-attention layer respectively play an important role in processing a single sequence and a cross-sequence task, the self-attention layer improves the expression ability and efficiency of the model through global dependency modeling and dynamic context modeling, and the cross-attention layer improves the performance of the multi-modal task and the sequence generation task through cross-modal information fusion and enhanced information interaction.

[0051] Further, in step S3, the time series data repairing module is a long short memory network, and the long short memory network includes a forget gate, an input gate and an output gate.

[0052] The attention fusion feature is processed using the time series repairing module to obtain a sample label corresponding to the wind power time series data, specifically including:

[0053] S31, the attention fusion feature input at time t and the hidden state at time t-1 are obtained, and the forget gate at time t is calculated according to the attention fusion feature input at time t and the hidden state at time t-1.

[0054] S32, the input gate at time t and the candidate memory state at time t are calculated according to the attention fusion feature input at time t and the hidden state at time t-1.

[0055] S33, the output gate at time t is calculated according to the attention fusion feature input at time t and the hidden state at time t-1.

[0056] S34, the hidden state at time t is calculated according to the output gate at time t and the candidate memory state at time t.

[0057] S35, the sample label is determined according to the forget gate at time t, the input gate at time t, the candidate memory state at time t, the input gate at time t and the candidate memory state at time t.

[0058] Wherein, t is a positive integer greater than 1.

[0059] Further, in step S31, the calculation formula used for calculating the forget gate at time t according to the attention fusion feature input at time t and the hidden state at time t-1 is:

[0060] f t =σ(W f ·[h t-1 ,x t ]+b f )

[0061] Wherein, f t represents the forget gate at time t, W f and bf is a parameter representing the forget gate, σ represents a sigmoid function, [h t-1 ,x t ] represents a vector formed by concatenating the hidden state h t-1 at the t-1 time and the attention fusion feature x t input at the t time.

[0062] In step S32, the calculation formula of the input gate at the t time is calculated according to the attention fusion feature input at the t time and the hidden state at the t-1 time.

[0063] i t = σ (W i · [h t-1 ,x t ] + b i )

[0064] where i t represents the input gate at the t time, W i and b i represent parameters of the input gate, σ represents a sigmoid function, [h t-1 ,x t ] represents a vector formed by concatenating the hidden state h t-1 at the t-1 time and the attention fusion feature x t input at the t time.

[0065] The calculation formula of the candidate memory state at the t time is calculated according to the attention fusion feature input at the t time and the hidden state at the t-1 time.

[0066] c t = tanh (W c · [h t-1 ,x t ] + b c )

[0067] where c t represents the candidate memory state at the t time, W c and b c represent parameters of the candidate memory state, tanh represents a hyperbolic tangent function, [h t-1 ,x t ] represents a vector formed by concatenating the hidden state h t-1 at the t-1 time and the attention fusion feature x t input at the t time.

[0068] In step S33, the calculation formula used to calculate the output gate at the t time is calculated according to the attention fusion feature input at the t time and the hidden state at the t-1 time.

[0069] o t = sigma(W o ·[h t-1 ,x t ]+b o )

[0070] wherein o t represents the output gate at time t, W o and b o represent the parameters of the output gate, sigma represents the sigmoid function, and [h t-1 ,x t ] represents a vector formed by concatenating the hidden state h t-1 at time t-1 and the attention fusion feature x t input at time t;

[0071] In S34, the hidden state at time t is calculated according to the output gate at time t and the candidate memory state at time t, and the calculation formula used is:

[0072] h t = o t ⊙tanh(c t )

[0073] wherein h t represents the hidden state at time t, represents element multiplication, o t represents the output gate at time t, c t represents the candidate memory state at time t, and tanh(c t ) represents the result of the candidate memory state at time t after being activated by the tanh function.

[0074] The above further scheme has the beneficial effect that the LSTM effectively solves the problem of the traditional RNN in processing long sequences through its unique memory unit and gating mechanism, and improves the ability of the model to process long-term dependencies. The LSTM performs well in many fields such as time series prediction and natural language processing, and has flexibility, robustness and good generalization ability. BRIEF DESCRIPTION OF DRAWINGS

[0075] Figure 1 is a flowchart of an electric energy meter abnormal data repair method based on dual-channel feature fusion.

[0076] Figure 2 is a schematic diagram of the internal connection of the dual-channel feature fusion module.

[0077] Figure 3 is a schematic diagram of the internal structure of the self-attention layer.

[0078] Figure 4It is a model structure schematic diagram of an electric energy meter abnormal data repairing method based on double-channel feature fusion.

[0079] Figure 5 It is a structure schematic diagram of a double-channel feature fusion module.

[0080] Figure 6 It is a structure schematic diagram of an LSTM. DETAILED DESCRIPTION

[0081] The application will be further described below in combination with the drawings and specific embodiments.

[0082] As Figure 1 shown, an electric energy meter abnormal data repairing method based on double-channel feature fusion includes the following steps:

[0083] S1, wind power time series data of a wind farm is obtained, Markov transition field is used to extract features of the wind power time series data to obtain short-term features, and recursive graph method is used to extract features of the wind power time series data to obtain periodic features.

[0084] In this embodiment, Markov transition field is used to extract features of the wind power time series data to obtain short-term features, which specifically includes:

[0085] S11, the wind power time series data is divided to obtain a subsequence set of the wind power time series data;

[0086] S12, the state transition probability between a first subsequence and a second subsequence in the subsequence set is calculated;

[0087] The first subsequence and the second subsequence are different, and the state transition probability includes one-step transition probability and multi-step transition probability;

[0088] S13, a Markov transition field is generated according to the one-step transition probability and the multi-step transition probability, and the Markov transition field is taken as the short-term features.

[0089] In this embodiment, in step S12, the calculation formula used to calculate the state transition probability between the first subsequence and the second subsequence in the subsequence set is:

[0090]

[0091] wherein, P i,j is the multi-step transition probability, representing the probability that an element located in the subsequence q i at this moment makes a multi-step transition to the subsequence q j at the next moment, P i,i-1 represents the probability that a state in the time series transitions to another state between adjacent time points i and i-1, and pi,j denotes the probability of transitioning from one state to another state between non-adjacent time points i and j in a time series, p i,i-1 denotes a one-step state transition probability (p i,i-1 ∈P i,i-1 ), q i denotes a sub-sequence reflecting the sample state at time point i, x t denotes an element in the sub-sequence at a certain time point, i denotes a specific time point i, and j denotes a specific time point different from i.

[0092] In step S13, according to the one-step transition probability and the multi-step transition probability, the calculation formula used to generate the Markov transition field is:

[0093]

[0094] wherein, P i,j is a multi-step transition probability, which denotes the probability that an element located in the sub-sequence q i at this moment makes a multi-step transition to the sub-sequence q j at the next time point, and M denotes the Markov transition field.

[0095] In this embodiment, the recurrent graph is used to extract features from the wind power time series data to obtain periodic features, which specifically include:

[0096] S14, calculating the Euclidean distance between the first wind power time sample point and the second wind power time sample point in the wind power time series data;

[0097] The first wind power time sample point and the second wind power time sample point are different;

[0098] S15, generating a recurrent graph according to the Euclidean distance, and taking the recurrent graph as a periodic feature.

[0099] In this embodiment, in step S15, the calculation formula used to generate the recurrent graph according to the Euclidean distance is:

[0100] R(i,j)=Θ(ε-||x i -x j ||)

[0101] wherein, R(i,j) denotes the recurrent graph, Θ denotes the Heaviside step function, x i denotes the i-th sample, x j denotes the j-th sample, and ε denotes a preset threshold.

[0102] For example, Markov transfer fields are a class of methods that convert one-dimensional time-series signals into two-dimensional images. Assume that wind power time-series data is defined as X = {x1, x2, x3, ..., x...} n}, where x i The image encoding steps for the i-th signal in the wind power time series data are as follows:

[0103] First, the wind power time series data X is divided into Q = {q1,q2,...,q}. n There are} subsequences. Next, the state transition probability between the first and second subsequences in the subsequence set is calculated, and a Markov transition field is generated based on the single-step transition probability and the multi-step transition probability. The Markov transition field is then used as a short-term feature.

[0104] Recursive graph methods are a class of methods that convert one-dimensional time series signals into two-dimensional images. Assume that wind power time series data is defined as X = {x1, x2, x3, ..., x...} n}, where x i The image encoding steps for the i-th signal in the wind power time series data are as follows:

[0105] First, the Euclidean distance between the first and second wind power time sample points in the wind power time series data is calculated. Then, a recursive graph is generated based on the Euclidean distance, and this graph is used as a periodic feature. In the recursive graph, the i-th sample x... i and the j-th sample x j If the distance between two points is less than a preset threshold ε, then the two points are considered to be close to each other, and the corresponding position R(i,j) on the recursion graph is marked as 1; otherwise, it is marked as 0. Θ represents the Heaviside step function, and the magnitude of ε can be determined manually.

[0106] S2. Construct a dual-channel feature fusion module to fuse short-term and periodic features to obtain attention-fused features. The dual-channel feature fusion module includes a first self-attention layer, a second attention layer, a first cross-attention layer, a second cross-attention layer, and a third self-attention layer. The first self-attention layer and the second attention layer are set in parallel. The first cross-attention layer is connected to the first self-attention layer and the second attention layer, the second cross-attention layer is connected to the first self-attention layer and the second attention layer, and the third attention layer is connected to the first cross-attention layer and the second cross-attention layer.

[0107] In this embodiment, the calculation formula for the first self-attention layer is:

[0108]

[0109] Among them, X han output feature vector of the previous layer network, a first output feature vector output by the first self-attention layer, A tt (Q, K, V) represents an attention layer network function, Q represents a query matrix, K represents a key matrix, and V represents a value matrix;

[0110] The calculation formula of the second attention layer is:

[0111]

[0112] wherein, X h an output feature vector of the previous layer network, a first output feature vector output by the second self-attention layer, A tt (Q, K, V) represents an attention layer network function, Q represents a query matrix, K represents a key matrix, and V represents a value matrix;

[0113] The calculation formula of the first cross-attention layer is:

[0114]

[0115] wherein, a first cross feature vector output by the first cross-attention layer, a first output feature vector output by the first self-attention layer, a first output feature vector output by the second self-attention layer, A tt (Q, K, V) represents an attention layer network function, Q represents a query matrix, K represents a key matrix, and V represents a value matrix;

[0116] The calculation formula of the second cross-attention layer is:

[0117]

[0118] wherein, a second cross feature vector output by the second cross-attention layer, a first output feature vector output by the first self-attention layer, a first output feature vector output by the second self-attention layer, A tt (Q, K, V) represents an attention layer network function, Q represents a query matrix, K represents a key matrix, and V represents a value matrix;

[0119] The calculation formula of the third self-attention layer is:

[0120]

[0121] wherein, a third output feature vector representing a third self-attention layer output, X cross a third cross-feature vector formed by splicing the second cross-feature vector and the first cross-feature vector .

[0122] As shown in Figure 2 , Figure 2 is a schematic diagram of internal connection of the dual-channel feature fusion module. In Figure 2 , the dual-channel feature fusion module includes a first self-attention layer, a second attention layer, a first cross-attention layer, a second cross-attention layer, and a third self-attention layer; the first self-attention layer and the second attention layer are arranged side by side, the first cross-attention layer is connected with the first self-attention layer and the second attention layer respectively, the second cross-attention layer is connected with the first self-attention layer and the second attention layer respectively, and the third attention layer is connected with the first cross-attention layer and the second cross-attention layer respectively.

[0123] As shown in Figure 3 , Figure 3 is a schematic diagram of internal structure of the self-attention layer. In Figure 3 , “T” represents a matrix transposition operation, “X” represents a matrix multiplication operation, “+” represents a matrix addition operation, and “Scale” represents dividing the input feature vector by the 0.5 power of the K key matrix feature length. In addition, in order to obtain as many hidden features in the sample as possible, a multi-head attention mechanism can also be introduced in all attention layers, and the number of attention heads of each attention layer can be set to 16.

[0124] In this embodiment, the analysis ability of the Markov transition field to the short-term start-stop event of the wind field and the analysis ability of the recurrence graph to the long-term periodic fluctuation characteristics of the wind field are taken into account, that is, the advantages of different types of data-driven methods are fused to enhance the overall representation ability of the features. And in view of the problem that the feature fusion model causes important features to be lost under different types of feature extraction methods when using simple feature splicing, the application proposes to use a multi-attention mechanism to realize the fusion of two types of different data-driven features, that is, multi-modal reasoning. This method ensures that even if some features are not significant compared to other types of features, they can also obtain the same expression ability due to their own importance. Thus, the adverse effects of feature loss on the overall performance of the model are effectively avoided.

[0125] S3, a time series data repair module is constructed, and the attention fusion features are processed using the time series repair module to obtain sample labels corresponding to the wind power time series data; the sample labels include abnormal data and normal data.

[0126] In this embodiment, the time series data repair module is a long short memory network, and the long short memory network includes a forget gate, an input gate, and an output gate;

[0127] The attention fusion feature is processed using the time sequence repair module to obtain a sample label corresponding to the wind power time sequence data, and specifically includes:

[0128] S31, the attention fusion feature input at time t and the hidden state at time t-1 are obtained, and the forgetting gate at time t is calculated according to the attention fusion feature input at time t and the hidden state at time t-1;

[0129] S32, the input gate at time t and the candidate memory state at time t are calculated according to the attention fusion feature input at time t and the hidden state at time t-1;

[0130] S33, the output gate at time t is calculated according to the attention fusion feature input at time t and the hidden state at time t-1;

[0131] S34, the hidden state at time t is calculated according to the output gate at time t and the candidate memory state at time t;

[0132] S35, the sample label is determined according to the forgetting gate at time t, the input gate at time t, the candidate memory state at time t, the input gate at time t and the candidate memory state at time t;

[0133] Wherein, t is a positive integer greater than 1.

[0134] In this embodiment, in step S31, the forgetting gate at time t is calculated according to the attention fusion feature input at time t and the hidden state at time t-1, and the calculation formula used is:

[0135] f t =σ(W f ·[h t-1 ,x t ]+b f )

[0136] Wherein, f t represents the forgetting gate at time t, W f and b f represent the parameters of the forgetting gate, σ represents the sigmoid function, and [h t-1 ,x t ] represents a vector formed by concatenating the hidden state h t-1 at time t-1 and the attention fusion feature x t input at time t;

[0137] In step S32, the calculation formula of the input gate at time t is calculated according to the attention fusion feature input at time t and the hidden state at time t-1:

[0138] i t= σ(W i · [h t-1 , x t ] + b i )

[0139] wherein i t represents the input gate at time t, W i and b i represent parameters of the input gate, σ represents a sigmoid function, [h t-1 , x t ] represents a vector formed by concatenating the hidden state h t-1 at time t-1 and the attention fusion feature x t input at time t;

[0140] According to the attention fusion feature input at time t and the hidden state at time t-1, the calculation formula of the candidate memory state at time t is:

[0141] c t = tanh(W c · [h t-1 , x t ] + b c )

[0142] wherein c t represents the candidate memory state at time t, W c and b c represent parameters of the candidate memory state, tanh represents a hyperbolic tangent function, [h t-1 , x t ] represents a vector formed by concatenating the hidden state h t-1 at time t-1 and the attention fusion feature x t input at time t;

[0143] In step S33, according to the attention fusion feature input at time t and the hidden state at time t-1, the calculation formula used for calculating the output gate at time t is:

[0144] o t = σ(W o · [h t-1 , x t ] + b o )

[0145] wherein o t represents the output gate at time t, W o and b o represent parameters of the output gate, σ represents a sigmoid function, [h t-1 , x t ] represents a vector formed by concatenating the hidden state h t-1Attention fusion feature x of the input at time t t A vector formed by concatenating the two parts;

[0146] In S34, based on the output gate at time t and the candidate memory state at time t, the formula used to calculate the hidden state at time t is as follows:

[0147] h t =o t ⊙tanh(c t )

[0148] Among them, h t Represents the hidden state at time t, ⊙ represents element-wise multiplication, and o t c represents the output gate at time t. t tanh(c) represents the candidate memory state at time t. t ) represents the result of the candidate memory state at time t after passing through the tanh activation function.

[0149] like Figure 4 As shown, Figure 4 This is a schematic diagram of the model structure for a method to repair abnormal data in electricity meters based on dual-channel feature fusion. Figure 4 The process can be mainly divided into four modules: data preprocessing layer, feature extraction layer, LSTM layer, and abnormal data repair layer.

[0150] The data preprocessing layer is mainly used to extract a continuous wind power time series data segment X = {x1, x2, x3, ..., x...} according to requirements. n}, and then normalize it to obtain a continuous time series data X = {x1, x2, x3, ..., x} of the same length. m}, where x i ∈[0,1].

[0151] Optionally, the data preprocessing layer can be run after the wind power time series data of the wind farm is obtained in step S1, in order to normalize the obtained wind power time series data.

[0152] The feature extraction layer is a dual-channel feature fusion module. By introducing a joint training method, knowledge-driven features and data-driven features are further fused. Specifically, in step S2, a multi-attention mechanism is used to fuse the features extracted from the Markov transition field and the recursive graph, and then a joint training method is introduced to further fuse the data-driven data and knowledge-driven data.

[0153] like Figure 5 As shown, Figure 5 This is a schematic diagram of the dual-channel feature fusion module. Figure 5In this model, the input to the dual-channel feature fusion module can be the output data after the wind power time series data has been normalized by the data preprocessing layer. When processing the data, two convolutional layers can be constructed first, with the kernel size set to 5×5, the activation function set to ReLU, the pooling layer set to global average pooling 2×2, and the Dropout layer set to 0.3.

[0154] like Figure 6 As shown, Figure 6 This is a schematic diagram of the LSTM structure. The dual-channel feature fusion module primarily uses a Long Short Term Memory (LSTM) network model. Figure 6 In short-term and long-term memory networks, the forgetting gate is the main component. t Input gate i t and output gate o t The Long Short-Term Memory (LSM) network consists of three parts and operates as follows:

[0155] First, for the input data x at time t t and the hidden state h from the previous moment t-1 Calculate the forget gate f t The function of the forgetting gate is to determine the memory state c of the previous moment. t-1 Which information should be forgotten, and which should be retained? If f t If the output is close to 0, it means that the information from the previous moment needs to be forgotten; if it is close to 1, it means that the information from the previous moment needs to be retained.

[0156] Next, calculate the input gate i t And the candidate memory state c at the current moment t The role of the input gate and candidate memory states is to determine the input data x. t and the hidden state h from the previous moment t-1 Calculate a candidate memory state c t This is to determine which information needs to be retained and which information needs to be forgotten.

[0157] Finally, calculate the output gate o. t and the hidden state h at the current moment t .

[0158] S4. Use the abnormal data repair module to repair the wind power time series data with abnormal data sample labels to obtain wind power time series repaired data.

[0159] In the embodiment, when the timing data is repaired, the traditional long short memory network (LSTM) model usually directly uses the original timing feature as the input. However, when the input time series is too long and contains a large amount of information, the LSTM model may encounter stability problems and gradient disappearance problems, which limits its ability to capture long-term periodic and repetitive features of the time series. In view of this, the application first converts one-dimensional time series data into two-dimensional image data, and then converts the image data into high-dimensional short sequence features by using an improved convolutional neural network (CNN) model based on fusion features. Since the special fusion features are used as the input of the CNN model, compared with the traditional CNN model, the CNN model is more targeted. Through this conversion, the LSTM model can enhance its ability to analyze local key information, while ensuring that global periodic and repetitive features are not forgotten too early, and the analysis ability of the LSTM model for the dependence features of the time series data is enhanced.

[0160] Those skilled in the art will appreciate that the embodiments described herein are presented for the purpose of helping the reader understand the principles of the application and should be understood as not limiting the scope of protection of the application to such specific statements and embodiments. Those skilled in the art can make various other specific modifications and combinations according to the technical inspiration disclosed in the application without departing from the essence of the application, and these modifications and combinations are still within the scope of protection of the application.

Claims

1. A method for repairing abnormal data in electricity meters based on dual-channel feature fusion, characterized in that, The method includes: S1. Obtain wind power time series data from the wind farm, use Markov transition field to extract features from the wind power time series data to obtain short-term features, and use recursive graph method to extract features from the wind power time series data to obtain periodic features. S2. Construct a dual-channel feature fusion module, and use the dual-channel feature fusion module to fuse the short-term features and the periodic features to obtain attention fusion features; The dual-channel feature fusion module includes a first self-attention layer, a second self-attention layer, a first cross-attention layer, a second cross-attention layer, and a third self-attention layer; The first self-attention layer and the second self-attention layer are arranged side by side. The first cross-attention layer is connected to the first self-attention layer and the second self-attention layer respectively. The second cross-attention layer is connected to the first self-attention layer and the second self-attention layer respectively. The third self-attention layer is connected to the first cross-attention layer and the second cross-attention layer respectively. S3. Construct a time series data repair module, and use the time series data repair module to process the attention fusion features to obtain sample labels corresponding to the wind power time series data; The sample labels include abnormal data and normal data; S4. Use the outlier data repair module to repair the wind power time series data with the sample label being outlier, and obtain the wind power time series repaired data. The calculation formula for the first cross-attention layer is: in, This represents the first cross-feature vector output by the first cross-attention layer. This represents the first output feature vector of the first self-attention layer. This represents the first output feature vector of the second self-attention layer. A tt ( Q , K , V () represents the attention layer network function. Q Represents the query matrix. K Represents the key matrix, V Represents a value matrix; The calculation formula for the second cross-attention layer is: in, This represents the second cross-feature vector output by the second cross-attention layer; The calculation formula for the third self-attention layer is as follows: in, This represents the third output feature vector of the third self-attention layer. This indicates that the second cross feature vector and the first cross feature vector The third cross feature vector formed by splicing.

2. The method according to claim 1, characterized in that, In step S1, the step of using a Markov transition field to extract features from the wind power time series data to obtain short-term features specifically includes: S11. Divide the wind power time series data to obtain a set of subsequences of the wind power time series data; S12. Calculate the state transition probability between the first subsequence and the second subsequence in the set of subsequences; The first subsequence and the second subsequence are different, and the state transition probability includes single-step transition probability and multi-step transition probability; S13. Generate a Markov transition field based on the single-step transition probability and the multi-step transition probability, and use the Markov transition field as the short-term feature.

3. The method according to claim 2, characterized in that, In step S12, the formula used to calculate the state transition probability between the first subsequence and the second subsequence in the subsequence set is as follows: in, The multi-step transition probability indicates that the current position is within a subsequence. Elements within the sequence transition to subsequences in multiple steps at the next time step. The probability within, Representing adjacent moments in a time series and The probability of multi-step state transitions from one state to another. Representing non-adjacent moments in a time series and The probability of transitioning from one state to another. This represents the probability of a state transition from one state to another between adjacent time points in a time series. , Indicates time The subsequence below reflects the state of the sample at that moment. This represents an element in a subsequence at a certain time. Indicates a specific moment , Indicates and Different specific moments ; In step S13, the calculation formula used to generate the Markov transition field based on the single-step transition probability and the multi-step transition probability is as follows: in, This indicates a Markov transition field.

4. The method according to claim 1, characterized in that, In step S1, the step of using a recursive graph to extract features from the wind power time series data to obtain periodic features specifically includes: S14. Calculate the Euclidean distance between the first wind power time sample point and the second wind power time sample point in the wind power time series data. The first wind power time sample point and the second wind power time sample point are different; S15. Generate a recursive graph based on the Euclidean distance, and use the recursive graph as the periodic feature.

5. The method according to claim 4, characterized in that, In step S15, the calculation formula used to generate the recursive graph based on the Euclidean distance is: in, Represents a recursive graph. Represents the Heaviside step function. Indicates the first One sample, Indicates the first One sample, This indicates a preset threshold.

6. The method according to claim 1, characterized in that, In step S2, the calculation formula for the first self-attention layer is: in, This represents the output feature vector of the previous layer of the network. This represents the first output feature vector of the first self-attention layer. A tt ( Q , K , V () represents the attention layer network function. Q Represents the query matrix. K Represents the key matrix, V Represents a value matrix; The calculation formula for the second self-attention layer is: in, This represents the output feature vector of the previous layer of the network. This represents the first output feature vector of the second self-attention layer. A tt ( Q , K , V () represents the attention layer network function. Q Represents the query matrix. K Represents the key matrix, V Represents a value matrix.

7. The method according to claim 1, characterized in that, In step S3, the time-series data repair module is a long short-term memory network, and the long short-term memory network includes a forget gate, an input gate, and an output gate. The step of using the time-series data repair module to process the attention fusion features to obtain sample labels corresponding to the wind power time-series data specifically includes: S31. Obtain the attention fusion features of the input at time t and the hidden state at time t-1, and calculate the forget gate at time t based on the attention fusion features of the input at time t and the hidden state at time t-1. S32. Based on the attention fusion features input at time t and the hidden state at time t-1, calculate the input gate at time t and the candidate memory state at time t. S33. Calculate the output gate at time t based on the attention fusion features input at time t and the hidden state at time t-1. S34. Calculate the hidden state at time t based on the output gate at time t and the candidate memory state at time t; S35. Determine the sample label based on the forget gate at time t, the input gate at time t, the candidate memory state at time t, the input gate at time t, and the candidate memory state at time t; Where t is a positive integer greater than 1.

8. The method according to claim 7, characterized in that, In step S31, the formula used to calculate the forget gate at time t based on the attention fusion features input at time t and the hidden state at time t-1 is as follows: in, This represents the forget gate at time t. and The parameters representing the forget gate, This represents the sigmoid function. This represents the hidden state at time t-1. Attention fusion features of the input at time t A vector formed by concatenating the two parts; In step S32, the formula for calculating the input gate at time t based on the attention fusion features input at time t and the hidden state at time t-1 is as follows: in, This represents the input gate at time t. and Indicates the parameters of the input gate. This represents the sigmoid function. This represents the hidden state at time t-1. Attention fusion features of the input at time t A vector formed by concatenating the two parts; The formula for calculating the candidate memory state at time t based on the attention fusion features input at time t and the hidden state at time t-1 is as follows: in, This represents the candidate memory state at time t. and Parameters representing candidate memory states, Represents the hyperbolic tangent function. This represents the hidden state at time t-1. Attention fusion features of the input at time t A vector formed by concatenating the two parts; In step S33, the formula used to calculate the output gate at time t based on the attention fusion features input at time t and the hidden state at time t-1 is as follows: in, This represents the output gate at time t. and This represents the parameters of the output gate. This represents the sigmoid function. This represents the hidden state at time t-1. Attention fusion features of the input at time t A vector formed by concatenating the two parts; In step S34, the calculation formula used to calculate the hidden state at time t based on the output gate at time t and the candidate memory state at time t is as follows: in, This represents the hidden state at time t. Indicates element-wise multiplication. This represents the output gate at time t. This represents the candidate memory state at time t. This indicates the evolution of the candidate memory state at time t. The result after activation function.

Citation Information

Patent Citations

  • Taking identification method and device based on double-channel cross attention mechanism

    CN113936339A

  • Detection method using fusion network based on attention mechanism, and terminal device

    US11222217B1