A method for clustering daily load curves
By optimizing parameters using a neural network framework, the problem of balancing intra-cluster density and inter-cluster separation in daily load curve clustering was solved, resulting in high-quality clustering results that better reflect residential electricity consumption behavior and improve the peak shaving and valley filling efficiency of the power grid.
Patent Information
- Application Number
- CN202211114815.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-14
- Publication Date
- 2026-03-03
- Estimated Expiration
- 2042-09-14
AI Technical Summary
Existing clustering methods struggle to simultaneously consider both intra-cluster compactness and inter-cluster separation of daily load curves, resulting in poor clustering results.
A neural network framework is adopted, and parameters are optimized by allocating the network and centroid layer to minimize intra-class compactness loss and inter-class separation loss, thereby achieving clustering of daily load curves. The training strategy of the neural network is used to minimize the loss function and balance intra-class compactness and inter-class separation.
This improves the clustering quality and stability of the daily load curve, resulting in more accurate and robust clustering results that better reflect the volatility and stability of residential electricity consumption behavior.
Smart Images

Figure CN115526242B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of smart meter applications, and more specifically, relates to a daily load curve clustering method. Background Technology
[0002] Residential demand response aims to reduce peak loads on the power grid and lower system capacity by shifting flexible loads from peak to off-peak periods. During demand response events, the contribution of users with different electricity consumption behaviors to shifting or reducing peak loads varies significantly. Therefore, modeling and analyzing residential electricity consumption behavior is crucial for identifying suitable residential users for demand response.
[0003] However, the diversity and variability of residential electricity consumption behavior make modeling this behavior extremely difficult. Fortunately, the widespread adoption of smart meters has provided a wealth of daily load curves, facilitating the modeling of residential electricity consumption behavior. There are generally two methods for obtaining residential electricity consumption behavior data. One method involves averaging the daily load curves of each resident to obtain a typical load curve, then clustering all the typical load curves to classify the residents' electricity consumption behavior. However, this method only obtains average electricity consumption behavior information, ignoring the fact that the electricity consumption behavior of an individual resident is not static but fluctuates over time. The other method is to directly cluster the daily load curves of all residents and then use multiple typical load curves to represent a user's electricity consumption behavior. This approach preserves the fluctuation information of electricity consumption behavior and better reflects the inherent randomness of residential behavior.
[0004] A good clustering method should balance intra-cluster tightness and inter-cluster separation. Intra-cluster tightness refers to the similarity between samples belonging to the same cluster, while inter-cluster separation refers to the difference between samples belonging to different clusters. Considering only intra-cluster tightness can lead to redundant clusters in the clustering results, while considering only inter-cluster separation can make the clustering results susceptible to outliers. However, existing clustering methods struggle to consider both aspects simultaneously. For example, K-means clustering only considers intra-cluster tightness, while hierarchical clustering only considers inter-cluster separation. Therefore, how to simultaneously consider intra-cluster tightness and inter-cluster separation when clustering daily load curves is a pressing problem that needs to be solved. Summary of the Invention
[0005] In view of the shortcomings of existing technologies and the need for improvement, this invention provides a daily load curve clustering method, which aims to improve the clustering quality and stability of daily load curves.
[0006] To achieve the above objectives, according to one aspect of the present invention, a daily load curve clustering method is provided, comprising:
[0007] A neural network framework including an assignment network and a centroid layer is constructed. The assignment network is used to output the probability that a sample belongs to each cluster after inputting a sample. The centroid layer is used to output the distance from the sample to the centroid of each cluster and the distance between every two cluster centroids after inputting a sample.
[0008] Initialize the network parameters used to characterize each cluster and its centroid. Use a set of unlabeled daily load curves to be clustered. Optimize the parameters of the allocation network with the goal of minimizing the intra-cluster density loss, which characterizes intra-cluster density. Simultaneously optimize the parameters of the centroid layer with the goal of minimizing the weighted sum of the intra-cluster density loss and the inter-cluster separation loss, which characterizes inter-cluster separation. Finally, complete the clustering of the daily load curves to obtain each cluster and its centroid.
[0009] Furthermore, the allocation network is an artificial neural network composed of fully connected layers.
[0010] Furthermore, the intra-class compactness loss is expressed as:
[0011] In the formula, L c The value represents the intra-class density loss, K represents the total number of clusters, N represents the total number of daily load curves in the set of daily load curves, and s represents the total number of daily load curves. ik Represents the load curve x for a certain day i The probability of being assigned to cluster k, ||x i -μ k || represents the daily load curve x i The distance to the centroid of cluster k.
[0012] Furthermore, the inter-class separation loss is expressed as:
[0013] in:
[0014] In the formula, L s The inter-class separation loss is represented by K, where K represents the total number of clusters, and μ represents the total number of clusters. j and μ k Let represent the centroids of the two clusters, and δ represent the minimum distance that needs to be maintained between the centroids.
[0015] Furthermore, the loss function L1 = L of the centroid layer c +γ·L s L c L represents the intra-class compactness loss. s The loss represents the inter-class separation, and γ is a constant coefficient used to balance intra-class compactness and inter-class separation.
[0016] Furthermore, when optimizing the parameters of the allocation network, the objective is to minimize the weighted sum of the intra-class compactness loss and the regularization loss; therefore, the loss function of the allocation network L2 = L c +λ·L r Among them, L c L represents the intra-class compactness loss. r Let λ represent the regularization loss, where λ is a constant coefficient.
[0017] Furthermore, initial centroids are obtained through K-means clustering to initialize the network parameters used to characterize the centroids of each cluster.
[0018] The present invention also provides a computer-readable storage medium comprising a stored computer program, wherein, when the computer program is executed by a processor, it controls the device where the storage medium is located to perform a daily load curve clustering method and / or a residential electricity consumption analysis method as described above.
[0019] In summary, the above-described technical solutions conceived in this invention can achieve the following beneficial effects:
[0020] (1) This invention transforms the clustering problem of daily load curves into a parameter optimization problem of neural networks, and then integrates intra-class compactness and inter-class separation into the loss function of the network. The training strategy of the neural network is used to minimize the loss function, which effectively solves the problem that existing clustering methods cannot simultaneously consider intra-class compactness and inter-class separation, resulting in poor clustering effect. Attached Figure Description
[0021] Figure 1 A flowchart of a daily load curve clustering method provided in an embodiment of the present invention;
[0022] Figure 2 A schematic diagram of a neural network framework including an allocation network and a centroid layer is provided for embodiments of the present invention;
[0023] Figure 3 A typical centroid diagram provided for an embodiment of the present invention. Detailed Implementation
[0024] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention. Furthermore, the technical features involved in the various embodiments of this invention described below can be combined with each other as long as they do not conflict with each other.
[0025] Example 1
[0026] A daily load curve clustering method, such as Figure 1 As shown, it includes:
[0027] A neural network framework including an assignment network and a centroid layer is constructed. The assignment network is used to output the probability that the sample belongs to each cluster after inputting the sample, and the centroid layer is used to output the distance from the sample to the centroid of each cluster and the distance between any two centroids after inputting the sample.
[0028] Initialize the network parameters to characterize each cluster and its centroid. Use a set of unlabeled daily load curves to be clustered. Optimize the network parameters to minimize the intra-cluster density loss, which characterizes intra-cluster density. Simultaneously optimize the centroid layer parameters to minimize the weighted sum of the intra-cluster density loss and the inter-cluster separation loss, which characterizes inter-cluster separation. Finally, complete the clustering of the daily load curves to obtain each cluster and its centroid.
[0029] In summary, this embodiment provides a load clustering method that simultaneously considers intra-class compactness and inter-class separation. The method includes: constructing a clustering network, transforming the clustering problem into a neural network parameter optimization problem, which can then be solved using a neural network parameter optimization algorithm; defining loss functions, i.e., defining two loss functions to characterize intra-class compactness and inter-class separation respectively, transforming the goal of simultaneously improving both into the goal of simultaneously minimizing both loss functions. Specifically, the parameters of the allocation network are optimized with the goal of minimizing the intra-class compactness loss (characterizing intra-class compactness) and the centroid layer parameters are optimized with the goal of minimizing the weighted sum between the intra-class compactness loss and the inter-class separation loss (characterizing inter-class separation); and optimizing network parameters, i.e., designing optimization strategies to simultaneously minimize the two loss functions, ultimately obtaining a clustering result with both good intra-class compactness and inter-class separation.
[0030] Specifically, in the construction of clustering networks, this invention designs a new network framework, such as... Figure 2 As shown, it consists of two parts: an assignment network and a centroid layer. The assignment network is used to learn the relationship between the samples to be clustered and each cluster. Preferably, the assignment network is an artificial neural network composed of fully connected layers. Specifically, the assignment network uses sample x... i As input, the output is sample x i The probability of being assigned to each cluster. The final layer of the assignment network uses softmax as the activation function to satisfy the mandatory condition that the sum of the probabilities is 1. For input sample x i The output of the distribution network is s i =[s i1 ,…,s iK ],in:
[0031]
[0032] Where K is the total number of clusters, s ik For sample x i The probability of being assigned to cluster k. Therefore, sample x i To which cluster y belongs i This can be obtained by finding the cluster corresponding to the highest probability, i.e.: y i =argmaxksik.
[0033] The centroid layer is a single network layer. It contains only one network layer, and its weights are the centroids of each cluster, i.e., [μ1,…,μ]. K ] T , where μ k Let x be the centroid of the k-th cluster. Therefore, the parameter optimization process of the centroid layer is the process of constructing the centroid. The centroid layer is also based on sample x. i As input, the output consists of two parts: one part is the sample x. i The distance to each centroid, i.e., ||x i -μ k The other part is the distance between the centroids, i.e., ||μ. j -μ k ||, where j≠k and j,k∈[1,…,K].
[0034] In the definition of the loss function, this embodiment designs two new loss functions to characterize intra-class compactness and inter-class separation, respectively. Minimizing the intra-class compactness loss ensures that the distance between a sample and its centroid is as small as possible, while minimizing the inter-class separation loss ensures that the centroids of each cluster maintain a large distance. By setting appropriate weight coefficients for these two loss functions, a good balance can be achieved between intra-class compactness and inter-class separation.
[0035] In network parameter optimization, this embodiment employs a neural network parameter optimization algorithm that simultaneously minimizes intra-class compactness loss and inter-class separation loss through mini-batch gradient descent and backpropagation. The network training stops when less than ε% of the samples undergo cluster migration before or after a given training round.
[0036] Therefore, this embodiment proposes a load clustering method that simultaneously considers intra-class compactness and inter-class separation. The clustering problem is transformed into a neural network parameter optimization problem, achieving a balance between the two by minimizing loss functions that respectively characterize intra-class compactness and inter-class separation. This embodiment integrates the goals of improving both intra-class compactness and inter-class separation into the loss function of the clustering network, thus obtaining more accurate and robust clustering results. It solves the problem that existing load clustering methods struggle to simultaneously consider intra-class compactness and inter-class separation, thus failing to obtain high-quality clustering results.
[0037] It should be noted that the construction of the set of unlabeled daily load curves to be clustered can be as follows:
[0038] Data from residents' smart meters is collected and divided by day to form an initial set of daily load curves. Then, each daily load curve is preprocessed by dividing the electricity consumption at each time point of the day by the total daily electricity consumption, resulting in a set of daily load curves to be clustered, X = [x1, ..., x...]. N ] T .
[0039] Preferably, the intra-class compactness loss is expressed as:
[0040] In the formula, L c The value represents the intra-class density loss, K represents the total number of clusters, N represents the total number of daily load curves in the set of daily load curves, and s represents the total number of daily load curves. ik Represents the load curve x for a certain day i The probability of being assigned to cluster k, ||x i -μ k || Represents the load curve x for a given day i The distance to the centroid of cluster k. L c It is an improvement on the K-means loss function. Specifically, it replaces the Boolean variable describing the assignment relationship in the K-means loss with the output probability of the assignment network. To minimize itself, the K-means loss can only alternately update the assignment relationship and the centroid; therefore, the K-means loss can only reach a local minimum. However, the improved L... c Loss can be achieved by simultaneously applying s ik and μ k The gradient is calculated to synchronize the update of the assignment relationship and the centroid, therefore L c The loss can be guaranteed to reach the global minimum, which makes samples belonging to the same cluster more closely clustered around the centroid, i.e., they have better intra-class compactness.
[0041] Preferably, the inter-class separation loss is expressed as:
[0042] in:
[0043] In the formula, L s The inter-class separation loss is represented by K, where K represents the total number of clusters, and μ represents the total number of clusters. j and μ k Let L represent the centroids of the two clusters, and δ be the predefined minimum distance that the centroids should maintain. L is true if and only if any two centroids maintain a distance of at least δ. s Only then can the minimum value of 0 be reached. Therefore, minimizing L... sThis ensures sufficient spacing between clusters, i.e., good inter-class separation.
[0044] Preferably, when optimizing the parameters of the centroid layer, the objective is to minimize the weighted sum of the intra-class compactness loss and the inter-class separation loss; then the loss function of the centroid layer is L1 = L c +γ·L s L c L represents the intra-class compactness loss. s This represents the inter-class separation loss, where γ is a constant coefficient used to balance intra-class compactness and inter-class separation.
[0045] Preferably, when optimizing the parameters of the assignment network, the objective is to minimize the weighted sum of the intra-class compactness loss and the regularization loss; therefore, the loss function of the assignment network is L2 = L c +λ·L r Among them, L c L represents the intra-class tightness loss. r Let λ represent the regularization loss, where λ is a constant coefficient.
[0046] To avoid all samples being concentrated in a few clusters during training, a regularization loss L is introduced into the allocation network. r First, define the marginal probability distribution P = {p1, ..., p2} for all clusters. K}, where p k It is the marginal probability that a sample belongs to cluster k, expressed as:
[0047]
[0048] Then, define the regularization loss L. r For P and uniform distribution The KL divergence between them, i.e.:
[0049]
[0050] When all samples are evenly distributed into K clusters, L r The minimum value of 0 is reached. Therefore, the regularization loss L is minimized. r This can avoid situations where the samples are too concentrated, thus ensuring the quality of clustering.
[0051] Preferably, when initializing network parameters, the network parameters are initialized through randomization; the centroid layer parameters are initialized by using the centroids obtained by the K-means clustering method as initial values.
[0052] Specifically, the optimization process for network parameters involves taking a small batch of samples from the daily load curve set X, denoted as Xb. S Based on X SCalculate the centroid layer loss L1 with respect to the centroid μ k The gradient, i.e.: And the allocation of network loss L2 with respect to s i The gradient, i.e.: Then, backpropagation. and The network parameters of the centroid layer and the distribution network are updated separately.
[0053] Training stops if less than ε% of the samples undergo cluster migration before and after a certain training round. Specifically, the parameters of the allocation network are fixed, and all samples are input into the allocation network to obtain each daily load curve x. i To which cluster y belongs i =argmax k s ik Let the set of all samples belong to the cluster as: Y = [y1, ..., y2] N ] T Then, the set Y is compared with Y' obtained before this round of training. If the proportion of Y and Y' that are different is less than ε%, the training stops; otherwise, the training continues.
[0054] To better illustrate the method of this embodiment, the following example is now given:
[0055] This example uses the clustering method described in this embodiment to perform load clustering on the load dataset of London smart meters published by the Low Carbon London Project.
[0056] This example uses smart meter data containing load curves for 3,674 households throughout 2013. The meter sampling interval is half an hour, meaning each daily load curve contains 48 electricity load values. Each daily load curve is preprocessed by dividing the electricity consumption at each time point by the total daily electricity consumption. The final number of daily load curves to be clustered is 1,341,010.
[0057] In this example, the hyperparameter settings of the allocation network are shown in Table 1. The hidden layers use the ReLU function as the activation function, and the output layer uses the softmax function. The learning rate, optimizer, and other training parameters of the centroid layer are the same as those of the allocation network.
[0058] Table 1 Hyperparameter settings for the allocation network
[0059]
[0060] In this example, the hyperparameter δ in the centroid layer loss function L1 is set to 0.03, and the hyperparameter γ is set to 1. The hyperparameter λ in the assignment network loss function L2 is set to 0.001.
[0061] This example uses two clustering effectiveness metrics to evaluate the quality of clustering and help select the optimal number of clusters: the Davies-Bouldi index (DBI) and the ratio of within-cluster sum of squares to between-cluster variation (WCBCR), with the specific expressions as follows:
[0062]
[0063]
[0064] Where K is the number of clusters. k It is cluster C k The number of daily load curves included. k It is cluster C k The centroids of the clusters are denoted by d(x,y). d(x,y) represents the distance between x and y. DBI and WCBCR simultaneously examine intra-cluster compactness and inter-cluster separation. The smaller the values of DBI and WCBCR, the higher the clustering quality.
[0065] In this example, to better illustrate the superiority of the clustering results obtained by the method of this invention, four existing clustering methods are compared with the method of this invention, including three traditional clustering methods: K-means, Fuzzy-c means (FCM), Self-organizing Map Network (SOM), and one neural network-based clustering method: Deep embedded clustering (DEC). To find a suitable number of clusters K, it is assumed that K can take values within a relatively large range, such as {10, 20, 30, 40, 50, 60, 70, 80, 90, 100}. For any K, the comparison results of the method of this invention and the comparative methods on two clustering effectiveness indices are shown in Table 2. The table clearly shows the values of the clustering method proposed in this invention on the two clustering effectiveness indices DBI and WCBCR. The comparison results are shown in Table 2.
[0066] Table 2 Comparison of DBI and WCBCR indices for different clustering methods
[0067]
[0068] The results in Table 2 show that the method of the present invention has smaller DBI and WCBCR values for any K value, which means that the clustering results obtained by the method of the present invention achieve a better balance between intra-cluster compactness and inter-cluster separation, i.e., better clustering quality.
[0069] Furthermore, by observing the DBI and WCBCR obtained by the method of this invention, it can be found that K=60 is a good choice for the number of clusters. This is because the DBI reaches its minimum value when K=60, and K=60 is an inflection point for WCBCR; that is, WCBCR decreases rapidly with K before K=60, but the rate of decrease slows significantly after K=60. Therefore, K=60 is a good choice for the number of clusters on this dataset.
[0070] The clustering results obtained by the method of this invention can help to understand the characteristics and patterns of residential electricity consumption behavior. To better illustrate this point, Figure 3 The centroids of the nine clusters with the largest sample size obtained using the method of this invention are shown. It is worth noting that the preprocessed daily load curve no longer contains amplitude information, so the results shown only represent the waveform of the electricity load. From Figure 3 As can be seen, these nine centroids represent nine different types of electricity consumption behavior. For example, cluster 1 maintains a nearly constant electricity consumption level throughout the day, which can be interpreted as someone staying at home using electrical appliances all day. Cluster 2 contains two main electricity consumption peaks, occurring at 7:30 AM and 5:30 PM respectively. A reasonable explanation is that residents go out to work in the morning and return home in the afternoon to cook and rest. Cluster 3 also has two main electricity consumption peaks, occurring at 7:30 AM and 8:00 PM respectively. The difference between cluster 3 and cluster 2 is that cluster 3 reflects a later return home time, which can be interpreted as residents returning home after dinner. Therefore, based on the clustering results obtained by the method of this invention, we can infer residents' electricity consumption patterns and daily routines, thereby helping power grid companies to develop personalized energy-saving plans for users.
[0071] In addition, the clustering results obtained by the method of this invention can also help demand response projects screen users with response potential. After obtaining the clustering results using the method of this invention, the stability of residential electricity consumption behavior can be evaluated using Shannon entropy, and the specific calculation formula is as follows: Where E represents Shannon entropy, p k This represents the frequency with which a user's daily load curve belongs to the k-th cluster. A higher Shannon entropy indicates a more dispersed distribution of the user's daily load curve across clusters, suggesting more unstable electricity consumption behavior, and vice versa. Research shows that users with stable electricity consumption behavior are more likely to participate in peak shaving and valley filling in demand response projects over the long term. Therefore, the clustering results obtained by the method in this invention can help demand response projects identify users with stable electricity consumption behavior, thereby improving the efficiency of peak shaving and valley filling in the main power grid.
[0072] Example 2
[0073] The present invention also provides a computer-readable storage medium comprising a stored computer program, wherein, when the computer program is executed by a processor, it controls the device where the storage medium is located to perform a daily load curve clustering method and / or a residential electricity consumption analysis method as described above.
[0074] The relevant technical solutions are the same as in Embodiment 1, and will not be repeated here.
[0075] Those skilled in the art will readily understand that the above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method of clustering daily load curves, characterized in that, The method comprises: building a neural network framework comprising an assignment network and a centroid layer, the assignment network being used to output the probability of an input sample belonging to each cluster, and the centroid layer being used to output the distance between the input sample and each cluster centroid and the distance between each two cluster centroids; initializing network parameters used to represent each cluster and its centroid, using a set of unlabeled daily load curves to be clustered, the set being generated according to collected smart meter data of residents, optimizing the parameters of the assignment network with the objective of minimizing an intra-class compactness loss representing the intra-class compactness, and synchronously optimizing the parameters of the centroid layer with the objective of minimizing the weighted sum between the intra-class compactness loss and an inter-class separability loss representing the inter-class separability, and finally completing the clustering of the daily load curves to obtain each cluster and each cluster centroid; The intra-class compactness loss is represented as: ; wherein, represents the intra-class compactness loss, K represents the total number of clusters, N represents the total number of daily load curves in the set of daily load curves, represents a certain daily load curve is assigned to a cluster , represents a certain daily load curve to the cluster centroid; The inter-class separation loss is expressed as: ; wherein: ; wherein denotes the loss of inter-class separation, K denotes the total number of clusters, and denote the centroids of the two clusters, respectively, denotes the minimum distance that needs to be maintained between the centroids.
2. The daily load curve clustering method of claim 1, wherein, the assignment network is an artificial neural network composed of fully connected layers.
3. The daily load curve clustering method of claim 1, wherein, a loss function of the centroid layer ; wherein, denotes the intra-class compactness loss, denotes the inter-class separability loss, is a constant coefficient used to balance the intra-class compactness and the inter-class separability.
4. The daily load curve clustering method of claim 1, wherein, In optimizing parameters of the allocation network, a weighted sum of the intra-class compactness loss and a regularization loss is minimized; the loss function of the allocation network ; wherein, represents the intra-class compactness loss, represents the regularization loss, is a constant coefficient.
5. The daily load curve clustering method of claim 1, wherein, The initial centroid is obtained by a K-means clustering method to initialize the network parameters used to represent each cluster centroid.
6. A computer readable storage medium characterized by, The computer readable storage medium comprises a stored computer program, wherein the computer program, when executed by a processor, controls the device where the storage medium is located to perform a daily load curve clustering method according to any one of claims 1 to 5.