Power load classification method and related device
By preprocessing the load data of electricity users and analyzing the grid topology using graph neural networks, combined with the self-attention mechanism and generative adversarial networks, the problems of limited data and insufficient processing of external factors in traditional power load classification methods are solved, achieving higher classification accuracy and adaptability.
Patent Information
- Application Number
- CN202510820170.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-18
- Publication Date
- 2025-09-19
AI Technical Summary
Traditional power load classification methods rely on limited load data and insufficient processing of external factors, resulting in low classification accuracy and poor adaptability, especially in complex environments.
By collecting load data from multiple electricity users for data preprocessing, the grid topology structure of the graph neural network is used to extract and enhance load features, and the attention weight is obtained through the self-attention mechanism. Combined with the generative adversarial network, data balancing processing is performed to improve the classification accuracy of load data.
It effectively improves the classification accuracy of load data, enhances the adaptability to complex environments, reduces the classification deviation caused by imbalanced data volume, and improves classification performance.
Smart Images

Figure CN120671016A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of power data analysis, and in particular to a power load classification method and related devices. Background Art
[0002] The randomness and diversity of users' electricity usage behavior are gradually increasing, which increases the difficulty of planning, scheduling and management of power systems.
[0003] Currently, load classification based on user load data can help power systems better understand the electricity usage patterns of different users, thereby optimizing power system planning, scheduling, and management. However, traditional load classification methods use limited load data and address only a few factors that affect load data, resulting in low classification accuracy. Summary of the Invention
[0004] In view of the above problems, this application provides a power load classification method and related devices to achieve the purpose of improving the accuracy of load data classification. The specific solution is as follows:
[0005] A first aspect of the present application provides a method for classifying electric loads, the method comprising:
[0006] Collecting load data of multiple electricity users, performing data preprocessing on the load data, and performing data balancing processing on data with unbalanced load categories in the load data after the data preprocessing to obtain a load data set;
[0007] Obtaining load association relationships in the load dataset through a graph neural network, and extracting enhanced load features of the load dataset based on the load association relationships, wherein the grid topology includes a plurality of nodes having node attributes and connection paths between the nodes, wherein each node corresponds to an electricity user, the node attributes include the load data of the electricity user and external factors affecting the load data, and the connection paths represent the electricity consumption association relationships between the electricity users;
[0008] Obtaining an attention weight of the enhanced load feature through a self-attention mechanism, and updating the enhanced load feature according to the attention weight;
[0009] The updated enhanced load signature is classified to obtain a classification result of the load data set.
[0010] In a possible implementation, performing data balancing processing on the load data with unbalanced load categories in the load data after the data preprocessing includes:
[0011] Classifying the load data after the data preprocessing and counting the amount of load data in each category;
[0012] Generative adversarial networks are used to perform data augmentation on target category load data.
[0013] In one possible implementation, the generative adversarial network includes a generator and a discriminator, and the method of performing data augmentation on target category load data using the generative adversarial network includes:
[0014] The generator receives a random noise vector and maps it to a load data space to generate a plurality of sample data of the target category load data;
[0015] Performing real sample data judgment on the plurality of sample data and the target category load data by the discriminator;
[0016] Determine whether the loss function value of the discriminator is less than a preset threshold; if the loss function value is greater than the preset threshold, update the parameters of the generator and return to the step of receiving the random noise vector and mapping it to the load data space to generate multiple sample data of the target category load data;
[0017] If the value of the loss function is not greater than the preset threshold, the multiple sample data generated by the generator are used as the expansion data of the target category load data, and the target category load data is expanded using the expansion data.
[0018] In one possible implementation, the process of constructing the power grid topology structure of the graph neural network includes:
[0019] Building an undirected graph structure based on the power supply path sharing relationship between the electricity users, the undirected graph structure including a plurality of nodes and undirected connection paths between the nodes;
[0020] Node attributes are set for each node, where the node attributes include load value, voltage, current and the external factors.
[0021] In one possible implementation, obtaining the attention weight of the enhanced load feature through a self-attention mechanism and updating the enhanced load feature according to the attention weight include:
[0022] Establishing multiple time series features based on the enhanced load feature, each time series feature corresponds to one of the electricity users, each of the time series features includes multiple groups of time features, and each group of time features corresponds to the enhanced load feature of the electricity user at a moment;
[0023] Calculating similarity scores between a target group and other groups to obtain multiple similarity scores of the target group, where the target group is one of the multiple groups of time features of the target time series feature, and the target time series is one of the multiple time series features;
[0024] Calculating an attention weight of the target group according to a plurality of similarity scores of the target group;
[0025] Obtaining an attention weight matrix of the target time series features;
[0026] An attention weight matrix of the enhanced load feature is obtained, and the enhanced load feature is updated according to the attention weight matrix.
[0027] In a possible implementation, classifying the updated enhanced load signature includes:
[0028] The updated enhanced load features are classified through a fully connected layer.
[0029] A second aspect of the present application provides a power load classification system, the power load classification system comprising:
[0030] a data collection unit configured to collect load data of a plurality of electricity users, perform data preprocessing on the load data, and perform data balancing processing on data with unbalanced load categories in the load data after the data preprocessing, to obtain a load data set;
[0031] a feature extraction unit, configured to obtain load association relationships in the load dataset through a power grid topology structure of a graph neural network, and extract enhanced load features of the load dataset based on the load association relationships, wherein the power grid topology structure includes a plurality of nodes having node attributes and connection paths between the nodes, wherein each node corresponds to an electricity user, the node attributes include the load data of the electricity user and external factors affecting the load data, and the connection paths represent the electricity consumption association relationships between the electricity users;
[0032] a feature updating unit, configured to obtain an attention weight of the enhanced load feature through a self-attention mechanism, and update the enhanced load feature according to the attention weight;
[0033] The feature classification unit is used to classify the updated enhanced load feature to obtain a classification result of the load data set.
[0034] In a possible implementation, the data acquisition unit performs data balancing processing on the load data with unbalanced load categories in the load data after data preprocessing, and is specifically configured as follows:
[0035] The load data after the data preprocessing is classified into categories, and the amount of load data in each category is counted, and the target category load data is expanded using a generative adversarial network.
[0036] A third aspect of the present application provides an electronic device, comprising at least one processor and a memory connected to the processor, wherein:
[0037] The memory is used to store computer programs;
[0038] The processor is used to execute the computer program so that the electronic device can implement the power load classification method of the first aspect or any implementation manner of the first aspect.
[0039] In a fourth aspect, the present application provides a computer program product comprising computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements the power load classification method of the first aspect or any implementation of the first aspect.
[0040] By means of the above technical solution, the present application provides a method and related apparatus for power load classification. After collecting multiple load data from electricity users, the method improves the load data quality through data preprocessing and balances the data volume of each load category in the load dataset through load category data balancing, reducing classification bias caused by data imbalance. The method also generates enhanced load features for the load dataset through a graph neural network. Since the grid topology of the graph neural network includes multiple nodes with set node attributes and connection paths between each node, each node corresponds to an electricity user, the node attributes include various load data of the electricity user and external factors that affect the load data, and the connection paths represent the electricity consumption relationships between electricity users. Therefore, the grid topology reflects the electricity consumption relationships between various electricity users and the external factors that can affect the load data, making the enhanced load features contain richer load information. Furthermore, the method dynamically assigns attention weights to the enhanced load features through a self-attention mechanism, thereby capturing important information of the enhanced load features. Therefore, the method can reduce classification bias caused by imbalanced category data volume through load category data balancing, and effectively improve the information richness of the load features used for classification through the graph neural network and self-attention mechanism processing. Therefore, this method can effectively improve the classification accuracy of load data. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] The above and other features, advantages, and aspects of the various embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and that the originals and elements are not necessarily drawn to scale.
[0042] Figure 1 A flow chart of a method for classifying power loads provided in an embodiment of the present application;
[0043] Figure 2 A schematic diagram of the structure of a power load classification system provided in an embodiment of the present application;
[0044] Figure 3 This is a hardware structure block diagram of an electronic device provided in this application. DETAILED DESCRIPTION
[0045] The following describes the embodiments of the present application in conjunction with the accompanying drawings. The terms used in the implementation methods of the present application are only used to explain the specific embodiments of the present application and are not intended to limit the present application.
[0046] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0047] The terms "including" and "having" and any variations thereof in the specification of this application and the above-mentioned drawings are intended to cover non-exclusive inclusion, so that a process, method, system, product or apparatus that includes a list of elements is not necessarily limited to those elements but may include other elements not expressly listed or inherent to such process, method, product or apparatus.
[0048] In modern energy systems, user electricity usage has become increasingly complex and diverse. Furthermore, with the advancement of the electricity market, user electricity demand has become highly random and diverse. These changes in demand pose new challenges to the planning, scheduling, and management of power systems. Currently, load classification based on user load data can help power systems better understand the electricity usage patterns of different users, thereby optimizing aspects of power system planning, scheduling, and management.
[0049] Traditional power load classification methods mostly rely on unsupervised clustering methods or supervised machine learning methods, such as support vector machines. Although these methods have certain effects when processing load data, they still face many limitations. First, load data often have uneven load categories, which affects the overall classification performance of power load classification methods. Moreover, load data is not only affected by time series, but also by external factors such as the geographical topology of the power grid, weather changes, holidays and economic activities. The current power load classification methods do not adequately handle external factors, resulting in poor adaptability to load fluctuations in complex environments in actual applications, resulting in low classification accuracy.
[0050] In order to solve the above problems, an embodiment of the present application provides a method for power load classification, which balances the imbalance of load categories in load data through data balancing processing, and extracts enhanced load features of load data through the grid topology structure of the graph neural network. Since the node attributes in the grid topology structure carry external factors and there is an association relationship between the nodes, the enhanced load features extracted by the graph neural network can have rich associated information, improve the adaptability to complex environments, and update the attention weight of the enhanced load features through the self-attention mechanism, so that when classifying, it is possible to focus on important information in the enhanced load features, effectively improving the accuracy of the power load. The power load classification method of the embodiment of the present application is described in detail below with reference to the accompanying drawings.
[0051] Reference Figure 1 , Figure 1 A flow chart of a power load classification method provided in an embodiment of the present application is shown as follows: Figure 1 As shown, an electric load classification method provided in an embodiment of the present application may include steps S10 to S13, and these steps are described in detail below.
[0052] S10: Collect load data from multiple electricity users, perform data preprocessing on the load data, and perform data balancing processing on data with unbalanced load categories in the preprocessed load data to obtain a load data set.
[0053] The load data may be electricity consumption data for at least one electricity user, and may include data such as timestamps, voltage, current, and load values for each electricity user. It may also include external factors that influence load fluctuations, such as weather, holidays, and economic activities. Specifically, this embodiment collects daily load curve data for each electricity user from smart meters, meteorological monitoring systems, and economic activity databases, and then obtains data such as timestamps, voltage, current, and load values from the daily load curve data. The timestamp may be the specific time of each electricity consumption data entry, either a specific point in time (e.g., the first electricity consumption data entry is "the user's electricity consumption data at 1:00 PM on May 14, 2025") or a time period (e.g., the first electricity consumption data entry is "the user's electricity consumption data from 1:00 PM to 2:00 PM on May 14, 2025"). Voltage and current may represent power load characteristic information, and the load value may represent specific electricity consumption. External factors may specifically refer to external factors present when the load data is generated by the electricity user. For example, if it is rainy when a load data entry is collected, the external factor may be recorded as rainy.
[0054] Data preprocessing can refer to data processing such as noise elimination and missing value filling on raw data to improve the data quality of the raw data. Specifically, this embodiment performs missing value filling, outlier removal, and normalization on the collected load data, which not only improves the quality of the load data but also ensures the integrity and consistency of the load data.
[0055] Specifically, for missing values of load values, this embodiment adopts the smoothing filling method of time window D to fill in missing values. For example, if the active power data of the electricity user at 10:00 on March 10 is missing, the active power values at 10:00 on March 3 to March 9 are searched, and the average of the active power values at 10:00 on March 3 to March 9 is calculated as the filling value at 10:00 on March 10. For missing values in external factors, interpolation can be used to fill in to ensure the continuity of the data. Among them, for the missing value of the load value at a time point, the load value at the same time point on the adjacent D days can be used for mean filling. The calculation formula can be as follows:
[0056]
[0057] in, It can represent the missing value of the load value at a time point; Can represent adjacent days; Can represent the number of days; It can represent the load value at the same time point on consecutive D days.
[0058] For outlier removal, this embodiment sets a dynamic anomaly threshold. When the value of the load data is higher than the threshold, the load data can be removed. For example, the average daily active power of the electricity user on May 15 is 100 kilowatts, and the power at 14:00 on May 15 is as high as 400 kilowatts. The data point at 14:00 is determined to be an outlier and removed. Since the outlier is removed, a missing value appears for the load data. At this time, the missing value can be filled by the smoothing filling method of the time window D. Among them, in order to eliminate load anomalies that may be caused by measurement errors or extreme events, this embodiment sets an outlier removal rule based on the dynamic anomaly threshold. The setting formula of the dynamic anomaly threshold can be as follows:
[0059]
[0060] in, It can represent the abnormal threshold of the day, Can represent abnormal coefficient; It can indicate the current average load value.
[0061] For data normalization, this embodiment chooses to normalize the load data to the interval [0, 1]. The specific formula can be as follows:
[0062]
[0063] in, It can represent the load data after data normalization; It can represent load data that has not been normalized; It can represent the minimum value in the load data (when processing voltage, it is the minimum voltage value; when processing load value, it is the minimum load value); It can represent the maximum value in the load data (when processing voltage, it is the maximum voltage; when processing load values, it is the maximum load value). For other data in the load data, such as external factors, the external factors can be classified first and then converted using one-hot encoding (a technique that converts categorical variables into numerical form that can be processed by machine learning algorithms).
[0064] Data balancing refers to the technique of equalizing the amount of data across different categories that exhibit significant differences in quantity. During load data classification, traditional classification methods perform poorly on the minority category due to the relatively small amount of data in some load categories, resulting in a final classification result that favors the majority category. Therefore, this embodiment performs data balancing on load data to address the uneven distribution of categories and improve classification performance.
[0065] Specifically, this embodiment first categorizes the load data after data preprocessing, counts the number of load data in each category, and then uses a generative adversarial network to perform data expansion on the target category load data. The target category load data may be a type of load data that has a smaller number of data than the other categories of load data and a significant data difference from the other categories of load data. The target category load data can be dynamically determined based on the category distribution in the load data. After data expansion of the target category load data is completed, the number of load data in each category can be counted again. Based on the number of load data, a category of load data is used as the target category load data for expansion until the number of load data of each category in the load data set reaches a balance (the numbers are close to or even equal to each other).
[0066] The generative adversarial network selected in this embodiment is the WGAN network. WGAN (Wasserstein Generative Adversarial Network) is an improved deep learning model framework that can include a generator and a discriminator. Realistic data samples are obtained by adversarial training of the generator and the discriminator. In this embodiment, the generator can generate sample data similar to the target category load data based on the random noise distribution by learning the distribution of the target category load data, so that the sample data has statistical characteristics consistent with the target category load data, and input the sample data and the target category load data into the discriminator together. The discriminator can be responsible for determining whether the input data is the target category load data or the sample data, thereby guiding the generator to continuously optimize itself and improve the quality of sample data generation.
[0067] Specifically, the specific data expansion process of the target category load data can be as shown in steps 1 to 4:
[0068] Step 1: The generator receives a random noise vector and maps it to the load data space to generate multiple sample data of the target category load data;
[0069] Step 2: Use the discriminator to judge the real sample data of multiple sample data and target category load data;
[0070] Step 3: Determine whether the loss function value of the discriminator is less than the preset threshold. If the loss function value is greater than the preset threshold, the generator updates the parameters and returns to step 1.
[0071] Step 4: If the loss function value is not greater than the preset threshold, the multiple sample data generated by the generator are used as the expansion data of the target category load data, and the target category load data is expanded using the expansion data.
[0072] The generator can receive standard normally distributed random noise as input and map it to the load data space through a multi-layer neural network. The discriminator can use a binary classification neural network structure to discriminate the input data. An output of 0 can indicate that the input data is a generated sample (a sample generated by the generator), and an output of 1 can indicate that the input data is a real sample (load data). In practical applications, the generator continuously optimizes the quality of the sample data to make its distribution closer to the target category load data, while the discriminator improves its ability to distinguish between real and generated samples by optimizing the adversarial loss function until the iteration stopping condition (the loss function value is no greater than a threshold) is met. At this point, the sample data currently generated by the generator is considered to be of high quality and can be used as augmentation data for the target category load data. In the overall process, batch normalization and optimizer adjustments can be used to accelerate convergence, and the distribution of generated samples can be regularly evaluated to ensure consistency with the target category load data. Of course, in another optional embodiment, a threshold for the number of iterations can be set for the generator and discriminator. When the number of iterations of the generator and discriminator reaches the threshold, the generator can be considered to have completed training and can generate high-quality sample data.
[0073] For example, in the collected load data, after counting the number of load data in each category, it was found that the amount of industrial load data was 8,000, the amount of commercial load data was 3,000, and the amount of residential load data was 5,000. Since the amount of commercial load data was the least, through WGAN network data expansion, after 5,000 rounds of iterative training of the generator and discriminator, it was believed that the generator could generate sample data consistent with the load data distribution, and finally 5,000 commercial load data were added, bringing the amount of commercial load data to 8,000. Of course, the amount of residential load data can also be expanded.
[0074] S11. Obtain the load correlation relationship in the load data set through the grid topology structure of the graph neural network, and extract the enhanced load characteristics of the load data set based on the load correlation relationship. The grid topology structure includes multiple nodes with node attributes and connection paths between the nodes, where each node corresponds to an electricity user. The node attributes include the load data of the electricity user and the external factors that affect the load data. The connection path represents the electricity consumption correlation relationship between the electricity users.
[0075] Graph Neural Networks (GNNs) are deep learning models used to process graph-structured data. They can model nodes, edges, or entire graphs and learn their inherent structural information and feature representations. The GNNs used in this embodiment can be GCNs (Graph Convolutional Networks) or GraphSAGEs (Graph Sample and Aggregation). GCNs are suitable for static power grid topologies, while GraphSAGEs are suitable for large-scale dynamic load data, flexibly adapting to different power system structures. Because power loads can be constrained by the power consumption relationships between power users in the power grid, the GNNs in this embodiment use multi-layer graph convolution operations to aggregate information about nodes and their neighboring nodes layer by layer. This allows the GNNs to learn the load similarities between different power grid users and the distribution characteristics of load data within the power grid topology, extracting enhanced load features from the load dataset that can incorporate spatial dependencies and load associations.
[0076] In this embodiment, the graph neural network can include a multi-layer power grid topology, where the power grid topology of each layer can be the same or different. Specifically, the process of constructing the power grid topology of the graph neural network can include: constructing an undirected graph structure based on the power supply path sharing relationship between electricity users, the undirected graph structure including multiple nodes and undirected connection paths between each node; and setting node attributes for each node, where the node attributes can include load value, voltage, current, and external factors.
[0077] Among them, the power supply path sharing relationship between electricity users can mean that two electricity users share a power supply user or power supply path, such as using the same power transformer, distribution line or substation. The power supply sharing relationship between electricity users can determine whether there is a path between each node in the undirected graph structure. If there is a power supply sharing relationship between the two electricity users, then in the undirected graph structure, there can be a connection path between the corresponding nodes of the two electricity users; if there is no power supply sharing relationship between the two electricity users, then in the undirected graph structure, there may be no connection path between the corresponding nodes of the two electricity users. Therefore, when the power grid topology structure of the graph neural network is constructed, the meaning of the connection path between the nodes in the power grid topology structure is: the power consumption association relationship between the electricity users, indicating that the two electricity users have correlation in power supply structure or power consumption behavior. Therefore, since the connection path between nodes can represent the electricity consumption relationship between electricity users, the electricity consumption behavior of electricity users can affect the load data of the user side. Therefore, due to the electricity consumption relationship between electricity users, the load data of the electricity users also have a correlation relationship. Then the graph neural network can extract the load correlation relationship between electricity users based on the undirected connection path between nodes in the power grid topology.
[0078] An undirected graph structure refers to a basic graph structure consisting of nodes and edges, where edges have no directionality. This indicates a connection between two nodes, but not a direction between the nodes (e.g., node A connected to node B (arrow pointing from node A to node B) or vice versa). Node attributes are required characteristics of a node. When a load dataset is input, the specific load values, voltage, current, external factors, and other values of each electricity user in the load dataset can be used as the specific values of the node attributes of the corresponding node of the electricity user, and then feature extraction is performed.
[0079] Since the graph neural network of this embodiment has a multi-layer power grid topology, the formula for graph neural network feature extraction can be as follows:
[0080]
[0081] in, Can indicate the Node features extracted from the topology of the power grid; It can represent activation functions, which are used to introduce nonlinearity and enable graph neural networks to express complex features. It can represent the degree matrix, that is, the number of connections of each grid user node in the grid topology; It can represent the adjacency matrix, that is, the connection relationship between grid users in the grid topology; Can indicate the Node features extracted from the topology of the power grid; Can indicate the The trainable weight parameters of the layer are used for linear transformation of node features.
[0082] The enhanced load feature can be a set of load feature vectors that include spatial dependency and load association relationships. After the load dataset of this embodiment is processed by the graph neural network, the enhanced load feature of the load dataset output by the graph neural network can be obtained. Its representation can be: , each It can correspond to a load characteristic vector of an electricity user.
[0083] S12. Obtain the attention weight of the enhanced load feature through the self-attention mechanism, and update the enhanced load feature according to the attention weight;
[0084] S13. Classify the updated enhanced load features to obtain a classification result of the load data set.
[0085] After obtaining the enhanced load features of the load dataset output by the graph neural network, the enhanced load features are subsequently processed through a self-attention mechanism. Optionally, this embodiment implements the self-attention mechanism to process the enhanced load features through an informer network. The informer network is a deep learning model for time series prediction. This embodiment utilizes the self-attention mechanism of the informer network to select key time steps (the most informative time steps), improve the ability to capture long time series features, reduce computational complexity, and effectively avoid problems such as excessive computational overhead and vanishing gradients.
[0086] In this embodiment, the enhanced load feature needs to be modeled according to the time series, and then the attention distribution of the enhanced load feature is calculated based on the time series. Specifically, in this embodiment, multiple time series features are established according to the enhanced load feature, that is, Each of By dividing according to the time, multiple time series features are obtained. Each time series feature includes multiple groups of time features. The representation of each time series feature can be: , each Can correspond to an electricity user, and each It can include the enhanced load characteristics of the electricity user at multiple times, each of which Represents a set of time characteristics, which can represent the enhanced load characteristics of the electricity user at a moment, and the time step between each moment is the same.
[0087] This embodiment takes a target group (a group of time features) among multiple groups of time features in the target time series features as an example to illustrate the subsequent process, and the target time series is one of the multiple time series features. This embodiment calculates the similarity score between the target group and other groups, obtains multiple similarity scores of the target group, each similarity score refers to the similarity score between the target group and one other group, and calculates the attention weight of the target group based on the multiple similarity scores of the target group. By analogy, this embodiment can obtain the attention weight of each group of time features in the target time series features, and can constitute an attention weight matrix, that is, the attention weight matrix of the target time series features. The attention weight matrix of each time series feature can constitute an attention weight matrix of the enhanced load feature, and the enhanced load feature is updated according to the attention weight matrix, so that the important features in the enhanced load feature can have a larger attention weight.
[0088] Specifically, this embodiment first calculates the query matrix of the target group , key matrix Sum Matrix , its calculation formula can be shown as follows:
[0089]
[0090]
[0091]
[0092] in, It can represent a target group among multiple groups of time features; It can represent the weight matrix corresponding to the query vector; It can represent the weight matrix corresponding to the key vector; It can represent the weight matrix corresponding to the value vector.
[0093] Get the query matrix of the target group , key matrix Sum Matrix After that, the similarity scores between the target group and other groups are calculated. The calculation formula can be shown as follows:
[0094]
[0095] in, It can represent the similarity score between the target group and one other group; A query matrix that can represent the target group; The transposed matrix of the key matrix of the target group can be represented; The dimensions of the bond matrix that can represent the target group.
[0096] After calculating the similarity score between the target group and another group, we can calculate the similarity score of the target group in the same way, and the similarity score can be expressed as follows: , each It can represent the score between the target group and one other group.
[0097] After obtaining all similarity scores between the target group and other groups, the attention weight between the target group and each other group can be calculated to obtain multiple attention weights of the target group. The calculation formula for the attention weight between the target group and one other group can be as follows:
[0098]
[0099] in, It can represent the attention weight between the target group and another group, that is, it can represent the The time characteristics of the group The attention weight of the group temporal feature, which indicates the relative importance of the target group to one of the other groups; It can represent the similarity score between the target group and another group, that is, it can represent the The query vector of the group time feature is Similarity scores between key vectors of group temporal features; It can represent the exponential sum of all similarity scores of the target group and other groups, and is used to normalize the attention weight; A quantity that can represent a similarity score.
[0100] After obtaining all the attention weights of the target group and other groups, the attention weights of the target group can be normalized through the Softmax function to obtain the attention weight of the target group (that is, a total attention weight). This can be used to obtain the attention weights of each group of time features in the time series features, and the attention weight matrix of the target time series features (composed of the attention weights of multiple groups of time features), thereby obtaining the attention weight matrix of the enhanced load features (composed of the attention weight matrices of multiple time series features). The enhanced load features are then updated based on the attention weight matrix of the enhanced load features, giving them different attention distributions, which facilitates subsequent feature classification.
[0101] After the enhanced load characteristics are updated in this embodiment, the updated enhanced load characteristics can be classified. Specifically, this embodiment classifies the updated enhanced load characteristics through a fully connected layer to obtain a classification result of the load data set. Based on the classification result of the load data set, the typical power consumption pattern of the electricity user can be further extracted, and the user characteristics of different categories can be identified using a clustering method. The patterns of peak load users, stable users, and seasonally sensitive users can be analyzed to support the optimized scheduling and intelligent management of the power system. Among them, the classification result can be: the type of load data of each user in the load data set, which can have different categories according to different classification standards. For example, the load data of the electricity user can be classified according to the user type into industrial users, commercial users, and residential users.
[0102] Furthermore, the training process of the graph neural network and self-attention mechanism can be shown as follows:
[0103] First, the GNN-Informer model is constructed. The GNN is used to model the grid topology, followed by the Informer for time series modeling, and finally, load classification is performed. The GNN input features can be a class-balanced load dataset constructed through data augmentation using WGAN. The GNN extracts enhanced load features that include spatial dependencies and load correlations as input to the Informer. After the Informer performs time series modeling, it calculates the attention distribution between the time steps of the time series to update the enhanced load features. The updated enhanced load features are then classified using a fully connected layer, and the classification results of the load dataset are output for subsequent power system scheduling and optimization.
[0104] A training dataset for the GNN-Informer model is constructed. The training dataset contains load data of multiple electricity users, grid topology information (the power supply sharing relationship between grid users), and time series features. The load data of the electricity users includes data generated by WGAN.
[0105] The training dataset is divided into a training set (80%), a validation set (10%), and a test set (10%) according to a certain ratio, and the training set is used to train the GNN-Informer model. During the training process, the cross-entropy loss function is used to optimize the model parameters of the GNN-Informer model, and the optimizer is used for gradient update. At the same time, the learning rate is dynamically adjusted to improve the convergence stability and generalization ability of the GNN-Informer model.
[0106] During the testing phase of the GNN-Informer model, multiple classification performance indicators can be used to evaluate the GNN-Informer model. The classification performance indicators can include accuracy, recall rate, etc., to measure the classification ability of the classification performance indicators for different types of load data.
[0107] An embodiment of the present application provides a method for power load classification. After collecting multiple load data from electricity users, the method improves the load data quality through data preprocessing and balances the data volume of each load category in the load dataset through load category data balancing, reducing classification bias caused by data imbalance. The method also generates enhanced load features for the load dataset through a graph neural network. Since the grid topology of the graph neural network includes multiple nodes with set node attributes and connection paths between each node, each node corresponds to an electricity user, the node attributes include various load data of the electricity user and external factors that affect the load data, and the connection paths represent the electricity consumption relationships between electricity users. Therefore, the grid topology reflects the electricity consumption relationships between various electricity users and the external factors that can affect the load data, so that the enhanced load features contain richer load information. The method also dynamically assigns attention weights to the enhanced load features through a self-attention mechanism, thereby capturing important information of the enhanced load features. Therefore, the method can reduce classification bias caused by imbalanced category data volume through load category data balancing, and effectively improve the information richness of the load features used for classification through the graph neural network and self-attention mechanism processing. Therefore, this method can effectively improve the classification accuracy of load data.
[0108] The above describes a method for classifying electric loads provided in an embodiment of the present application. The following describes a system that applies the above method for classifying electric loads.
[0109] See also Figure 2 , Figure 2 This is a schematic diagram of the structure of a power load classification system provided in an embodiment of the present application. Figure 2 As shown, the power load classification system includes:
[0110] The data collection unit 100 is used to collect load data of multiple electricity users, perform data preprocessing on the load data, and perform data balancing processing on data with unbalanced load categories in the preprocessed load data to obtain a load data set;
[0111] A feature extraction unit 110 is configured to obtain load association relationships in a load dataset using a graph neural network's power grid topology structure, and extract enhanced load features of the load dataset based on the load association relationships. The power grid topology structure includes a plurality of nodes having node attributes and connection paths between the nodes, wherein each node corresponds to an electricity user, the node attributes include the electricity user's load data and external factors affecting the load data, and the connection paths represent the electricity consumption association relationships between the electricity users.
[0112] a feature updating unit 120 for obtaining an attention weight of the enhanced load feature through a self-attention mechanism, and updating the enhanced load feature according to the attention weight;
[0113] The feature classification unit 130 is configured to classify the updated enhanced load features to obtain a classification result of the load data set.
[0114] In a possible implementation, the data acquisition unit 100 performs data balancing processing on the load data with unbalanced load categories in the load data after data preprocessing, which can be specifically configured as follows:
[0115] The load data after data preprocessing is divided into categories, and the number of load data in each category is counted. The target category load data is expanded using a generative adversarial network.
[0116] In one possible implementation, the generative adversarial network includes a generator and a discriminator. The data acquisition unit 100 uses the generative adversarial network to perform data expansion on the target category load data. Specifically, the configuration may be as follows:
[0117] The generator receives a random noise vector and maps it to the load data space to generate multiple sample data of the target category load data; the discriminator performs real sample data judgment on the multiple sample data and the target category load data; it judges whether the loss function value of the discriminator is less than a preset threshold. If the loss function value is greater than the preset threshold, the generator updates the parameters and returns to execute the generator receiving the random noise vector and mapping it to the load data space to generate multiple sample data of the target category load data; if the loss function value is not greater than the preset threshold, the multiple sample data generated by the generator are used as the expansion data of the target category load data, and the target category load data is expanded using the expansion data.
[0118] In a possible implementation, the power load classification system further includes a power grid construction unit, which can be specifically configured as follows:
[0119] An undirected graph structure is constructed based on the power supply path sharing relationship between electricity users. The undirected graph structure includes multiple nodes and undirected connection paths between each node. Node attributes are set for each node. The node attributes include load value, voltage, current and external factors.
[0120] In one possible implementation, the feature updating unit 120 obtains the attention weight of the enhanced load feature through the self-attention mechanism and updates the enhanced load feature according to the attention weight. Specifically, the configuration may be as follows:
[0121] Multiple time series features are established based on the enhanced load features, each time series feature corresponds to an electricity user, each time series feature includes multiple groups of time features, and each group of time features corresponds to the enhanced load features of the electricity user at a moment; the similarity scores of the target group and other groups are calculated to obtain multiple similarity scores of the target group, the target group is one of the multiple groups of time features of the target time series feature, and the target time series is one of the multiple time series features; the attention weight of the target group is calculated based on the multiple similarity scores of the target group; the attention weight matrix of the target time series feature is obtained; the attention weight matrix of the enhanced load feature is obtained, and the enhanced load feature is updated according to the attention weight matrix.
[0122] In a possible implementation, the feature classification unit 130 classifies the updated enhanced load feature, which may be specifically configured as follows:
[0123] The updated enhanced load features are classified through a fully connected layer.
[0124] An electronic device is also provided in an embodiment of the present application. Figure 3 , which shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present application. The electronic device in the embodiments of the present application may include, but is not limited to, fixed terminals such as mobile phones, laptops, PDAs (personal digital assistants), PADs (tablet computers), desktop computers, etc. Figure 3 The electronic device shown is merely an example and should not limit the functions and scope of use of the embodiments of the present application.
[0125] like Figure 3As shown, the electronic device may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 301, which can perform various appropriate actions and processes based on programs stored in a read-only memory (ROM) 302 or programs loaded from a storage device 308 into a random access memory (RAM) 303. When the electronic device is powered on, the RAM 303 also stores various programs and data required for the operation of the electronic device. The processing device 301, ROM 302, and RAM 303 are interconnected via a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.
[0126] Typically, the following devices may be connected to the I / O interface 305: an input device 306 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 307 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 308 including, for example, a memory card, a hard disk, etc.; and a communication device 309. The communication device 309 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Figure 3 The electronic device is shown with various devices, but it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed instead.
[0127] An embodiment of the present application also provides a computer program product including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements any one of the power load classification methods provided in the embodiments of the present application.
[0128] A computer-readable storage medium is also provided in an embodiment of the present application. The storage medium carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any power load classification method provided in the embodiment of the present application.
[0129] It should also be noted that the system embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. In addition, in the drawings of the system embodiments provided in this application, the connection relationship between the modules indicates that there is a communication connection between them, which can be specifically implemented as one or more communication buses or signal lines.
[0130] Through the description of the above embodiments, those skilled in the art can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course can also be implemented by special hardware including application-specific integrated circuits, special CPUs, special memories, special components, etc. In general, all functions performed by computer programs can be easily implemented with corresponding hardware, and the specific hardware structures used to implement the same function can also be diverse, such as analog circuits, digital circuits or special circuits, etc. However, for the present application, software program implementation is a better implementation method in most cases. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer's floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk or optical disk, etc., and includes a number of instructions to enable a computer device (which can be a personal computer, training equipment, or network equipment, etc.) to execute the methods described in each embodiment of the present application.
[0131] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware, or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.
[0132] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website, a computer, a training device or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website, a computer, a training device or a data center. The computer-readable storage medium can be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium can be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).
[0133] Each embodiment in this specification is described in a related manner. Similar portions between the embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences from other embodiments. In particular, the device embodiments are generally similar to the method embodiments, so their description is relatively simple. For related portions, refer to the description of the method embodiments.
[0134] It is understandable that before using the technical solutions disclosed in the various embodiments of this disclosure, the type, scope of use, usage scenarios, etc. of the personal information involved in this disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0135] The above are merely embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application should all be included in the protection scope of the present application.
Claims
1. A method for classifying power loads, characterized in that: The power load classification method includes: Collecting load data of multiple electricity users, performing data preprocessing on the load data, and performing data balancing processing on data with unbalanced load categories in the load data after the data preprocessing to obtain a load data set; Obtaining load association relationships in the load dataset through a graph neural network, and extracting enhanced load features of the load dataset based on the load association relationships, wherein the grid topology includes a plurality of nodes having node attributes and connection paths between the nodes, wherein each node corresponds to an electricity user, the node attributes include the load data of the electricity user and external factors affecting the load data, and the connection paths represent the electricity consumption association relationships between the electricity users; Obtaining an attention weight of the enhanced load feature through a self-attention mechanism, and updating the enhanced load feature according to the attention weight; The updated enhanced load signature is classified to obtain a classification result of the load data set.
2. The power load classification method according to claim 1, characterized in that: The performing data balancing processing on the data with unbalanced load categories in the load data after the data preprocessing, comprises: Classifying the load data after the data preprocessing and counting the amount of load data in each category; Generative adversarial networks are used to perform data augmentation on target category load data.
3. The power load classification method according to claim 2, characterized in that: The generative adversarial network includes a generator and a discriminator, and the method of using the generative adversarial network to perform data expansion on the target category load data includes: The generator receives a random noise vector and maps it to a load data space to generate a plurality of sample data of the target category load data; Performing real sample data judgment on the plurality of sample data and the target category load data by the discriminator; Determine whether the loss function value of the discriminator is less than a preset threshold; if the loss function value is greater than the preset threshold, update the parameters of the generator and return to the step of receiving the random noise vector and mapping it to the load data space to generate multiple sample data of the target category load data; If the value of the loss function is not greater than the preset threshold, the multiple sample data generated by the generator are used as the expansion data of the target category load data, and the target category load data is expanded using the expansion data.
4. The power load classification method according to claim 1, characterized in that: The process of constructing the power grid topology structure of the graph neural network includes: Building an undirected graph structure based on the power supply path sharing relationship between the electricity users, wherein the undirected graph structure includes a plurality of nodes and undirected connection paths between the nodes; Node attributes are set for each node, where the node attributes include load value, voltage, current and the external factors.
5. The power load classification method according to claim 1, characterized in that: The acquiring of the attention weight of the enhanced load feature through the self-attention mechanism and updating the enhanced load feature according to the attention weight include: Establishing multiple time series features based on the enhanced load feature, each time series feature corresponds to one of the electricity users, each of the time series features includes multiple groups of time features, and each group of time features corresponds to the enhanced load feature of the electricity user at a moment; Calculating similarity scores between a target group and other groups to obtain multiple similarity scores of the target group, where the target group is one of the multiple groups of time features of the target time series feature, and the target time series is one of the multiple time series features; Calculating an attention weight of the target group according to a plurality of similarity scores of the target group; Obtaining an attention weight matrix of the target time series features; An attention weight matrix of the enhanced load feature is obtained, and the enhanced load feature is updated according to the attention weight matrix.
6. The power load classification method according to claim 1, characterized in that: The classifying the updated enhanced load signature includes: The updated enhanced load features are classified through a fully connected layer.
7. A power load classification system, characterized in that: The power load classification system includes: a data collection unit configured to collect load data of a plurality of electricity users, perform data preprocessing on the load data, and perform data balancing processing on data with unbalanced load categories in the load data after the data preprocessing, to obtain a load data set; a feature extraction unit, configured to obtain load association relationships in the load dataset through a power grid topology structure of a graph neural network, and extract enhanced load features of the load dataset based on the load association relationships, wherein the power grid topology structure includes a plurality of nodes having node attributes and connection paths between the nodes, wherein each node corresponds to an electricity user, the node attributes include the load data of the electricity user and external factors affecting the load data, and the connection paths represent the electricity consumption association relationships between the electricity users; a feature updating unit, configured to obtain an attention weight of the enhanced load feature through a self-attention mechanism, and update the enhanced load feature according to the attention weight; The feature classification unit is used to classify the updated enhanced load feature to obtain a classification result of the load data set.
8. The power load classification system according to claim 7, characterized in that: The data acquisition unit performs data balancing processing on the data with unbalanced load categories in the load data after the data preprocessing, and the specific configuration is as follows: The load data after the data preprocessing is classified into categories, and the amount of load data in each category is counted, and the target category load data is expanded using a generative adversarial network.
9. An electronic device, characterized in that: comprising at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is configured to execute the computer program so as to enable the electronic device to implement the power load classification method according to any one of claims 1 to 6.
10. A computer program product, characterized in that The method comprises computer-readable instructions, which, when executed on an electronic device, enable the electronic device to implement the power load classification method according to any one of claims 1 to 6.