Power data quality evaluation method and system based on anomaly detection
By constructing a static graph structure and dynamic adjacency matrix, the problem of time changes in variable dependence in power data is solved, accurate abnormal detection and quality evaluation of power data is achieved, and the model's adaptability in a rapidly changing environment is improved.
Patent Information
- Application Number
- CN202510290737.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-12
- Publication Date
- 2025-04-08
- Estimated Expiration
- 2045-03-12
AI Technical Summary
The prior art fails to fully consider the time variation of variable dependencies in the detection of power data anomalies, resulting in large detection errors in rapid change or non-stationary environments, affecting the accuracy of data quality evaluation.
By constructing data preprocessing models, dynamic and static data calculation models, anomaly detection models and data quality evaluation models, we generate static graph structures and dynamic adjacency matrixes, identify abnormal user data, use static graph structures to capture long-term trends, and dynamic matrix to capture short-term changes, enhancing the model's adaptability to rapidly changing environments.
Accurate abnormal detection and quality evaluation of power data is achieved, the model's adaptability in rapidly changing or non-stationary environments is improved, and detection errors are reduced.
Smart Images

Figure CN119782966A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a method and system for evaluating power data quality based on abnormality detection, and belongs to the technical field of power data processing. Background Art
[0002] One of the key indicators that affects the quality of power data is outlier data, which has a significant impact on the accuracy, completeness, and self-consistency of power data quality. For example: 1. The existence of outlier data in power consumption will reduce the accuracy of data quality assessment. 2. When data mining is performed on a data set containing a large number of outliers, the results cannot accurately reflect the characteristics of the data. 3. Outlier data will affect the judgment and decision-making of power system dispatchers and even threaten the safe operation of the system. 4. If outlier data is used as modeling data, it will interfere with the change rules and affect the training accuracy. Therefore, anomaly detection in power data has become a core issue in data quality assessment research.
[0003] Furthermore, the Chinese patent (Announcement No.: CN118378023B) proposes a method for detecting anomalies in power data based on graph computing, including extracting and preprocessing power big data, building a graph model of power data, extracting structural and attribute features, using graph computing algorithms for anomaly detection, and visualizing the output results. By optimizing preprocessing operations, improving graph model construction methods, and improving the application of graph computing in anomaly detection, the accuracy, comprehensiveness, and efficiency of power data anomaly detection are improved.
[0004] The above scheme uses a data graph model to extract structural and attribute features, but does not take into account the variable dependencies in the power data, which will change over time. For example, factors such as seasonal fluctuations will have a significant impact on power data. Therefore, the above graph calculation method has limitations in capturing these dynamic changes and cannot adapt to the rapid changes or non-stationary environment in the power system, resulting in large errors in the detection of power data anomalies, affecting the quality evaluation of power data.
[0005] The information disclosed in this Background Art is only for understanding the background of the inventive concept and therefore it may include information that does not constitute the prior art. Summary of the invention
[0006] In response to the above problem or one of the above problems, an object of the present invention is to provide a method and system for evaluating power data quality based on anomaly detection. By constructing a data preprocessing model, a dynamic and static data calculation model, an anomaly detection model, and a data quality evaluation model, a static graph structure and a dynamic adjacency matrix are generated, abnormal user data is identified, and power data quality evaluation based on anomaly detection is completed. Therefore, the static graph structure can be used to capture long-term trends, and the dynamic adjacency matrix can be used to flexibly adapt to local dependency structures that change over time, capture short-term dynamic changes, and provide a variable interaction picture, so that the variable dependency relationship in the power data can be fully considered to change over time, and the model's adaptability to rapidly changing or non-stationary environments in the power system can be effectively enhanced. Therefore, accurate power data anomaly detection results can be obtained, and then the power data can be accurately evaluated in quality.
[0007] In response to the above problem or one of the above problems, the second purpose of the present invention is to provide a power data quality evaluation method and system based on anomaly detection, which effectively captures the dynamic and static abnormal patterns of power data through adaptive weight allocation and multi-head attention mechanism, improves the robustness and generalization ability of the model, reduces overfitting, does not require manual setting of thresholds, reduces human influence, thereby improving the accuracy of anomaly detection and the adaptability to complex scenarios; and decomposes complex decision-making problems into a hierarchical structure through the hierarchical analysis method, combines abnormal user information, constructs a judgment matrix and calculates the weight vector, thereby obtaining a more scientific, systematic and reliable power data quality evaluation system, providing theoretical support for power system data management.
[0008] To achieve one of the above purposes, the first technical solution of the present invention is: A method for evaluating power data quality based on anomaly detection comprises the following steps: Step 1: clean the power data to be evaluated through a pre-built data preprocessing model to obtain the power consumption data of multiple users; Step 2: Using the pre-built dynamic and static data calculation model, based on the similarity of electricity consumption between users, the electricity consumption data of multiple users are processed to construct a static graph structure and a dynamic adjacency matrix; The static graph structure has a number of nodes and connecting edges, which are used to smooth short-term fluctuations and capture long-term trends; the nodes represent users, and the connecting edges represent the similarities between users; Dynamic adjacency matrix, which is used to flexibly adapt to the local dependency structure that changes over time, capture short-term dynamic changes, and provide a picture of variable interactions; Step 3: Use the pre-built anomaly detection model to process the static graph structure and dynamic adjacency matrix to capture the similarities between users and identify abnormal user data; Step 4: Use the pre-built data quality evaluation model to evaluate the power data based on abnormal user data, obtain the quality evaluation results, and complete the power data quality evaluation based on anomaly detection.
[0009] The present invention generates a static graph structure and a dynamic adjacency matrix by constructing a data preprocessing model, a dynamic and static data calculation model, a anomaly detection model, and a data quality evaluation model, identifies abnormal user data, and completes power data quality evaluation based on anomaly detection. Therefore, the static graph structure can be used to capture long-term trends, and the dynamic adjacency matrix can be used to flexibly adapt to the local dependency structure that changes with time, capture short-term dynamic changes, and provide a variable interaction picture, so that the variable dependency relationship in the power data can be fully considered to change with time, and the dynamic changes of data can be captured in time, effectively enhancing the model's adaptability to rapidly changing or non-stationary environments in the power system. Therefore, accurate power data anomaly detection results can be obtained, and then the power data can be accurately evaluated in quality.
[0010] Furthermore, the dynamic adjacency matrix of the present invention not only retains the capture of long-term dependencies, but also can respond sensitively to short-term dynamic changes, providing more reliable support for real-time monitoring and decision-making of power systems. Furthermore, by regularly updating the static graph structure and the dynamic adjacency matrix, the present invention can more accurately reflect the instantaneous interaction pattern between variables, ensuring high sensitivity to current conditions, thereby improving the accuracy of anomaly detection and adaptability to complex scenarios.
[0011] As the preferred technical measures: Step 1: The method of cleaning the power data to be evaluated by using the pre-built data preprocessing model to obtain the power consumption data of multiple users is as follows: Obtaining power data to be evaluated, where the power data is data sampled daily and involves multiple users; Clean and standardize the power data, remove the power consumption that exceeds the set range, and obtain the power standard data; Fill in the missing data in the power standard data to obtain complete power data; The complete electricity data is split according to user attributes to obtain electricity consumption data of multiple users.
[0012] As the preferred technical measures: Step 2: Using the pre-built dynamic and static data calculation model, based on the similarity of electricity consumption between users, the electricity consumption data of multiple users is processed, and the method of constructing a static graph structure is as follows: The electricity consumption data of each user is summed over a one-week period to smooth short-term fluctuations and capture long-term trends, thus obtaining the total weekly electricity consumption of several users. Normalize the total weekly electricity consumption of several users and construct multiple user electricity consumption vectors to ensure that the electricity consumption data of different users are on the same scale; Based on multiple user power consumption vectors, calculate the angle value between any two user power consumption vectors to obtain angle information; According to the angle information, the cosine similarity between each user and all remaining users is calculated to obtain similarity data; Based on the similarity data, the top M users with the highest cosine similarity are selected as the neighbor nodes of the user, and the cosine similarity is used as the weight of the connection edge to indicate the strength of the similarity; Use the connection edge to connect the user and neighbor nodes to obtain the static initial graph structure of the user; Concatenate the static initial graph structures of all users to obtain a complete graph structure; The weekly electricity consumption data of users is used as feature vectors to establish feature matrix and static adjacency matrix; Based on the feature matrix and the static adjacency matrix, the complete graph structure is assigned to obtain the static graph structure.
[0013] As the preferred technical measures: Step 2: Using the pre-built dynamic and static data calculation model, based on the electricity consumption similarity between users, the electricity consumption data of multiple users are processed to construct a dynamic adjacency matrix as follows: Set different sampling time lengths according to the electricity consumption characteristics of different users; The sampling period is half a month, one month or one quarter; According to the sampling time length, the user's electricity consumption data is divided into a window length, that is, the user's electricity consumption data within a time period; According to the window length, the daily electricity consumption data of each user is represented as a vector, and the electricity consumption matrix about the window length is obtained; According to the power consumption matrix and based on the power consumption similarity between users, an adjacency matrix with respect to the window length is set, so as to obtain a dynamic adjacency matrix between users.
[0014] As the preferred technical measures: Step 3: Use the pre-built anomaly detection model to process the static graph structure and dynamic adjacency matrix to capture the similarities between users and identify abnormal user data as follows: Obtain a static graph structure, which includes a feature matrix and a static adjacency matrix; According to the feature matrix and the static adjacency matrix, obtain the feature vector of a node and the feature vector of the neighboring node; Using the trained graph attention network, the feature vector of a node and the feature vectors of neighboring nodes are weighted averaged to obtain the static feature vector of the node. In order to capture the dynamic dependencies in the power system that change over time, the power consumption matrix corresponding to the window length is obtained based on the dynamic adjacency matrix; Using the graph attention network, the power consumption matrix is convolved with the graph attention network to obtain several feature vectors for each user; Averaging several eigenvectors yields a comprehensive dynamic eigenvector: The static feature vector and the dynamic feature vector are concatenated together to form a new concatenated feature vector, which combines the static attributes and dynamic attributes of the user; The concatenated feature vector is input into a multi-layer perceptron and classified into two categories through an activation function to obtain the final classification probability of the user; the anomaly detection probability score of each user is a decimal between 0 and 1, indicating the probability of the user being abnormal; If the final classification probability is greater than the set abnormal threshold, the user is determined to be an abnormal user and the number of abnormal users is counted; otherwise, the user is determined to be a normal user.
[0015] As the preferred technical measures: Step 4: Use the pre-built data quality evaluation model to evaluate the power data based on abnormal user data. The method for obtaining the quality evaluation result is as follows: Select several indicators for power data quality evaluation, including integrity indicator, uniqueness indicator, timeliness indicator and accuracy indicator; The analytic hierarchy process is used to construct the corresponding weight matrix according to the influence of integrity index, uniqueness index, timeliness index and accuracy index on the quality of power data. Based on the weight matrix, set the judgment matrix; Standardize each column of the judgment matrix, sum the standardized elements row by row, and finally standardize the summed results to obtain the weight vector; Calculate the specific values of the completeness index, uniqueness index, timeliness index, and accuracy index to obtain the dimension scores of the four indicators; The dimension scores of the four indicators are multiplied by the weight vector to calculate the power data quality score; According to the power data quality rating table, the power data quality score is rated to obtain the quality evaluation result.
[0016] As the preferred technical measures: The method for calculating the specific value of the integrity index is as follows: Obtain the electricity consumption data of multiple users and get the total number of data records; Based on the data record integrity judgment mechanism, it is judged whether each record in the power consumption data contains necessary field information, and the number of first complete records is obtained; The data record integrity judgment mechanism refers to whether each record in the data set contains necessary field information; if a record lacks a certain necessary field information, it is considered an incomplete data record; the necessary field information includes timestamp, voltage, current and power; Based on the time series frequency integrity judgment mechanism, it is judged whether the records in the power consumption data are sampled and recorded according to the expected time intervals, and the number of second complete records is obtained; The time series frequency integrity judgment mechanism refers to whether the records in the data set are sampled and recorded at the expected time intervals; if the data at some time points are missing, or the time intervals of the records are uneven, it will be considered that the frequency of the time series is incomplete; Add the number of the first complete record and the number of the second complete record to obtain the number of non-empty records that meet the conditions; Divide the number of non-empty records by the total number of data records to obtain the specific value of the integrity index; Or / and, the method for calculating the specific value of the uniqueness index is as follows: Obtain the electricity consumption data of multiple users and get the total number of data records; Based on the numerical uniqueness judgment mechanism, it is judged whether each record in the power consumption data is unique in certain key fields, and the number of unique data is obtained; The uniqueness judgment mechanism of numerical values means that each record does not repeat in certain key fields; certain key fields include timestamp, device ID and user ID; Based on the number of unique data and the total number of data records, the specific value of the uniqueness index is calculated; Or / and, the method for calculating the specific value of the timeliness index is as follows: Obtain the electricity consumption data of multiple users and get the total number of data records; Based on the timeliness judgment mechanism, it is determined whether the timestamp of each record in the electricity consumption data increases monotonically, and the number of timeliness errors is obtained; The timeliness judgment mechanism is used to measure whether the data is recorded in a timely manner and at the expected time interval, that is, the time of each record must be later than the time of the previous record; if it is found that the timestamp does not meet the monotonicity principle, it is considered a timing error; Based on the total number of data records and the number of timeliness errors, the specific value of the timeliness index is calculated; Or / and, the method to calculate the specific value of the accuracy index is as follows: Obtain the number of abnormal users and the electricity consumption data of multiple users, and obtain the total number of data records; Based on the accuracy index judgment mechanism, find the number of abnormal data; The abnormal data includes invalid data, data with incorrect format, and data with unreasonable content; Add the number of abnormal data and the number of abnormal users to get the number of abnormal records; Based on the number of abnormal records and the total number of data records, the specific value of the accuracy index is obtained.
[0017] As the preferred technical measures: Based on the weight matrix, the method of setting the judgment matrix is as follows: Step 11, constructing an initial judgment matrix about the integrity index, uniqueness index, timeliness index and accuracy index based on the weight matrix; Step 12, calculating the maximum eigenvalue of the initial judgment matrix; Step 13, calculating the consistency index based on the maximum eigenvalue of the initial judgment matrix; And obtain the random consistency index by looking up the random consistency index table; Step 14, comparing the consistency index with the random consistency index to obtain a consistency ratio; Step 15, comparing the consistency ratio with the ratio threshold, specifically includes the following: When the consistency ratio is less than the ratio threshold, it means that the initial judgment matrix satisfies the consistency check, and step 16 is executed; When the consistency ratio is greater than or equal to the ratio threshold, the initial judgment matrix is reconstructed and step 12 is executed; Step 16: Use the initial judgment matrix as the final judgment matrix.
[0018] The ratio threshold is 0.1.
[0019] To achieve one of the above purposes, the second technical solution of the present invention is: A power data quality evaluation method based on anomaly detection includes the following contents: Clean and convert the power data to be evaluated to obtain the power consumption data of multiple users; Based on the adaptive weight allocation and multi-head attention mechanism of the graph attention network, the electricity consumption data of multiple users is processed to construct a static graph structure and a dynamic adjacency matrix for capturing user similarities; Process the static graph structure and dynamic adjacency matrix to identify abnormal users and count the number of abnormal users; Through the hierarchical analysis method, combined with abnormal users and the number of abnormal users, the judgment matrix is constructed and the weight vector is calculated to evaluate the power data, obtain the quality evaluation results, and complete the power data quality evaluation based on anomaly detection.
[0020] The present invention uses adaptive weight allocation and multi-head attention mechanism to effectively capture dynamic and static abnormal patterns of power data, improve the robustness and generalization ability of the model, reduce overfitting, and eliminate the need to manually set thresholds, thereby reducing human influence, thereby improving the accuracy of anomaly detection and the ability to adapt to complex scenarios; and uses the hierarchical analysis method to decompose complex decision-making problems into a hierarchical structure, combine abnormal user information, construct a judgment matrix and calculate the weight vector, thereby obtaining a more scientific, systematic and reliable power data quality evaluation system, providing theoretical support for power system data management.
[0021] To achieve one of the above purposes, the third technical solution of the present invention is: A power data quality evaluation system based on anomaly detection, comprising: one or more processors; A storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the above-mentioned power data quality evaluation method based on abnormality detection.
[0022] Compared with the prior art solutions, the present invention has the following beneficial effects: The present invention generates a static graph structure and a dynamic adjacency matrix by constructing a data preprocessing model, a dynamic and static data calculation model, an anomaly detection model, and a data quality evaluation model, identifies abnormal user data, and completes the power data quality evaluation based on anomaly detection, so that it can fully consider that the variable dependency relationship in the power data will change over time. At the same time, the present invention uses a static graph structure to capture long-term trends, uses a dynamic adjacency matrix to flexibly adapt to local dependency structures that change over time, captures short-term dynamic changes, and can provide a variable interaction picture, so that the model can effectively enhance its adaptability to rapidly changing or non-stationary environments in the power system, thereby obtaining accurate power data anomaly detection results, and then effectively performing accurate quality evaluation on power data.
[0023] Furthermore, the dynamic adjacency matrix of the present invention not only retains the capture of long-term dependencies, but also can respond sensitively to short-term dynamic changes, providing more reliable support for real-time monitoring and decision-making of power systems. Furthermore, by regularly updating the static graph structure and the dynamic adjacency matrix, the present invention can more accurately reflect the instantaneous interaction pattern between variables, ensuring high sensitivity to current conditions, thereby improving the accuracy of anomaly detection and adaptability to complex scenarios.
[0024] Furthermore, the present invention effectively captures the dynamic and static abnormal patterns of power data through adaptive weight allocation and multi-head attention mechanism, improves the robustness and generalization ability of the model, reduces overfitting, eliminates the need to manually set thresholds, and reduces human influence, thereby improving the accuracy of anomaly detection and the ability to adapt to complex scenarios; and decomposes complex decision-making problems into a hierarchical structure through the hierarchical analysis method, combines abnormal user information, constructs a judgment matrix and calculates weight vectors, thereby obtaining a more scientific, systematic and reliable power data quality evaluation system, providing theoretical support for power system data management. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 A schematic diagram of a flow chart of the power data quality evaluation method of the present invention; Figure 2 A schematic diagram of a framework for constructing a power data quality evaluation system according to the present invention. DETAILED DESCRIPTION
[0026] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0027] On the contrary, the present invention covers any substitution, modification, equivalent method and scheme made on the essence and scope of the present invention as defined by the claims. Further, in order to make the public have a better understanding of the present invention, some specific details are described in detail in the following detailed description of the present invention. Those skilled in the art can fully understand the present invention without the description of these details.
[0028] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which the present invention pertains. The terms used herein are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "or / and" as used herein includes any and all combinations of one or more of the associated listed items.
[0029] like Figure 1 As shown, the first specific embodiment of the power data quality evaluation method based on anomaly detection of the present invention is: A method for evaluating power data quality based on anomaly detection comprises the following steps: Step 1: clean the power data to be evaluated through a pre-built data preprocessing model to obtain the power consumption data of multiple users; Step 2: Using the pre-built dynamic and static data calculation model, based on the similarity of electricity consumption between users, the electricity consumption data of multiple users are processed to construct a static graph structure and a dynamic adjacency matrix; The static graph structure has a number of nodes and connecting edges, which are used to smooth short-term fluctuations and capture long-term trends; the nodes represent users, and the connecting edges represent the similarities between users; Dynamic adjacency matrix, which is used to flexibly adapt to the local dependency structure that changes over time, capture short-term dynamic changes, and provide a picture of variable interactions; Step 3: Use the pre-built anomaly detection model to process the static graph structure and dynamic adjacency matrix to capture the similarities between users and identify abnormal user data; Step 4: Use the pre-built data quality evaluation model to evaluate the power data based on abnormal user data, obtain the quality evaluation results, and complete the power data quality evaluation based on anomaly detection.
[0030] A second specific embodiment of the power data quality evaluation method based on anomaly detection of the present invention: A method for evaluating power data quality based on anomaly detection comprises the following steps: Step 1: Clean and convert the power data to be evaluated through a pre-built data preprocessing model to obtain the power consumption data of multiple users; Step 2: Using the pre-built dynamic and static data calculation model, based on the electricity consumption similarity between users, the electricity consumption data of multiple users are processed. Each user is regarded as a node, and the similarity between users is represented by edge connections. A graph structure is constructed to capture the similarity between users. Step 3: Use the pre-built anomaly detection model to process the graph structure, identify abnormal users, and count the number of abnormal users; Step 4: Use the pre-built data quality evaluation model to generate accuracy indicators based on abnormal users and the number of abnormal users, evaluate the power data, and complete the power data quality evaluation based on anomaly detection.
[0031] A third specific embodiment of the power data quality evaluation method based on anomaly detection of the present invention: A power data quality evaluation method based on anomaly detection includes the following contents: Clean and convert the power data to be evaluated to obtain the power consumption data of multiple users; Based on the adaptive weight allocation and multi-head attention mechanism of the graph attention network, the electricity consumption data of multiple users is processed to construct a static graph structure and a dynamic adjacency matrix for capturing user similarities; Process the static graph structure and dynamic adjacency matrix to identify abnormal users and count the number of abnormal users; Through the hierarchical analysis method, combined with abnormal users and the number of abnormal users, the judgment matrix is constructed and the weight vector is calculated to evaluate the power data, obtain the quality evaluation results, and complete the power data quality evaluation based on anomaly detection.
[0032] In this embodiment, the method for constructing a static graph structure is as follows: Before constructing the static graph structure of the graph attention network, it is necessary to calculate the cosine similarity between node i and all remaining nodes. Specifically, when using cosine similarity to calculate the similarity between two user nodes, the electricity consumption data of each user is first summed over a time span of one week to smooth short-term fluctuations and capture long-term trends.
[0033] Then, the total weekly electricity consumption is normalized to ensure that the electricity consumption data between different users are on the same scale and eliminate the impact of dimensional differences. Each user is finally represented as a vector of length 147, containing the normalized weekly electricity consumption data of the user in 147 weeks.
[0034] Next, by calculating the cosine similarity between each user and all other users, the top five users with the highest similarity are selected as neighbor nodes, and these nodes are connected with edges, and the weight of the edge is set to the value of the cosine similarity.
[0035] The graph structure constructed in this way not only reflects the user's long-term electricity consumption pattern, but also can flexibly adapt to the complexity and variability of the power system over time, providing a solid foundation for subsequent graph attention network model training and anomaly detection.
[0036] For two users' week vectors, the cosine similarity is calculated by calculating the cosine value of the angle between the two vectors , to measure their similarity, specifically defined as: (1) in, and They are vectors and vector The norm (length) of .
[0037] Here, each node is regarded as a vector. For node i, the cosine similarity between it and all other nodes is calculated, and we get , take the first five nodes with the highest values as neighbor nodes to form the initial static graph structure of the nodes, and the weight of the edge is the value of the cosine similarity between the nodes.
[0038] In this embodiment, the method for constructing a dynamic adjacency matrix is as follows: In order to further improve the ability of the graph attention network to capture the complex and changeable user power consumption patterns in the power system, this application introduces a dynamic adjacency matrix based on the static adjacency matrix. The dynamic adjacency matrix can flexibly adapt to the local dependency structure that changes over time and capture short-term dynamic changes, thereby providing a more detailed and accurate picture of variable interactions.
[0039] Specifically, instead of averaging the data set over a one-week time span, the daily data is directly divided into multiple time windows, with a total number of windows of Each window contains a size of data, where Indicates the total number of users. represents the window length, and Generally, the window length is longer, such as one month or longer. In this way, multiple time windows can be obtained, each window corresponding to the user's electricity consumption data within a time period.
[0040] Next, for each window, the daily electricity consumption data of each user is represented as a vector. Assume that The window contains days of data, then the electricity consumption of user i in this window can be expressed as a string with a length of Vector , where each element represents the power consumption of user i on a certain day in the window. The power consumption matrix of each window is ,in Represents the total number of users. Then, the similarity of data between users is used to define the adjacency matrix in each window, which is expressed as follows: (2) (3) in, Indicates the total number of users. Indicates the length of the time window (in days), represents the dimension of the feature space, represents a real number, is the threshold value; Represents the dynamic adjacency matrix of the t-th time window, with a size of , represents the connection relationship between users, Represents the reset value of the dynamic adjacency matrix of the t-th time window; represents the activation function (such as Sigmoid or ReLU), which is used to perform nonlinear transformation on the similarity score; and Represents the mapping matrix, the size is , used to map user electricity consumption data into feature space; and Represented by mapping matrix and User electricity consumption data matrix The result after mapping to the feature space is , Indicates The user electricity consumption data matrix of time windows is , where each row represents a user's daily electricity consumption vector. Specifically, we first use two different mapping functions and ,Will Mapped to the same high-dimensional space .
[0041] Next, the inner product similarity is used to obtain the similarity matrix, i.e. and , the two similarity matrices can represent the dependency of the source node on the target node and the dependency of the target node on the source node respectively, and the sum of the two represents bidirectional modeling. In order to maintain the sparsity of the adjacency matrix and prevent overfitting, a threshold is used The adjacency matrix is screened. If the similarity score of a position is greater than or equal to the threshold, the position is 1, otherwise it is 0. Usually, the threshold can be set to the average of all similarity scores in all adjacency matrices. That is the Dynamic adjacency matrix between users of a window.
[0042] A fourth specific embodiment of the power data quality evaluation method based on anomaly detection of the present invention: A power data quality evaluation method based on anomaly detection includes the following contents: According to the data evaluation standard of Information Technology Data Quality Evaluation Indicators GB / T36344-2018, a dimensional framework for power system data quality evaluation was developed, which was evaluated from four dimensions: accuracy, completeness, uniqueness, and timeliness. The analytic hierarchy process was introduced to obtain a complete power data quality evaluation system by constructing a judgment matrix and calculating the weight vector.
[0043] Among them, the index of data accuracy is obtained by the graph attention network anomaly detection model. The graph attention network anomaly detection model is constructed based on the graph attention network, which at least includes a data preprocessing model, a dynamic and static data calculation model, an anomaly detection model, and a data quality evaluation model. The processing method is as follows: First, by calculating the cosine similarity, the original static graph structure and dynamic adjacency matrix of the user node are constructed; through the static graph structure and dynamic adjacency matrix, anomalies in the electricity consumption data are identified and the accuracy index is obtained; then, through the adaptive weight allocation and multi-head attention mechanism of the graph attention network, the complex patterns and anomalies in the user's daily electricity consumption data are effectively captured; by weighted summing up the features of neighboring nodes, the representation of each node is updated, and higher-level feature representations are learned through hidden layers. At the output layer, the graph attention network can generate anomaly scores and classify them, and identify anomalies by comparing the differences between predicted values and actual values.
[0044] In this embodiment, the method for processing power data using the data preprocessing model is as follows: First, the power data collected by the smart meters of the power grid is obtained. The power data is sampled daily and involves multiple users. Then, the power data is cleaned and standardized to remove the power consumption that exceeds the set range to obtain the power standard data. Then, the missing data in the power standard data is filled to obtain the power complete data. The power complete data is split according to user attributes to obtain the power consumption data of multiple users.
[0045] In this embodiment, based on the graph attention network, the method for processing power data using the dynamic and static data calculation model is as follows: Graph Attention Networks (GAT) is a type of graph neural network (GNN) used to process graph-structured data. The main feature of the graph attention network is to aggregate neighbor information by adaptively assigning different weights to different neighbor nodes, so that more complex dependencies can be captured in the graph. The graph attention network uses a multi-head attention mechanism to enhance the expressiveness of the model, so as to better capture the interaction between nodes. In the scenario of this application, the input of the graph attention network is the user's feature matrix and adjacency matrix. For user node i, its feature vector is a normalized week vector of size 147. The output of the graph attention network is the anomaly detection probability score of each user node. The anomaly detection probability score of each user is a decimal between 0 and 1, indicating the probability of the user being abnormal.
[0046] In the graph attention network, the representation of each node is calculated by taking a weighted average of the features of its neighboring nodes. The weights are automatically generated by the attention mechanism, which takes into account the edges between nodes as well as the features of the nodes themselves. Specifically, for node i, its representation can be calculated by the following formula: (4) in, is the node i in The layer representation, is the weight matrix, is the representation of neighbor node j at layer l, the set of neighbor nodes of node i, is the activation function; represents the attention weight of node i to node j, and for each node i, all attention weights will be normalized to ensure that the sum of the weights is 1.
[0047] Attention Weight The normalization is calculated as follows: (5) (6) in, is a single-layer feedforward neural network used to calculate the edge ; Representation Node and nodes similarities between; and represents the weekly power feature vector of node i and node j, It is an activation function.
[0048] In formula (6), the numerator generates a raw attention score by calculating the similarity between the features of node i and its neighbor node j. The denominator normalizes all neighbor nodes to ensure that the sum of all attention coefficients is 1, which can be interpreted as a probability distribution.
[0049] go through After the graph attention network is layered, the final representation vector of all user nodes is obtained . The user vector representation is calculated based on the static adjacency matrix. Next, in order to capture the dynamic dependencies in the power system that change over time, this application introduces a dynamic adjacency matrix to form a dynamic and static data calculation model. The specific processing method is as follows: A dynamic adjacency matrix is constructed for each time window ,in Indicates windows, total For each window, the user electricity consumption data in the window is used to perform graph attention network convolution according to formulas (4)-(6) to obtain the feature vector of each user In this way, we can obtain B feature vectors for each user in B windows.
[0050] Next, these B eigenvectors are averaged to obtain a comprehensive dynamic eigenvector , and its calculation formula is as follows: (7) Then, the eigenvector obtained from the static adjacency matrix is and dynamic feature vector Spliced together to form a new feature vector , the feature vector contains the static attributes and dynamic attributes of a user.
[0051] In this embodiment, the method of using the anomaly detection model to perform anomaly detection is as follows: The concatenated feature vector is input into a multi-layer perceptron (MLP) and classified into two categories using the activation function Sigmoid to obtain the final classification probability of the user. , and its calculation formula is as follows: (8) in and are all parameter matrices.
[0052] The activation function Sigmoid will output the value Mapped to the interval [0,1], it indicates the probability that the user is an abnormal user. If the abnormality threshold is greater than the set abnormality threshold, which can be 0.5, the user is judged as an abnormal user; otherwise, the user is judged as a normal user.
[0053] In this way, the model proposed in this application can not only capture the global stable dependency relationship using the static adjacency matrix, but also capture the local dependency structure that changes over time through the dynamic adjacency matrix, thereby improving the accuracy and robustness of anomaly detection. This method enables the model to better adapt to the complex and changing environment in the power system and provide more reliable anomaly detection results.
[0054] In this embodiment, according to the data quality evaluation model, the method for evaluating the power data quality is as follows: According to the "Information Technology Data Quality Evaluation Indicators" GB / T36344-2018, four indicators for power data quality evaluation are established, including completeness, uniqueness, timeliness, and accuracy, and quantitative standards are given. Data quality can be evaluated through these dimensional indicators.
[0055] Integrity is divided into data record integrity and time series frequency integrity.
[0056] Data record integrity refers to whether each record (i.e., a row of data) in a data set contains all the necessary information. For example, in an electric power data set, each record may include multiple fields such as timestamp, voltage, current, power, etc. If a record lacks data in a necessary field, it will be considered incomplete.
[0057] Time series frequency completeness refers to whether the records in a dataset are sampled and recorded at the expected time intervals. If data is missing at some time points, or the time intervals of the records are uneven, this will be considered as incomplete frequency of the time series. For example, if data should be recorded every hour, but data is missing for some hours, this will affect the completeness of the data.
[0058] Completeness The calculation formula is as follows: (9) in is the number of non-empty records that meet the above conditions, and N is the total number of data records.
[0059] Uniqueness is numerical uniqueness, which requires that each record has no duplication in certain key fields (such as timestamp, device ID, user ID, etc.).
[0060] Uniqueness The calculation formula is as follows: (10) in is the number of repeated values of attribute i, N is the total number of data records, and k is the number of key fields in the data set.
[0061] Timeliness is calculated based on the time series index of the time point to measure whether the data is timely and whether it is recorded at the expected time interval. The timestamps in the data should increase monotonically, that is, the time of each record should be later than the time of the previous record. If the timestamp is found to not meet the monotonicity principle, it is considered a time series error.
[0062] Timeliness The calculation formula is as follows: (11) in Indicates the number of timing check error records that meet the above conditions, and N is the total number of data records.
[0063] The accuracy index reflects the correctness and credibility of the data, which is calculated based on the number of abnormal data.
[0064] Abnormal data is divided into the following types: a) Abnormal user data detected by the GAT graph attention network. The remaining b, c, and d group data are the remaining data after removing abnormal users. b) Completely invalid data, such as data values of -99999 or other obviously wrong values; c) Format error data; d) Data with unreasonable numerical content.
[0065] The calculation formula of accuracy Acc is as follows: (12) in It indicates the number of abnormal records that meet all the above conditions, and N is the total number of data records.
[0066] In this embodiment, based on the analytic hierarchy process, the method for constructing the power data quality evaluation system is as follows: The four dimensional indicators of integrity, uniqueness, timeliness and accuracy are used as the secondary indicators (base layer) of the evaluation model. The analytic hierarchy process (AHP) is used to establish the weights of the secondary indicators of the data quality model. The user power data quality score is set as the overall target layer of the analytic hierarchy process AHP. Figure 2 .
[0067] For the data quality score Q, the calculation formula is as follows: (13) (14) (15) in, is the weight vector, is the score of each dimension, For completeness The weight value of For uniqueness The weight value of For timeliness The weight value of For accuracy The weight value of .
[0068] The scaling method Saaty1-9 is currently the most accurate method for obtaining the AHP judgment matrix verified by experiments, but consistency verification is required during the solution process. By introducing the consistency index (CI) and the random consistency index (RI), the judgment matrix D is tested by judging the consistency ratio (CR). The calculation formula is as follows: (16) (17) in, is the maximum eigenvalue of the judgment matrix D, is the total number of data records, It can be obtained by looking up the random consistency index table.
[0069] When CR < 0.1, it indicates that the judgment matrix D satisfies the consistency check, and the eigenvector solved by the judgment matrix D is That is, the weight vector of the corresponding indicator. Otherwise, it is necessary to reconstruct the judgment matrix until it passes.
[0070] In this embodiment, the method for setting the data quality rating is as follows: The availability of power data quality determines the reliability of power data mining. According to research, only data rated as good or above can support subsequent data analysis. Data rated as average or below requires immediate offline verification and inspection of the power collection system, otherwise low-quality power data cannot play a role in data mining. The classification of power data quality ratings is shown in Table 1.
[0071] Table 1: Power data quality rating table
[0072] A specific embodiment of applying the present invention to evaluate the quality of certain power data: The method for evaluating the quality of certain power data by using the quality evaluation method of the present invention is as follows: Step 1: Get the SGCC dataset collected by smart meters in the power grid. The dataset contains the daily electricity consumption data of 42,372 users. The data records the daily electricity consumption of each user for a total of about 147 weeks from January 2014 to October 2016. In the dataset, a total of 3,615 users are marked as electricity theft users, and the remaining 38,757 are non-electricity theft users. The ratio of electricity theft users to non-electricity theft users is about 1:11. In addition, there are a lot of missing data in the dataset. The possible reasons include instrument damage or electricity theft. The behavior of such users may affect the stability and reliability of the power system. Then, the electricity consumption data of each user is normalized to obtain standard electricity data.
[0073] In order to obtain different data quality scores, the total data set is divided into four sub-data sets, namely Region A, Region B, Region C, and Region D, where the ratios of abnormal and non-abnormal users are 1:3, 1:5, 1:8, and 1:10, respectively, to simulate the actual situation in different regions. Below, Region A is taken as an example, and the experimental methods for other regions are the same.
[0074] The total data set of region A is recorded as DataA. The ratio of abnormal users to non-abnormal users is 1:3. 80% of the data set is extracted as the training set, recorded as TrainA, and the abnormal ratio of 1:3 is still maintained. The remaining data is equally divided into a validation set and a test set, recorded as ValA and TestA respectively. For each data set, it contains data information such as user ID and daily electricity consumption. Since the amount of electricity data in units of days is too large, it is subsequently summed up according to a time span of one week, and each user node is recorded as a vector , which is expressed as follows:
[0075] Where k is the number of users, i is the number of weeks of electricity consumption, For weekly electricity consumption.
[0076] Step 2: The parameter setting of the graph attention network (GAT) is crucial to the accuracy and efficiency of anomaly detection. The relevant parameters include the number of hidden layers, the number of attention heads, the dimension of dynamic adjacency matrix construction, the number of iterations, the regularization term, and the loss function. The method for setting the relevant parameters is as follows: The graph attention network model usually includes multiple hidden layers to learn the high-level representation of node features. In the present invention, considering the characteristics of power data and in order to ensure the generalization ability of the model, two hidden layers are set.
[0077] The multi-head attention mechanism allows the model to learn node features from different perspectives. In the present invention, four attention heads are set to capture complex patterns in power data.
[0078] In order to construct a dynamic adjacency matrix, the data in the window needs to be mapped to a high dimension, and the present invention sets the dimension to 64.
[0079] The learning rate determines the speed at which the model parameters are updated during each iteration. Setting a suitable learning rate is crucial to prevent oscillations caused by learning too fast or slow convergence caused by learning too slowly. In the present invention, the initial learning rate is 0.005, and a learning rate decay strategy is adopted during the training process.
[0080] The number of iterations refers to the number of times the training is repeated on the entire training set. In order to ensure that the model fully learns the patterns in the data, the number of iterations set in the present invention is 200.
[0081] The regularization term is used to prevent overfitting. In the present invention, an L2 regularization term is set, and its coefficient is 0.0005.
[0082] The loss function is used to measure the gap between the model's predicted value and the actual value. The present invention uses the cross entropy loss function to guide the learning of the model.
[0083] Step 3: The method of using graph attention network for anomaly detection is as follows: Step 1: Clean and standardize the power data to remove obvious erroneous data, such as power consumption that exceeds a reasonable range. At the same time, fill in the missing data reasonably so that the subsequent detection algorithm can run smoothly. In addition, the original data is sampled on a daily basis. In order to adapt to longer-term trend analysis and pattern recognition, the data sampled on a daily basis needs to be converted into a weekly summary. This process involves summing up the power consumption data within seven days to form the total power consumption per week. Such a conversion helps smooth short-term fluctuations and reveal more stable long-term trends. It also facilitates the identification of abnormal patterns, because data with a long time span is more likely to reveal regular anomalies.
[0084] Step 2: Based on the similarity of electricity consumption patterns among users, a graph structure is constructed, with each user as a node, denoted as , the similarity between users is represented by edge connections. In order to accurately capture the similarity between users and build a high-quality graph structure, the electricity consumption data of each user is first normalized to ensure that the data of each user is on the same scale, thereby eliminating the impact of the dimension. The method for normalizing user data is as follows: First, find the mean of the user's weekly electricity consumption data With variance , then for any weekly electricity consumption data , normalized to .
[0085] Next, based on the weekly electricity consumption sequence vector of each user node, use formula (1) to calculate the cosine similarity between each user and all other users and put it into the array In the graph, the top five users with the highest similarity are selected. These users will become the neighbor nodes of the user and are connected by edges in the graph. The weight of the edge is set to the size of the cosine similarity to indicate the strength of the similarity. The initial feature of the node in the graph is the weekly electricity consumption data.
[0086] At this point, the initial graph structure is constructed. At the same time, in order to build a dynamic graph structure, the original daily electricity consumption data is divided into each quarter and the data set is divided into multiple windows.
[0087] Step 3: Input the user node features, user labels (0 or 1) of the training set TrainA and the graph constructed by cosine similarity into the graph attention network model. The specific method is as follows: First, the weekly electricity consumption data of all users and the constructed initial graph structure are input into the graph attention network model, and the static matrix-based representation of all users is calculated using formulas (4)-(6).
[0088] Next, the dynamic adjacency matrix of multiple windows is constructed using formula (3), and then the dynamic representation of each user under multiple windows is calculated again using formulas (4)-(6).
[0089] Then, the dynamic representation of each user is averaged and fused using formula (7) and concatenated with the static representation to obtain the final representation of all users.
[0090] Finally, use formula (8) to calculate the probability scores of all users, use the real labels of users in TrainA and their probability scores to calculate the binary cross entropy loss function, and use the gradient descent method to optimize all the parameters mentioned in the above formulas. It should be noted that during the training process, the loss function of all users on the validation set ValA also needs to be calculated. If the loss on the validation set does not decrease after multiple consecutive rounds, the training is terminated.
[0091] Step 4: After the model training is completed, input the test set TestA to judge the model performance. Finally, input the total power data DataA of region A. The graph attention network generates node classification in the output layer, and identifies and marks abnormal users by comparing the difference between the predicted value and the actual value, and counts the number of abnormal users to generate one of the indicators of related accuracy Acc.
[0092] Step 4: Use the analytic hierarchy process to evaluate the data quality. The specific process is as follows: According to formula (9) to formula (12), the values of completeness Com, uniqueness Unq, timeliness Tim and accuracy Acc are calculated for the data set DataA respectively, and the scores of each dimension are obtained according to formula (15): .
[0093] The analytic hierarchy process (AHP) is a method for multi-criteria decision-making problems. It evaluates the importance of each factor by constructing a judgment matrix and calculating a weight vector. In this embodiment, AHP is used to comprehensively evaluate the quality of power data. Statistics of each evaluation dimension of power data are performed to obtain the basis for importance comparison, and the importance of the four indicators is ranked, as shown in Table 2.
[0094] Table 2: AHP weight matrix for power data quality evaluation
[0095] Thus, we get the judgment matrix D, which is expressed as follows: (14) Then, for the judgment matrix D, each column of the matrix is first standardized, and the standardized elements are summed row by row. Finally, the summed result is standardized again, and then the weight vector is obtained according to formula (14). The calculation formula is as follows:
[0096] in, is the weight value of the integrity Com, is the weight value of uniqueness Unq, is the weight value of the timeliness Tim, is the weight value of accuracy Acc.
[0097] According to formula (16) and formula (17), the consistency index CR=0.07<0.1 is calculated, so the consistency requirement is met.
[0098] Finally, the power data quality score of region A is obtained according to formula (13): Similarly, the data quality score of regional BCD can be obtained , and then obtain the data quality ratings of all regions according to Table 1, thus completing the quality evaluation of power data in all regions.
[0099] According to the above calculation results, the present invention can improve the accuracy and robustness of anomaly detection by evaluating the quality of power data through the graph attention network anomaly detection model and the hierarchical analysis method: by introducing the graph attention network, it effectively overcomes the high dependence of traditional neural networks on data quality, and adopts adaptive weight allocation and multi-head attention mechanism, which can capture complex abnormal patterns in the power system, reduce overfitting, and significantly improve the accuracy and robustness of anomaly detection.
[0100] At the same time, the present invention can effectively reduce human interference and realize automated detection. The automatic learning mechanism of the graph attention network GAT makes the anomaly detection process no longer rely on manually set thresholds, thereby reducing subjective interference, reducing the possibility of missed detection and false detection, and improving the objectivity and consistency of the detection results.
[0101] Furthermore, the present invention can effectively enhance the adaptability of complex scenarios. When processing graph structured data, the graph attention network can efficiently aggregate the information of neighbor nodes, especially in power systems with a large number of nodes and complex data. It improves the generalization ability of the model and enables it to better cope with anomaly detection tasks in complex scenarios.
[0102] Furthermore, based on the analytic hierarchy process, the present invention establishes a scientific and systematic data quality evaluation system, provides a scientific method combining qualitative and quantitative methods, and unifies the evaluation standards for power data quality. This system is more systematic and reliable, and provides theoretical support for data management and subsequent deep data mining of power systems.
[0103] Furthermore, the present invention ensures the high quality and reliability of power data by improving anomaly detection and data quality assessment, provides strong support for data mining and management of smart grids, and thus improves the safety and operating efficiency of the entire power system.
[0104] An embodiment of a device applying the method of the present invention: An electronic device comprising: one or more processors; A storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the above-mentioned power data quality evaluation method based on abnormality detection.
[0105] A computer medium embodiment using the method of the present invention: A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the above-mentioned power data quality evaluation method based on abnormality detection.
[0106] Those skilled in the art should understand that the embodiments of the present application can be provided as methods, systems, and computer program products. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, optical storage, etc.) containing computer-usable program codes.
[0107] The present application is described by flowcharts or / and block diagrams of the methods, devices (systems), and computer program products of the embodiments of the present application. It should be understood that each process or / and block in the flowchart or / and block diagram and the combination of the processes or / and blocks in the flowchart or / and block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart or / and block diagram. Figure 1 Process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0108] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 Process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0109] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 Process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0110] The model in this application is an object that objectively describes the morphological structure with the help of physical or virtual representation. The object is not equal to the object and is not limited to physical and virtual. It can be a data processing function, software program, processing mode, usage method, operation method, workflow, application process, electronic hardware, circuit module, processing system, system imitation or simulation object.
[0111] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the relevant field can still modify or replace the specific implementation methods of the present invention with equivalents. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be included in the scope of protection of the claims of the present invention.
Claims
1. A method for evaluating power data quality based on anomaly detection, characterized in that: The following steps are involved: Step 1: clean the power data to be evaluated through a pre-built data preprocessing model to obtain the power consumption data of multiple users; Step 2: Using the pre-built dynamic and static data calculation model, based on the similarity of electricity consumption between users, the electricity consumption data of multiple users are processed to construct a static graph structure and a dynamic adjacency matrix; The static graph structure has several nodes and connecting edges, which are used to smooth short-term fluctuations and capture long-term trends; The nodes represent users, and the connecting edges represent the similarities between users; Dynamic adjacency matrix, which is used to flexibly adapt to the local dependency structure that changes over time, capture short-term dynamic changes, and provide a picture of variable interactions; Step 3: Use the pre-built anomaly detection model to process the static graph structure and dynamic adjacency matrix to capture the similarities between users and identify abnormal user data; Step 4: Use the pre-built data quality evaluation model to evaluate the power data based on abnormal user data, obtain the quality evaluation results, and complete the power data quality evaluation based on anomaly detection.
2. The power data quality evaluation method based on anomaly detection according to claim 1, characterized in that: Step 1: The method of cleaning the power data to be evaluated by using the pre-built data preprocessing model to obtain the power consumption data of multiple users is as follows: Obtaining power data to be evaluated, where the power data is data sampled daily and involves multiple users; Clean and standardize the power data, remove the power consumption that exceeds the set range, and obtain the power standard data; Fill in the missing data in the power standard data to obtain complete power data; The complete electricity data is split according to user attributes to obtain electricity consumption data of multiple users.
3. The power data quality evaluation method based on anomaly detection according to claim 1, characterized in that: Step 2: Using the pre-built dynamic and static data calculation model, based on the similarity of electricity consumption between users, the electricity consumption data of multiple users is processed, and the method of constructing a static graph structure is as follows: The electricity consumption data of each user is summed over a one-week period to smooth short-term fluctuations and capture long-term trends, thus obtaining the total weekly electricity consumption of several users. Normalize the total weekly electricity consumption of several users and construct multiple user electricity consumption vectors to ensure that the electricity consumption data of different users are on the same scale; Based on multiple user power consumption vectors, calculate the angle value between any two user power consumption vectors to obtain angle information; According to the angle information, the cosine similarity between each user and all remaining users is calculated to obtain similarity data; Based on the similarity data, the top M users with the highest cosine similarity are selected as the neighbor nodes of the user, and the cosine similarity is used as the weight of the connection edge to indicate the strength of the similarity; Use the connection edge to connect the user and neighbor nodes to obtain the static initial graph structure of the user; Concatenate the static initial graph structures of all users to obtain a complete graph structure; The weekly electricity consumption data of users is used as feature vectors to establish feature matrix and static adjacency matrix; Based on the feature matrix and the static adjacency matrix, the complete graph structure is assigned to obtain the static graph structure.
4. The power data quality evaluation method based on anomaly detection according to claim 1, characterized in that: Step 2: Using the pre-built dynamic and static data calculation model, based on the electricity consumption similarity between users, the electricity consumption data of multiple users are processed to construct a dynamic adjacency matrix as follows: Set different sampling time lengths according to the electricity consumption characteristics of different users; The sampling period is half a month, one month or one quarter; According to the sampling time length, the user's electricity consumption data is divided into a window length, that is, the user's electricity consumption data within a time period; According to the window length, the daily electricity consumption data of each user is represented as a vector, and the electricity consumption matrix about the window length is obtained; According to the power consumption matrix and based on the power consumption similarity between users, an adjacency matrix with respect to the window length is set, so as to obtain a dynamic adjacency matrix between users.
5. The power data quality evaluation method based on anomaly detection according to claim 1, characterized in that: Step 3: Use the pre-built anomaly detection model to process the static graph structure and dynamic adjacency matrix to capture the similarities between users and identify abnormal user data as follows: Get the static graph structure, which includes the feature matrix and static adjacency matrices; According to the feature matrix and the static adjacency matrix, obtain the feature vector of a node and the feature vector of the neighboring node; Using the trained graph attention network, the feature vector of a node and the feature vectors of neighboring nodes are weighted averaged to obtain the static feature vector of the node. In order to capture the dynamic dependencies in the power system that change over time, the power consumption matrix corresponding to the window length is obtained based on the dynamic adjacency matrix; Using the graph attention network, the power consumption matrix is convolved with the graph attention network to obtain several feature vectors for each user; Averaging several eigenvectors yields a comprehensive dynamic eigenvector: The static feature vector and the dynamic feature vector are concatenated together to form a new concatenated feature vector, which combines the static attributes and dynamic attributes of the user; The concatenated feature vector is input into a multi-layer perceptron and classified into two categories through an activation function to obtain the final classification probability of the user; the anomaly detection probability score of each user is a decimal between 0 and 1, indicating the probability of the user being abnormal; If the final classification probability is greater than the set abnormal threshold, the user is determined to be an abnormal user and the number of abnormal users is counted; otherwise, the user is determined to be a normal user.
6. The power data quality evaluation method based on anomaly detection according to claim 5, characterized in that: Step 4: Use the pre-built data quality evaluation model to evaluate the power data based on abnormal user data. The method for obtaining the quality evaluation result is as follows: Select several indicators for power data quality evaluation, including integrity indicator, uniqueness indicator, timeliness indicator and accuracy indicator; The analytic hierarchy process is used to construct the corresponding weight matrix according to the influence of integrity index, uniqueness index, timeliness index and accuracy index on the quality of power data. Based on the weight matrix, set the judgment matrix; Standardize each column of the judgment matrix, sum the standardized elements row by row, and finally standardize the summed results to obtain the weight vector; Calculate the specific values of the completeness index, uniqueness index, timeliness index, and accuracy index to obtain the dimension scores of the four indicators; The dimension scores of the four indicators are multiplied by the weight vector to calculate the power data quality score; According to the power data quality rating table, the power data quality score is rated to obtain the quality evaluation result.
7. The power data quality evaluation method based on anomaly detection according to claim 6, characterized in that: The method for calculating the specific value of the integrity index is as follows: Obtain the electricity consumption data of multiple users and get the total number of data records; Based on the data record integrity judgment mechanism, it is judged whether each record in the power consumption data contains necessary field information, and the number of first complete records is obtained; The data record integrity judgment mechanism refers to whether each record in the data set contains necessary field information; if a record lacks a certain necessary field information, it is considered an incomplete data record; the necessary field information includes timestamp, voltage, current and power; Based on the time series frequency integrity judgment mechanism, it is judged whether the records in the power consumption data are sampled and recorded according to the expected time intervals, and the number of second complete records is obtained; The time series frequency integrity judgment mechanism refers to whether the records in the data set are sampled and recorded at the expected time intervals; if the data at some time points are missing, or the time intervals of the records are uneven, it will be considered that the frequency of the time series is incomplete; Add the number of the first complete record and the number of the second complete record to obtain the number of non-empty records that meet the conditions; Divide the number of non-empty records by the total number of data records to obtain the specific value of the integrity index; Or / and, the method for calculating the specific value of the uniqueness index is as follows: Obtain the electricity consumption data of multiple users and get the total number of data records; Based on the numerical uniqueness judgment mechanism, it is judged whether each record in the power consumption data is unique in certain key fields, and the number of unique data is obtained; The uniqueness judgment mechanism of numerical values means that each record does not repeat in certain key fields; certain key fields include timestamp, device ID and user ID; Based on the number of unique data and the total number of data records, the specific value of the uniqueness index is calculated; Or / and, the method for calculating the specific value of the timeliness index is as follows: Obtain the electricity consumption data of multiple users and get the total number of data records; Based on the timeliness judgment mechanism, it is determined whether the timestamp of each record in the electricity consumption data increases monotonically, and the number of timeliness errors is obtained; Timeliness judgment mechanism, used to measure whether data is recorded in a timely manner and at the expected time interval, that is, the time of each record must be later than the time of the previous record; If the timestamp is found to not meet the monotonicity principle, it is considered a timing error; Based on the total number of data records and the number of timeliness errors, the specific value of the timeliness index is calculated; Or / and, the method to calculate the specific value of the accuracy index is as follows: Obtain the number of abnormal users and the electricity consumption data of multiple users, and obtain the total number of data records; Based on the accuracy index judgment mechanism, find the number of abnormal data; The abnormal data includes invalid data, data with incorrect format, and data with unreasonable content; Add the number of abnormal data and the number of abnormal users to get the number of abnormal records; Based on the number of abnormal records and the total number of data records, the specific value of the accuracy index is obtained.
8. The power data quality evaluation method based on anomaly detection according to claim 7, characterized in that: Based on the weight matrix, the method of setting the judgment matrix is as follows: Step 11, constructing an initial judgment matrix about the integrity index, uniqueness index, timeliness index and accuracy index based on the weight matrix; Step 12, calculating the maximum eigenvalue of the initial judgment matrix; Step 13, calculating the consistency index based on the maximum eigenvalue of the initial judgment matrix; And obtain the random consistency index by looking up the random consistency index table; Step 14, comparing the consistency index with the random consistency index to obtain a consistency ratio; Step 15, comparing the consistency ratio with the ratio threshold, specifically includes the following: When the consistency ratio is less than the ratio threshold, it means that the initial judgment matrix satisfies the consistency check, and step 16 is executed; When the consistency ratio is greater than or equal to the ratio threshold, the initial judgment matrix is reconstructed and step 12 is executed; Step 16: Use the initial judgment matrix as the final judgment matrix.
9. A method for evaluating power data quality based on anomaly detection, characterized in that: Includes the following: Clean and convert the power data to be evaluated to obtain the power consumption data of multiple users; Based on the adaptive weight allocation and multi-head attention mechanism of the graph attention network, the electricity consumption data of multiple users are processed to construct a static graph structure and a dynamic adjacency matrix for capturing user similarities; Process the static graph structure and dynamic adjacency matrix to identify abnormal users and count the number of abnormal users; Through the hierarchical analysis method, combined with abnormal users and the number of abnormal users, the judgment matrix is constructed and the weight vector is calculated to evaluate the power data, obtain the quality evaluation results, and complete the power data quality evaluation based on anomaly detection.
10. A power data quality evaluation system based on anomaly detection, characterized in that: It includes: one or more processors; A storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement a power data quality evaluation method based on anomaly detection as described in any one of claims 1-9.
Citation Information
Patent Citations
Power data anomaly detection method, system, device and medium based on graph computing
CN118378023B
Multivariable time series data anomaly detection method and system based on dynamic graph learning and long and short term convolution
CN117251731A
Semiconductor wafer manufacturing anomaly detection method and device based on space-time diagram neural network
CN118411589A
Dynamic graph data abnormal edge detection method and system based on graph neural network
CN118690292A
Health state assessment method for equipment based on knowledge graph attention network
US20240403599A1
Cited By
Intelligent analysis system for electric energy quality and read data
CN120277592A
Intelligent analysis system for power quality and meter reading data
CN120277592B