Distributed resource data clustering method and system
By combining CNN and spectral clustering algorithms, and utilizing detailed feature extraction and spatial attention modules, the efficiency and accuracy problems of traditional methods in distributed resource data clustering are solved, achieving efficient and accurate distributed resource data clustering.
Patent Information
- Application Number
- CN202311698120.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-09
- Publication Date
- 2026-08-25
- Estimated Expiration
- 2043-12-09
AI Technical Summary
Traditional clustering methods struggle to effectively handle large-scale, high-dimensional distributed resource data, and they also fail to guarantee computational efficiency and accuracy in distributed computing environments.
By combining CNN and spectral clustering algorithms, feature extraction is performed through a detail feature extraction module and a spatial attention module, and cluster analysis is performed using the spectral clustering algorithm.
It improves the accuracy and efficiency of distributed resource data clustering, better captures the inherent structure and patterns of data, adapts to complex data characteristics, and enhances the accuracy and robustness of the clustering model.
Smart Images

Figure CN117633574B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of power engineering technology, specifically relating to a distributed resource data clustering method and system. Background Technology
[0002] With the widespread application of distributed resources across various industries, such as energy management and intelligent manufacturing, intelligent clustering of distributed resources has become a highly anticipated research direction. Distributed resources include power curve data of various devices. These curves record the energy consumption patterns of the devices over different time periods, reflecting their operating characteristics and behavioral patterns. By rationally clustering this power curve data, applications such as device classification management, anomaly detection, and energy consumption analysis can be achieved, thus providing strong support for the rational utilization and intelligent management of distributed resources.
[0003] However, traditional clustering methods face several challenges when dealing with distributed resources. First, because distributed resource data is typically large-scale and high-dimensional, traditional clustering methods struggle to effectively capture its inherent structure. Second, distributed resource data is usually distributed across different locations or nodes, requiring consideration of how to perform clustering analysis in a distributed computing environment to ensure computational efficiency and accuracy. With the increasing number and complexity of distributed resources, how to efficiently cluster these resources for intelligent management and optimized allocation has become an important research topic. Summary of the Invention
[0004] The purpose of this invention is to overcome the shortcomings of the above-mentioned background technology and provide a distributed resource data clustering method and system. This method overcomes the problems faced by traditional clustering methods when dealing with distributed resources, and combines the powerful advantages of CNN in feature extraction with the outstanding performance of spectral clustering algorithm in clustering methods.
[0005] To achieve the above objectives, the present invention adopts the following technical solution:
[0006] In a first aspect, the present invention provides a distributed resource data clustering method, comprising:
[0007] Acquire various power curve data of distributed resources and convert the power curve data into input data in tensor form;
[0008] The input data is fed into a CNN model for feature extraction. The CNN model includes a ResNet, a detail feature extraction module, and a spatial attention module. In the encoding stage, the detail feature extraction module is used to capture detailed information in the power curve data. In the decoding stage, the spatial attention module is used to dynamically adjust the feature weights at different positions and reconstruct the data, and then output the data through a fully connected layer.
[0009] The spectral clustering algorithm is used to perform cluster analysis on the output of the fully connected layer to obtain the cluster to which each sample belongs.
[0010] As a further improvement of the present invention, the step of using a detail feature extraction module to capture detailed information in the power curve data during the encoding stage includes:
[0011] Receive feature information x from two adjacent scales of ResNet a and x b Extract:
[0012] For feature x a Max pooling downsampling is performed to compress the features to half their original size. Then, a 1×1 convolution is applied to halve the number of channels. Without changing the spatial dimension of the feature map, the information between channels is linearly combined to obtain the feature information x. a semantic features;
[0013] For feature x b Perform a 1×1 convolution to extract useful local feature information, obtaining feature information x. b semantic features;
[0014] The semantic features obtained from these two operations are added and subtracted respectively.
[0015] Then perform a 3×3 convolution on each of them to further extract features; then obtain x a ′ and x b ′; Finally, x a ′ and x b The sum of these two values gives the final output y. out .
[0016] As a further improvement of the present invention, the calculation formula for the processing of the detail feature extraction module is as follows:
[0017] x a ′=Conv 3×3 (Conv 1×1 Maxpool(x a ))+Conv 1×1 (x b )),
[0018] x b ′=Conv 3×3 (Conv 1×1 (x b )-Conv 1×1 Maxpool(x a ))),
[0019] yout =x a ′+x b ′.
[0020] In the formula, Conv 1×1 (·) represents a two-dimensional convolution with a kernel size of 1, batch normalization, and ReLU activation function. 3×3 (·) represents a 2D convolution with a kernel size of 3, batch normalization, and ReLU activation function; MaxPool(·) represents max pooling; where x a and x b These represent features at two different scales generated by ResNet.
[0021] As a further improvement of the present invention, the step of dynamically adjusting the feature weights at different positions and reconstructing them using a spatial attention module in the decoding stage includes:
[0022] First, consider the input feature x. in Max pooling and average pooling are performed separately to obtain x1 and x2, respectively. Then, a 1×1 convolution is performed on x1 to extract features, resulting in x1′. Next, x1′ is added to x2, and then a 3×3 convolution is performed on x2′ to obtain feature x2″. This feature is then added to x1′ and fused to obtain x1″. Finally, x1″ and x2″ are concatenated, followed by a 1×1 convolution, and then Sigmad activation is applied. Finally, a weighted multiplication with the input features is performed to obtain the final output y. out .
[0023] As a further improvement of the present invention, the calculation formula for the processing of the spatial attention module is as follows:
[0024] x1′=Conv 1×1 Maxpool(x in )),
[0025] x2′=x1′+Avgpool(x in ),
[0026] x1″=Conv 3×3 (x2′)+x1′,
[0027]
[0028] In the formula, AvgPool(·) represents global average pooling, and MaxPool(·) represents global max pooling; Indicates element-wise multiplication; Conv 1×1 (·) represents a two-dimensional convolution with a kernel size of 1, batch normalization, and ReLU activation function. 3×3(·) represents a 2D convolution with a kernel size of 3, batch normalization, and ReLU activation function; y out The final output is indicated by [;], which represents the concatenation operation, and Sig(·) represents the Sigmoid activation function.
[0029] As a further improvement of the present invention, the step of using a spectral clustering algorithm to perform cluster analysis on the output of the fully connected layer to obtain the cluster to which each sample belongs includes:
[0030] The output of the fully connected layer is used as input data to obtain a feature matrix; each row represents a sample and each column represents a feature.
[0031] Next, the similarity matrix is calculated: based on the input data, a similarity matrix W is constructed, and the similarity between samples is calculated;
[0032] Then, construct an adjacency graph: transform the similarity matrix into a weighted undirected graph, where nodes represent samples and edge weights represent the similarity between samples;
[0033] Then, the similarity matrix is calculated: for an adjacency graph, the degree of each node is calculated;
[0034] Next, calculate the Laplace matrix L: calculate the Laplace matrix;
[0035] Then, eigenvalue decomposition is performed: the Laplacian matrix is decomposed into eigenvalues, the first k eigenvalues are taken, and its eigenvector U = {u1, u2, u3, ..., u4} is calculated. k},U∈R n*k k is a positive integer;
[0036] Next, select the eigenvectors: based on the eigenvalues, select the corresponding eigenvectors as the basis for clustering;
[0037] Then clustering is performed: the selected feature vectors are used as input, and the K-means clustering algorithm is used to cluster the samples;
[0038] Finally, the clustering results are obtained: based on the output of the clustering algorithm, the cluster to which each sample belongs is obtained.
[0039] As a further improvement of the present invention, the calculation formula for the process of clustering the output of the fully connected layer using the spectral clustering algorithm is as follows:
[0040]
[0041]
[0042] L = DW,
[0043] L rw =D-1 L,
[0044] Wherein d(v i ,v j ) represents the Euclidean distance between two samples, and σ represents the scale parameter.
[0045] In a second aspect, the present invention provides a distributed resource data clustering method system, comprising:
[0046] The data acquisition module is used to acquire various power curve data of distributed resources and convert the power curve data into input data in tensor form.
[0047] The feature extraction module is used to input the input data into a CNN model for feature extraction. The CNN model includes a ResNet, a detail feature extraction module, and a spatial attention module. In the encoding stage, the detail feature extraction module is used to capture detailed information in the power curve data. In the decoding stage, the spatial attention module is used to dynamically adjust the feature weights at different positions and reconstruct the data, and then output the data through a fully connected layer.
[0048] The clustering analysis module is used to perform clustering analysis on the output of the fully connected layer using the spectral clustering algorithm to obtain the cluster to which each sample belongs.
[0049] In a third aspect, the present invention provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the distributed resource data clustering method.
[0050] Fourthly, the present invention provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the distributed resource data clustering method.
[0051] Compared with the prior art, the present invention has the following beneficial effects:
[0052] This invention proposes a distributed resource data clustering method based on detailed feature enhancement and spatial attention, combining deep learning algorithms with clustering algorithms. First, data preparation is performed. For distributed resources—various power curves—the input data is transformed into a tensor form that can be processed by a CNN model. This tensor is then input into the CNN model for feature extraction. Since the detailed information extracted by a simple CNN in the encoding stage is insufficient, a detailed feature extraction module is introduced to capture the detailed information in the power curve data. This module effectively extracts local features from the power curves through multi-layer convolution operations, thereby enhancing the model's expressive power. In the decoding stage, a spatial attention module is introduced so that the model can dynamically adjust the feature weights at different locations, focusing more on regions beneficial to the clustering task and improving the model's clustering accuracy. Furthermore, in the decoding stage, the features processed by the detailed feature extraction and spatial attention module are reconstructed to retain important information. Next, a fully connected layer maps the features to the final clustering result space, preparing the input for the spectral clustering algorithm. Finally, the spectral clustering algorithm is used to perform cluster analysis on the output of the fully connected layer, thereby achieving intelligent clustering of distributed resources. This invention not only achieves a significant technological breakthrough in power curve data processing, but also brings obvious beneficial effects in the application of distributed resource data clustering, providing an efficient and accurate solution for intelligent clustering of distributed resources. Attached Figure Description
[0053] Figure 1 This is a flowchart of the distributed resource data clustering method of the present invention;
[0054] Figure 2 This is a basic flowchart of the present invention;
[0055] Figure 3 This is a schematic diagram of the detailed feature extraction module in this invention;
[0056] Figure 4 This is a schematic diagram of the spatial attention module structure in this invention;
[0057] Figure 5 This is a schematic diagram of the distributed resource data clustering method system of the present invention;
[0058] Figure 6 This is a schematic diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0059] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0060] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0061] This invention aims to overcome the limitations of traditional clustering methods in distributed resource data clustering, and proposes a distributed resource data clustering method based on detailed feature enhancement and spatial attention. The algorithm utilizes deep learning technology to extract features from electrical appliance power curve data, and processes these features through a detailed feature enhancement module and a spatial attention module to obtain more representative feature vectors. The processed features are then input into a spectral clustering model to achieve intelligent clustering of distributed resources.
[0062] like Figure 1 As shown, the first objective of this invention is to provide a distributed resource data clustering method, comprising:
[0063] S1: Obtain various power curve data of distributed resources and convert the power curve data into input data in tensor form;
[0064] S2, the input data is input into a CNN model for feature extraction. The CNN model includes a ResNet, a detail feature extraction module, and a spatial attention module. In the encoding stage, the detail feature extraction module is used to capture detailed information in the power curve data. In the decoding stage, the spatial attention module is used to dynamically adjust the feature weights at different positions and reconstruct the data, and then output the data through a fully connected layer.
[0065] S3 uses a spectral clustering algorithm to perform cluster analysis on the output of the fully connected layer to obtain the cluster to which each sample belongs.
[0066] This invention fully leverages the information within distributed resources, improving clustering accuracy and providing an effective technical means for resource management in practical applications. Furthermore, this technology possesses strong practicality and widespread applicability, significantly contributing to the intelligent management of distributed resources. It combines the powerful advantages of CNNs in feature extraction with the outstanding performance of spectral clustering algorithms in clustering methods.
[0067] As examples, the model used in this invention is described below:
[0068] (1) Model training: The network model includes the backbone network ResNet18, the detail feature extraction module (DFEM), and the spatial attention module (SAM). With the combined effect of these modules, time series data can be extracted well and features can be mapped to the clustering space, preparing for subsequent clustering tasks.
[0069] (2) Spectral Clustering Prediction: The features passed through the fully connected layer are mapped to a high-dimensional vector space. A similarity matrix is constructed using these high-dimensional feature vectors. Using the constructed similarity matrix, the spectral clustering algorithm projects the high-dimensional features into a low-dimensional feature space, making similar samples in this space even closer. Then, the similarity matrix is normalized or transformed to obtain a Laplacian matrix. By calculating the eigenvectors of the Laplacian matrix, the samples are mapped to a new feature space. Usually, the first few eigenvectors of the Laplacian matrix are selected as the new feature representation to cluster the samples in a higher-dimensional feature space. Finally, based on the relative positional relationships in the mapped feature space, the samples are divided into different clusters.
[0070] Therefore, the present invention has the following advantages:
[0071] Feature extraction capability: This invention introduces ResNet for feature extraction, which can efficiently extract rich feature information from electrical appliance power curve data. As a deep neural network structure, ResNet can effectively improve the feature extraction capability when processing power curves with complex patterns and regularities.
[0072] Enhancement of detailed information: Through the detailed feature enhancement module, this invention can focus on enhancing detailed information when fusing features of adjacent scales; this enables the clustering model to more sensitively capture small changes in the power curve, thereby improving the accuracy of clustering.
[0073] The introduction of spatial attention: The spatial attention module introduced in the decoding stage can perform weighted processing of local features in specific regions. This means that the algorithm can pay attention to the importance of certain regions in the power curve, so that the model can treat information in different regions more specifically. This attention mechanism makes the clustering model more perceptive of the key parts of the power curve.
[0074] Efficient Fully Connected Layer Output: By utilizing the output of fully connected layers, this invention transforms the high-level abstract features extracted by the deep learning model into feature vectors that can be processed by the spectral clustering algorithm. This not only reduces the complexity of the clustering model but also provides more representative input for spectral clustering. Improved Clustering Accuracy: This invention comprehensively utilizes deep learning methods and spectral clustering techniques to achieve more accurate clustering results in distributed resource data clustering tasks. Through deep feature extraction of power curves and the application of efficient clustering models, this invention performs excellently in complex scenarios, improving the accuracy and robustness of clustering.
[0075] As an optional embodiment of the present invention, the present invention firstly addresses the need to focus on subtle changes and detailed features in the data when processing time-series data such as power curves. These features are crucial for distinguishing different devices or situations. However, traditional feature extraction methods may not be able to capture this detailed information effectively. Therefore, a dedicated module is needed to enhance the extraction capability of spatial information. Secondly, power curve data typically contains features at different scales, such as instantaneous and continuous changes. Fusing features at adjacent scales can help the model understand the characteristics of the data more comprehensively. Therefore, designing a detailed feature extraction module to fuse information at adjacent scales and capture and enhance detailed information is highly practical. This module not only enhances the extraction capability of detailed information but also achieves the fusion of information at adjacent scales, finely processes features at different scales, and enhances the expressive power of the model. This allows the clustering model to better adapt to the characteristics of time-series data such as power curves, improving the accuracy and robustness of the clustering results.
[0076] The specific technical description is as follows: The detail feature extraction module receives feature information from two adjacent scales of ResNet. That is, when extracting features from two adjacent scales, it first extracts features from x. a Performing max pooling downsampling compresses the features to half their original size, reducing computational cost while preserving important feature information. Then, a 1×1 convolution is applied, further halving the number of channels. This allows for linear combination of information between channels without altering the spatial dimensions of the feature map. Finally, another feature x is processed... bPerform a 1×1 convolution to extract useful local feature information; then, add and subtract the semantic features obtained from these two operations respectively. This introduces the interaction information between features. Addition preserves common information, while subtraction highlights the differences between them, thus enriching the feature set. Next, perform a 3×3 convolution to further extract features, making them more representative; then, x is obtained. a ′ and x b ′; Finally, x a ′ and x b The sum of these two values gives the final output y. out In summary, this module refines and extracts feature information from two adjacent scales through a series of convolution, pooling, and feature fusion operations, thereby enhancing the model's expressive power and performance.
[0077] As an optional embodiment of the present invention, for time-series data such as power curves, information from different time periods or regions may have different importance. Traditional attention mechanisms often simply give the same level of attention to different regions, failing to flexibly distinguish the importance of different regions. Therefore, a module needs to be designed to dynamically adjust feature weights, enabling the model to treat information from different regions more selectively. The design of the spatial attention module allows the model to better perceive the importance of each region in the input data. By weighting specific regions, the model can focus more specifically on important regions, thereby improving the model's ability to perceive spatial information. Moreover, by dynamically adjusting feature weights, the spatial attention module gives the model greater flexibility and expressive power when processing information from different regions. This allows the model to better adapt to the characteristics of data such as power curves, thereby improving the accuracy and robustness of the clustering model. In practical applications, time-series data such as power curves may be affected by various factors, and the importance of different regions may change over time. Designing a spatial attention module allows the model to flexibly cope with this complexity, thereby improving the model's adaptability.
[0078] The specific technical description is as follows: This module consists of two branches. First, the input feature x is processed... inMax pooling and average pooling are performed separately to obtain x1 and x2, respectively, extracting salient and average distribution features from the input features. Then, a 1×1 convolution is performed on x1 to extract more useful features, resulting in x1′. Next, x1′ is added to x2, fusing the dual-branch features to obtain x2′. Then, a 3×3 convolution is performed on x2′ to obtain a more refined feature x2″, which is then added to x1′ and fused to obtain x1″. Finally, x1″ is concatenated with x2″ to obtain a richer feature set, followed by a 1×1 convolution, Sigmoid activation, and finally a weighted multiplication with the input features to obtain the output y. out This module, as part of a distributed resource data clustering method based on detailed feature enhancement and spatial attention, is characterized by dynamically adjusting feature weights to enhance the attention given to different regions of the input data. This improves the model's ability to perceive spatial information and enhances its adaptability and expressiveness in distributed resource data clustering tasks.
[0079] As an optional embodiment of the present invention, the output of the deep learning model is applied to the spectral clustering algorithm for final clustering. Deep learning networks possess powerful feature learning capabilities when processing complex data, extracting high-level abstract feature information from the original data. Inputting the output of the deep learning network into the clustering algorithm fully leverages the feature learning capabilities of deep learning, combined with the global information utilization capabilities of clustering, thereby improving the clustering effect. Traditional clustering algorithms such as K-Means are ineffective at partitioning non-convex clusters, easily dividing complex clusters into multiple smaller clusters. However, the spectral clustering algorithm, by representing data points as nodes in a graph, utilizes spectral decomposition techniques to discover complex non-convex clusters, thus meeting the needs of processing such complex clusters in real-world data. Furthermore, in distributed resource data clustering tasks, electrical power curve data often exhibits high complexity and nonlinear characteristics. The spectral clustering algorithm is suitable for nonlinearly separable datasets, capable of capturing the inherent complex structure and patterns of the data. Moreover, the spectral clustering algorithm is not sensitive to the distribution pattern of the data or the number of clusters, thus being applicable to datasets of various forms and flexibly adapting to different distributed resource data clustering scenarios.
[0080] Technical description of the spectral clustering algorithm: First, data preparation: The output of the fully connected layer is used as input data to obtain a feature matrix. Each row represents a sample, and each column represents a feature. Next, the similarity matrix is calculated: Based on the input data, a similarity matrix W is constructed, and the similarity between samples is calculated. Then, an adjacency graph is constructed: The similarity matrix is transformed into a weighted undirected graph, where nodes represent samples, and the weights of the edges represent the similarity between samples. Then, the degree matrix D is calculated: For the adjacency graph, the degree of each node is calculated (degree refers to the sum of the weights of the edges connecting the node). Next, the Laplacian matrix L is calculated: The Laplacian matrix is calculated. Then, eigenvalue decomposition is performed: The Laplacian matrix is decomposed into eigenvalues, and the first k eigenvalues are taken and their eigenvectors U = {u1, u2, u3, ..., u...} are calculated. k},U∈R n*k Next, feature vectors are selected: based on the feature values, the corresponding feature vectors are selected as the basis for clustering. Typically, the first few feature vectors with smaller feature values are selected. Then, clustering is performed: using the selected feature vectors as input, the K-means clustering algorithm is used to cluster the samples. Finally, the clustering results are obtained: based on the output of the clustering algorithm, the cluster to which each sample belongs is determined.
[0081] The present invention will now be described in detail with reference to specific embodiments and accompanying drawings.
[0082] An embodiment of the present invention provides a distributed resource data clustering method based on detailed feature enhancement and spatial attention, as follows: Figure 2As shown. In the encoding stage, to effectively handle power curves with complex patterns and regularities, ResNet is used for feature extraction, which can efficiently extract rich feature information from the power curve data of electrical appliances. Considering that the feature granularity extracted by the simple ResNet structure is not sufficient, which may lead to the inability to capture the detailed features of the power curve, a detail feature enhancement module is adopted, which can focus on enhancing the detailed information when fusing features of adjacent scales. This allows the clustering model to more sensitively capture the subtle changes in the power curve, thereby improving the accuracy of clustering. However, there may be some key time periods or specific power changes in the power curve data. For the clustering task, the information in these areas may be more important. Therefore, this invention adds a spatial attention module in the decoding stage, which can selectively enhance the feature expression of the region of interest, thereby better capturing its characteristics. Moreover, the power curves of different devices may have different feature distributions. By introducing the spatial attention module, the model can adaptively handle the characteristics of different power curves, making the clustering model more universal and adaptable. Then, this invention transforms the high-level abstract features extracted by the deep learning model into feature vectors that can be processed by the spectral clustering algorithm through a fully connected layer, providing a more representative input for the subsequent spectral clustering algorithm. Finally, the spectral clustering algorithm is applied because, in distributed resource data clustering tasks, electrical power curve data often have high complexity and nonlinear characteristics. The spectral clustering algorithm is suitable for nonlinearly separable datasets and can capture the inherent complex structure and patterns of the data. Moreover, the spectral clustering algorithm is not sensitive to the distribution pattern of the data and the number of clusters, so it is suitable for datasets of various types and can flexibly adapt to different distributed resource data clustering scenarios. The complete architecture of the model is as follows: Figure 2 As shown.
[0083] like Figure 3As shown, the backbone network first uses ResNet18 to extract features. ResNet, as a deep neural network structure, effectively improves feature extraction capabilities when dealing with power curves with complex patterns and regularities. ResNet18, while maintaining feature extraction capabilities, reduces model complexity. In deep learning models, as information is passed to deeper layers, gradient vanishing or exploding problems easily occur, making it difficult to effectively retain and utilize some detailed features. Furthermore, for existing distributed resource data clustering tasks, small fluctuations in the power curve often contain important information, and the power curves of different devices may also have subtle differences, which are often reflected in detailed information. However, traditional deep learning models may not be able to fully capture these micro-changes. Therefore, this invention designs a detailed feature enhancement module to alleviate these problems, ensuring that the model can fully utilize the detailed information in the power curve, enabling the model to more sensitively capture small changes in the power curve, thereby improving the discriminative power of the clustering model and allowing it to better distinguish differences between different devices or operating conditions. The specific implementation process is as follows:
[0084] The detail feature extraction module receives feature information from two adjacent scales of ResNet. That is, when extracting features from two adjacent scales, it first extracts features from x. a Performing max pooling downsampling compresses the features to half their original size, reducing computational cost while preserving important feature information. Then, a 1×1 convolution is applied, further halving the number of channels. This allows for linear combination of information between channels without altering the spatial dimensions of the feature map. Finally, another feature x is processed... b Perform a 1×1 convolution to extract useful local feature information; then, add and subtract the semantic features obtained from these two operations respectively. This introduces the interaction information between features. Addition preserves common information, while subtraction highlights the differences between them, thus enriching the feature set. Next, perform a 3×3 convolution to further extract features, making them more representative; then, x is obtained. a ′ and x b ′; Finally, x a ′ and x b The sum of these two values gives the final output y. out In summary, this module refines and extracts feature information from two adjacent scales through a series of convolution, pooling, and feature fusion operations, thereby enhancing the model's expressive power and performance. The calculation formulas for the above process are as follows:
[0085] x a ′=Conv 3×3 (Conv 1×1Maxpool(x a ))+Conv 1×1 (x b )),
[0086] x b ′=Conv 3×3 (Conv 1×1 (x b )-Conv 1×1 Maxpool(x a ))),
[0087] y out =x a ′+x b ′.
[0088] In the formula, Conv 1×1 (·) represents a two-dimensional convolution with a kernel size of 1, batch normalization, and ReLU activation function. 3×3 (·) represents a 2D convolution with a kernel size of 3, batch normalization, and ReLU activation. MaxPool(·) represents max pooling. Where x a and x b These represent features at two different scales generated by ResNet.
[0089] like Figure 4 As shown, the features output by the detail feature enhancement module are more fine-grained semantic features. At this point, it is very important to distinguish some key time periods and specific power changes in these fine-grained semantics and reduce the influence of irrelevant noise. Therefore, an attention mechanism is introduced. However, the traditional spatial attention mechanism cannot meet the requirements of this task. Specifically, the data features of distributed resources have complex correlations, so a simple linear weight combination may not be able to capture the correlation relationship of the input data well, and may even lead to information loss to some extent.
[0090] Therefore, employing a spatial attention module and introducing it during the decoding stage allows for selective enhancement of feature representation in regions of interest, thereby better capturing their characteristics. Furthermore, power curves from different devices may exhibit different feature distributions; by introducing the spatial attention module, the model can adaptively handle the characteristics of different power curves, making the clustering model more universal and adaptable. The specific implementation process is as follows:
[0091] This module consists of two branches. First, it processes the input feature x. inMax pooling and average pooling are performed separately to obtain x1 and x2, respectively, extracting salient and average distribution features from the input features. Then, a 1×1 convolution is performed on x1 to extract more useful features, resulting in x1′. Next, x1′ is added to x2, fusing the dual-branch features to obtain x2′. Then, a 3×3 convolution is performed on x2′ to obtain a more refined feature x2″, which is then added to x1′ and fused to obtain x1″. Finally, x1″ is concatenated with x2″ to obtain a richer feature set, followed by a 1×1 convolution, Sigmoid activation, and finally a weighted multiplication with the input features to obtain the output y. out This module, as part of a distributed resource data clustering method, is characterized by dynamically adjusting feature weights to enhance the focus on different regions of the input data. This improves the model's ability to perceive spatial information and enhances its adaptability and expressiveness in distributed resource data clustering tasks. The calculation formula for the above process is as follows:
[0092] x1′=Conv 1×1 Maxpool(x in )),
[0093] x2′=x1′+Avgpool(x in ),
[0094] x1″=Conv 3×3 (x2′)+x1′,
[0095]
[0096] In the formula, AvgPool(·) represents global average pooling, and MaxPool(·) represents global max pooling; This indicates element-wise multiplication. Conv 1×1 (·) represents a two-dimensional convolution with a kernel size of 1, batch normalization, and ReLU activation function. 3×3 (·) represents a 2D convolution with a kernel size of 3, batch normalization, and ReLU activation function. out This indicates the final output. [;] indicates a concatenation operation, and Sig(·) represents the Sigmoid activation function.
[0097] Then, this invention transforms the high-level abstract features extracted by the deep learning model into feature vectors that can be processed by the spectral clustering algorithm through a fully connected layer, providing a more representative input for the subsequent spectral clustering algorithm.
[0098] Finally, the spectral clustering algorithm is applied. In distributed resource data clustering tasks, appliance power curve data often exhibits high complexity and nonlinear characteristics. Spectral clustering is suitable for nonlinearly separable datasets, capturing the inherent complex structure and patterns of the data. Furthermore, spectral clustering is not sensitive to the distribution of data or the number of clusters, making it suitable for datasets of various types and flexibly adaptable to different distributed resource data clustering scenarios. Compared to some traditional clustering algorithms, spectral clustering is relatively less affected by noise and outliers, improving the robustness of clustering to a certain extent. The specific implementation process of the spectral clustering algorithm is as follows:
[0099] First, data preparation is performed: the output of the fully connected layer is used as input data to obtain a feature matrix. Each row represents a sample, and each column represents a feature. Next, the similarity matrix is calculated: based on the input data, a similarity matrix W is constructed, and the similarity between samples is calculated. Then, an adjacency graph is constructed: the similarity matrix is transformed into a weighted undirected graph, where nodes represent samples, and the edge weights represent the similarity between samples. Then, the degree matrix D is calculated: for the adjacency graph, the degree of each node is calculated (degree refers to the sum of the weights of the edges connecting the node). Next, the Laplacian matrix L is calculated: the Laplacian matrix is calculated. Then, eigenvalue decomposition is performed: the Laplacian matrix is decomposed into eigenvalues, the first k eigenvalues are taken, and its eigenvector U = {u1, u2, u3, ..., u...} is calculated. k},U∈R n*k Next, feature vectors are selected: based on the feature values, the corresponding feature vectors are selected as the basis for clustering. Typically, the first few feature vectors with smaller feature values are selected. Then, clustering is performed: using the selected feature vectors as input, the K-means clustering algorithm is used to cluster the samples. Finally, the clustering results are obtained: based on the output of the clustering algorithm, the cluster to which each sample belongs is obtained. Here, k is a positive integer.
[0100] The calculation formula for the above process is as follows:
[0101]
[0102]
[0103] L = DW,
[0104] L rw =D -1 L,
[0105] Wherein d(v i ,v j ) represents the Euclidean distance between two samples, and σ represents the scale parameter.
[0106] like Figure 5As shown, a second objective of this invention is to provide a distributed resource data clustering system, comprising:
[0107] The data acquisition module is used to acquire various power curve data of distributed resources and convert the power curve data into input data in tensor form.
[0108] The feature extraction module is used to input the input data into a CNN model for feature extraction. The CNN model includes a ResNet, a detail feature extraction module, and a spatial attention module. In the encoding stage, the detail feature extraction module is used to capture detailed information in the power curve data. In the decoding stage, the spatial attention module is used to dynamically adjust the feature weights at different positions and reconstruct the data, and then output the data through a fully connected layer.
[0109] The clustering analysis module is used to perform clustering analysis on the output of the fully connected layer using the spectral clustering algorithm to obtain the cluster to which each sample belongs.
[0110] like Figure 6 As shown, a third objective of this invention is to provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the distributed resource data clustering method.
[0111] A fourth objective of this invention is to provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the distributed resource data clustering method.
[0112] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0113] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0114] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0115] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0116] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the specific implementation of the present invention. Any modifications or equivalent substitutions that do not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.
Claims
1. A distributed resource data clustering method, characterized in that, include: Acquire power curve data of various electrical appliances in distributed resources, and convert the power curve data into input data in tensor form; The input data is fed into a CNN model for feature extraction. The CNN model includes a ResNet, a detail feature extraction module, and a spatial attention module. In the encoding stage, a detail feature extraction module is used to capture detailed information in the power curve data; in the decoding stage, a spatial attention module is used to dynamically adjust the feature weights at different locations and reconstruct the data, and then output the data through a fully connected layer. The spectral clustering algorithm is used to perform cluster analysis on the output of the fully connected layer to obtain the cluster to which each sample belongs; The method of using a detail feature extraction module to capture detailed information in the power curve data during the encoding stage includes: Receive feature information from two adjacent scales of ResNet and Extract: Features Max pooling downsampling is performed to compress the features to half their original size, and then another... Convolution, by compressing the number of channels to half the original number, linearly combines the information between channels without changing the spatial dimension of the feature map to obtain feature information. semantic features; Features Perform a Convolution extracts useful local feature information to obtain feature information. semantic features; The semantic features obtained from these two operations are added and subtracted respectively. Then do one each Convolution further extracts features; then we get and Finally, and Add them together to get the final output. .
2. The distributed resource data clustering method according to claim 1, characterized in that, The calculation formula for the processing of the detail feature extraction module is as follows: In the formula, This represents a 2D convolution with a kernel size of 1, batch normalization, and the ReLU activation function. This represents a 2D convolution with a kernel size of 3, batch normalization, and the ReLU activation function. This represents max pooling; where, and These represent features at two different scales generated by ResNet.
3. The distributed resource data clustering method according to claim 1, characterized in that, The step of dynamically adjusting feature weights at different locations and reconstructing the data using a spatial attention module during the decoding stage includes: First, the input features Perform max pooling and average pooling respectively to obtain and Then on Perform a Convolutional feature extraction yielded Next and Perform the addition operation, and then Perform a Convolution yields features And then with The addition operation is used to merge the results, resulting in... Then the obtained and Perform splicing, then perform another... The process involves convolution, followed by Sigmoid activation, and finally a weighted multiplication with the input features to obtain the final output. .
4. The distributed resource data clustering method according to claim 3, characterized in that, The calculation formula for the processing of the spatial attention module is as follows: In the formula, Indicates global average pooling. Indicates global max pooling; This indicates element-wise multiplication; This represents a 2D convolution with a kernel size of 1, batch normalization, and the ReLU activation function. This represents a 2D convolution with a kernel size of 3, batch normalization, and the ReLU activation function. This indicates the final output. This indicates a splicing operation. This represents the Sigmoid activation function.
5. The distributed resource data clustering method according to claim 1, characterized in that, The method of using spectral clustering algorithm to perform cluster analysis on the output of the fully connected layer to obtain the cluster to which each sample belongs includes: The output of the fully connected layer is used as input data to obtain a feature matrix; each row represents a sample and each column represents a feature. Calculate the similarity matrix: Based on the input data, construct the similarity matrix W and calculate the similarity between samples; Constructing an adjacency graph: Transform the similarity matrix into a weighted undirected graph, where nodes represent samples and edge weights represent the similarity between samples; Perform similarity matrix calculation: For an adjacency graph, calculate the degree of each node; Calculate the Laplacian matrix L: Calculate the Laplacian matrix; Perform eigenvalue decomposition: Perform eigenvalue decomposition on the Laplacian matrix, take the first k eigenvalues and calculate their eigenvectors. k is a positive integer; Selecting eigenvectors: Based on the eigenvalues, select the corresponding eigenvectors as the basis for clustering; Clustering: The selected feature vectors are used as input, and the K-means clustering algorithm is used to cluster the samples; Obtain clustering results: Based on the output of the clustering algorithm, obtain the cluster to which each sample belongs.
6. The distributed resource data clustering method according to claim 5, characterized in that, The calculation formula for the process of clustering the output of the fully connected layer using the spectral clustering algorithm is as follows: in, This represents the Euclidean distance between two samples. Indicates the scale parameter.
7. A distributed resource data clustering system, implementing the distributed resource data clustering method according to any one of claims 1-6, characterized in that, include: The data acquisition module is used to acquire various power curve data of distributed resources and convert the power curve data into input data in tensor form. The feature extraction module is used to input the input data into a CNN model for feature extraction. The CNN model includes a ResNet, a detail feature extraction module, and a spatial attention module. In the encoding stage, the detail feature extraction module is used to capture detailed information in the power curve data. In the decoding stage, the spatial attention module is used to dynamically adjust the feature weights at different positions and reconstruct the data, and then output the data through a fully connected layer. The clustering analysis module is used to perform clustering analysis on the output of the fully connected layer using the spectral clustering algorithm to obtain the cluster to which each sample belongs.
8. An electronic device, characterized in that, It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the distributed resource data clustering method according to any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the distributed resource data clustering method according to any one of claims 1-6.