A power load anomaly detection method, system and device based on optimized K-means clustering

CN118885840BActive Publication Date: 2026-10-30GUANGDONG POWER GRID CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411162547.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-23
Publication Date
2026-10-30
Estimated Expiration
2044-08-23

AI Technical Summary

Technical Problem

[0004]电力负荷数据通常是高维的,高维数据可能使得聚类算法的效果下降,因为在高维空间中,距离度量变得不可靠,此外,季节性变化、假期效应、负荷增长等都可能影响负荷模式,静态聚类方法可能无法有效捕捉噪声或误差等信息,导致将噪声数据误分类为异常,或者将实际异常数据误认为正常

Benefits of technology

[0048]使用特征优选和PCA等方法对负荷数据集进行处理,在保证检测效果的同时也能提高算法的运算速度。通过融合MSICOA算法,对K均值聚类算法的关键参数进行优化处理,本发明显著提升了聚类的效率。MSICOA算法对K均值聚类算法的聚类中心数目和距离计算函数选择两个方面进行优化,有效解决了K均值聚类算法在聚类时受到K值和距离计算的影响问题。本发明显著降低了聚类误差,从而提高了异常检测结果的准确性。特别是在电力负荷异常检测中,准确度的提高对于负荷预测、电力系统的优化调度以及能源管理等方面起到了关键作用。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118885840B_ABST
    Figure CN118885840B_ABST
Patent Text Reader

Abstract

The application discloses a power load anomaly detection method, system and equipment based on optimized K-means clustering, belongs to the technical field of smart grids, and comprises the following steps: taking a person coefficient as a characteristic correlation criterion to perform characteristic optimization, applying principal component analysis to perform dimension reduction processing on data to obtain an initial data set; then, Sobol sequence, reverse learning, Levy flight, positive sine algorithm and longitudinal and transverse cross multi-strategy improved raccoon optimization algorithm are fused; finally, MSICOA algorithm is adopted to perform parameter optimization on the K-means clustering algorithm and then perform anomaly detection. The application optimizes a series of parameters of the K-means clustering algorithm by using the multi-strategy improved raccoon algorithm, improves the convergence speed and search capability of the optimization algorithm, and improves the accuracy of power load anomaly detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of smart grid technology, and more specifically to a method, system, and device for detecting power load anomalies based on optimized K-means clustering. Background Technology

[0002] With the continuous upgrading of smart meters on the user side, the data collection frequency of electricity information acquisition systems is gradually increasing. A wide variety of electricity data is collected in real time, characterized by large data volume, complex structure, and wide distribution, posing challenges to efficient processing and analysis. Real-time and accurate electricity load data provides crucial reference value for power company system planning, electricity load forecasting, and customer energy consumption analysis. The detection and repair of abnormal data is a primary condition for load data analysis and processing. Therefore, how to efficiently and accurately detect and repair abnormal data from massive load data is becoming increasingly important in the research process of power grid informatization construction.

[0003] Anomaly detection methods for power load data include those based on statistics, deep learning, classification models, and clustering models. Statistical anomaly detection methods require the data to conform to a certain regularity estimation model. Deep learning-based anomaly detection methods often require significant computational and time resources. Classification-based anomaly detection methods require selecting an appropriate algorithm model to train on a subset of labeled data. Clustering-based anomaly detection can obtain classification results based on differences in load characteristics, effectively reflecting the overall characteristics of the load curve and detecting anomalies.

[0004] Electricity load data is typically high-dimensional, which can degrade the effectiveness of clustering algorithms. This is because distance metrics become unreliable in high-dimensional spaces. Furthermore, seasonal variations, holiday effects, and load increases can all influence load patterns. Static clustering methods may fail to effectively capture noise or errors, leading to misclassification of noisy data as anomalies or misclassification of abnormal data as normal. For example, K-means clustering relies on the mean to define cluster centers, but anomalies in electricity load data can shift the mean, affecting the clustering results. DBSCAN is highly sensitive to parameter selection and may not be able to handle sparse regions in high-dimensional data. Hierarchical clustering methods may face high computational complexity, especially with large datasets. Additionally, it is highly sensitive to outliers, potentially misclassifying abnormal data.

[0005] Therefore, how to provide a power load anomaly detection method, system, and device based on optimized K-means clustering that can solve the above problems is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0006] In view of this, the present invention provides a method, system, and device for power load anomaly detection based on optimized K-means clustering. Using hourly collected power load data as input, the method employs a multi-strategy improved coati optimization algorithm (MSICOA) to perform anomaly detection on the K-means clustering algorithm. This method improves and optimizes both the optimization algorithm and the clustering algorithm, effectively achieving power system load anomaly detection with high accuracy.

[0007] To achieve the above objectives, the present invention provides the following technical solution:

[0008] A power load anomaly detection method based on optimized K-means clustering includes the following steps:

[0009] S1. Collect load data information of users in various industries in the region of interest;

[0010] S2. Perform feature selection on the load data information;

[0011] S3. Use the PEN coefficient method to draw a heatmap and perform correlation analysis on the features. Remove features with strong correlation to obtain the feature dataset.

[0012] S4. Perform PCA dimensionality reduction on each feature in the feature dataset to obtain the dimensionality-reduced feature dataset.

[0013] S5. Construct an anomaly detection dataset;

[0014] S6. Based on the constructed anomaly detection dataset, the Raccoon optimization algorithm is improved by using Sobol sequences, reverse learning strategy, Levy flight model, sine and cosine algorithms and cross-sectional strategy.

[0015] S7. The improved Raccoon Optimization Algorithm is used to optimize the parameters of the K-means clustering algorithm, and anomaly detection is performed on the anomaly detection dataset.

[0016] Preferably, the load data information includes: date, time, and load value.

[0017] Preferably, the feature selection of the load data information includes: daily maximum load, daily minimum load, daily average load, daily load rate, minimum load rate, maximum load utilization hours, daily peak-to-valley difference, daily peak-to-valley difference rate, coefficient of variation, variance, median difference, and waveform entropy.

[0018] Preferably, step S3, which involves using the PEN coefficient method to create a heatmap and perform correlation analysis on the features, removing highly correlated features to obtain a feature dataset, includes the following steps:

[0019] S31. Use the Person coefficient to measure the linear relationship between two features;

[0020] S32. Draw a heatmap and distinguish the magnitude of the correlation coefficient based on the color of the squares between features;

[0021] S33. Based on the heatmap, remove highly correlated features to obtain the feature dataset.

[0022] Preferably, step S4, performing PCA dimensionality reduction on each feature in the feature dataset to obtain the dimensionality-reduced feature dataset, includes the following steps:

[0023] S41. Calculate the mean vector of the feature samples;

[0024] S42. Subtract the corresponding mean vector from each feature;

[0025] S43. Calculate the covariance matrix of the feature dataset;

[0026] S44. Select the eigenvectors corresponding to the preset partial eigenvalues ​​as principal components, construct a projection matrix, and project the feature dataset onto the subspace composed of the eigenvectors of the preset partial features to obtain the dimensionality-reduced feature dataset.

[0027] Preferably, step S5, constructing the anomaly detection dataset, includes the following steps:

[0028] S51. Treat the feature dataset obtained in S4 as normal data;

[0029] S52. Use methods such as scaling up, scaling down, setting to zero, and deleting to operate on normal data and treat it as abnormal data;

[0030] S53. Based on normal data and abnormal data, construct an anomaly detection dataset.

[0031] Preferably, step S6, based on the constructed anomaly detection dataset, improves the raccoon optimization algorithm using Sobol sequences, backpropagation, Levy flight model, sine and cosine algorithms, and a cross-cutting strategy, including the following steps:

[0032] S61. In the population initialization phase, the population is initialized using the Sobol sequence, and the reverse learning strategy is used to generate opposite individuals within the entire region.

[0033] S62. In the exploration phase, the sine and cosine algorithms are used to explore the optimal solution in the global scope.

[0034] S63. During the development phase, the Levy flight model was introduced into the COA algorithm;

[0035] S64. In the later iterations, a cross-sectional strategy is used to correct individuals.

[0036] The improved raccoon optimization algorithm is obtained based on steps S61-S64.

[0037] Preferably, step S7, which involves optimizing the parameters of the K-means clustering algorithm using an improved raccoon optimization algorithm and performing anomaly detection on the anomaly detection dataset, includes the following steps:

[0038] The anomaly detection dataset is used as the input dataset; the population is initialized and the search for the target solution space begins; K cluster centers are randomly selected and raccoon individuals are divided; the fitness is calculated and defined as the objective function; the iguana's position is maintained in the search space, and the position is updated based on the fitness to find the best position and record the optimal solution; it is determined whether the maximum number of iterations T has been reached, and if not, the update continues; if the maximum number of iterations T has been reached, the process stops; the detection results are output based on the best position and the clustering results.

[0039] A power load anomaly detection system based on optimized K-means clustering includes:

[0040] Data collection module: Collects load data information from users in various industries in the region of interest;

[0041] Feature selection module: performs feature selection on the load data information;

[0042] Feature preprocessing module: The PEN coefficient method is used to draw a heatmap to perform correlation analysis on the features, remove highly correlated features, and obtain the feature dataset;

[0043] Feature dimensionality reduction module: Performs PCA dimensionality reduction on each feature in the feature dataset to obtain the dimensionality-reduced feature dataset;

[0044] Data construction module: Constructs anomaly detection dataset;

[0045] Raccoon Optimization Algorithm Improvement Module: Based on the constructed anomaly detection dataset, the Raccoon Optimization Algorithm is improved by using Sobol sequences, back learning strategy, Levy flight model, sine and cosine algorithms, and cross-multiplication strategy.

[0046] Anomaly detection module: The improved Raccoon Optimization algorithm is used to optimize the parameters of the K-means clustering algorithm, and anomalies are detected on the anomaly detection dataset. An electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements a power load anomaly detection method based on optimized K-means clustering.

[0047] As can be seen from the above technical solution, compared with the prior art, the present invention discloses a method, system and device for detecting power load anomalies based on optimized K-means clustering. The K-means clustering algorithm is optimized using the swarm intelligence optimization algorithm MSICOA, which has the following beneficial effects:

[0048] This invention utilizes feature optimization and PCA to process the load dataset, improving both detection accuracy and computational speed. By integrating the MSICOA algorithm and optimizing key parameters of the K-means clustering algorithm, this invention significantly enhances clustering efficiency. The MSICOA algorithm optimizes two aspects of the K-means clustering algorithm: the number of cluster centers and the selection of the distance calculation function, effectively addressing the issue of the K-means clustering algorithm being affected by the K-value and distance calculation. This invention significantly reduces clustering error, thereby improving the accuracy of anomaly detection results. Especially in power load anomaly detection, the improved accuracy plays a crucial role in load forecasting, optimized power system scheduling, and energy management. Attached Figure Description

[0049] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0050] Figure 1 This is a schematic diagram of the method flow of the present invention;

[0051] Figure 2 Feature correlation heatmap provided for embodiments of the present invention;

[0052] Figure 3 The overall flowchart of MSICOA provided in this embodiment of the invention;

[0053] Figure 4 This is a flowchart of anomaly detection provided in an embodiment of the present invention;

[0054] Figure 5(a) shows the test results of the F1 function provided in the embodiment of the present invention;

[0055] Figure 5(b) shows the test results of the F2 function provided in the embodiment of the present invention;

[0056] Figure 5(c) shows the test results of the F3 function provided in the embodiment of the present invention;

[0057] Figure 5(d) shows the test results of the F4 function provided in the embodiment of the present invention;

[0058] Figure 6(a) is a schematic diagram of the MSICOA-K-means anomaly detection results provided in the embodiment of the present invention;

[0059] Figure 6(b) is a schematic diagram of the COA-K-mean anomaly detection results provided in the embodiment of the present invention;

[0060] Figure 6(c) is a schematic diagram of the K-means anomaly detection results provided in the embodiment of the present invention;

[0061] Figure 7 This is a schematic diagram of the system structure of the present invention. Detailed Implementation

[0062] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. 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 are within the scope of protection of the present invention.

[0063] The purpose of this invention is to provide a method, system, and device for detecting power load anomalies based on optimized K-means clustering. Specifically, it is a method, system, and device for detecting power load anomalies based on optimized K-means clustering (IGWO-Kmedoids) using a fusion multi-strategy improved raccoon algorithm, comprising the following steps: S1, Data Acquisition. Load data and corresponding time and date are collected for each time point in hourly units; S2, Feature Selection. Feature selection is performed on the load data collected in S1, selecting some typical features to replace the original load data for easier subsequent analysis; S3, Feature Optimization. A heatmap is drawn using the PEN coefficient method to perform correlation analysis on the features, eliminating highly correlated features; S4, PCA Dimensionality Reduction. The PCA dimensionality reduction method is used to reduce the dimensionality of the feature dataset after optimization in step S3, improving computational efficiency; S5, Anomaly Detection. This paper improves the Raccoon Optimization Algorithm by employing multiple methods, including Sobol sequences, backpropagation, Levy fly-through, sine and cosine algorithms, and cross-cutting strategies. This enhances the algorithm's performance and effectively improves the results of subsequent clustering optimization algorithms. Furthermore, the improved Raccoon Optimization Algorithm is used to optimize the parameters of the K-means clustering algorithm and then to perform anomaly detection on the data processed in step S4. This provides a solution to the poor detection performance of existing technologies for potentially parameter noise or errors in high-dimensional data.

[0064] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0065] See Figure 1This invention discloses a method for detecting power load anomalies based on optimized K-means clustering, comprising the following steps:

[0066] S1. Collect load data information of users in various industries in the region of interest;

[0067] S2. Feature selection of load data information;

[0068] S3. Use the PEN coefficient method to draw a heatmap and perform correlation analysis on the features. Remove features with strong correlation to obtain the feature dataset.

[0069] S4. Perform PCA dimensionality reduction on each feature in the feature dataset to obtain the dimensionality-reduced feature dataset.

[0070] S5. Construct an anomaly detection dataset;

[0071] S6. Based on the constructed anomaly detection dataset, the Raccoon optimization algorithm is improved by using Sobol sequences, reverse learning strategy, Levy flight model, sine and cosine algorithms and cross-sectional strategy.

[0072] S7. The improved Raccoon Optimization Algorithm is used to optimize the parameters of the K-means clustering algorithm and to perform anomaly detection on the anomaly detection dataset.

[0073] In one specific embodiment, step S1 includes the following steps:

[0074] S11. Collect power load data at hourly sampling intervals.

[0075] Specifically, electrical load refers to the total power actually consumed by a customer's electrical equipment at a given moment. From the perspective of the power system, it refers to the generating capacity available to meet the electricity needs of users. The uneven distribution of electrical load over time results in periods of higher and lower electricity consumption, creating load characteristics such as peak and valley loads. Load data is typically collected by measuring devices (such as smart meters and sensors) installed at key nodes in the power grid and transmitted to a central control system or data center for subsequent acquisition, export, and processing.

[0076] S12. Obtain the required power load data for a certain region and the corresponding time and date information.

[0077] In one specific embodiment, S2 includes the following steps:

[0078] S21. In power systems, changes in power load are influenced by various factors. Based on the periodicity, randomness, and dispersion (time-varying, uncertain, and spatially distributed) of power load, typical characteristics of power load are selected for subsequent analysis. These typical characteristics generally include daily maximum load, daily minimum load, daily average load, daily load factor, minimum load factor, maximum load utilization hours, daily peak-to-valley difference, daily peak-to-valley difference rate, coefficient of variation, variance, median difference, and waveform entropy. These characteristics are used for cluster analysis to facilitate subsequent anomaly detection.

[0079] Specifically, the load characteristics of a power system refer to the features and properties of electrical loads, which can be reflected by relevant characteristic indicators. Therefore, characteristics such as load factor, peak-valley difference, and average load are selected to analyze the features and properties of various types of electrical loads.

[0080] In a specific embodiment, in S3, to address the redundancy of multiple features in step S21, the PEN correlation coefficient method is used to calculate the correlation between each pair of features. One of the features with a high correlation is removed until the correlation between features is weak, thereby eliminating the redundancy between features. S3 specifically includes the following steps:

[0081] S31, the Person coefficient, is mainly used to measure the linear relationship between two variables, and its expression is:

[0082]

[0083] in: It is the covariance of the data sequence, E(X) and E(Y) are the means of the data sequences X and Y, and σ is the mean of the data sequences X and Y. X σ Y Let X and Y be the standard deviations of the data sequences X and Y.

[0084] S32. When drawing a heatmap, the correlation coefficient is distinguished by the color of the squares between features, and features with high correlation are then removed. A heatmap drawn using over 7800 daily load data points from a region in Zhejiang Province is shown below. Figure 2 As shown.

[0085] S33. In this invention, a correlation coefficient greater than 0.9 is defined as a strong correlation. According to... Figure 2 As shown, we choose to delete the four features: maximum load utilization hours, daily peak-to-valley difference, standard deviation, and coefficient of variation.

[0086] Specifically, cluster analysis using all the above features is not only computationally intensive and time-consuming, but also because some features produce similar results. Therefore, to optimize the features in the original feature set, the PEN coefficient method can be used for optimal feature selection. The PEN coefficient ranges from -1 to 1, with a closer absolute value to 1 indicating a stronger linear correlation. Feature selection is performed by calculating the correlation coefficient, eliminating strongly correlated features. A heatmap plotted using the correlation coefficients between load features provides a more intuitive analysis of data correlation.

[0087] In a specific embodiment, in S4, the PCA method is used to reduce the dimensionality of the features in step S31. PCA dimensionality reduction is a technique for simplifying datasets by transforming the data to a new coordinate system such that the first largest variance of any data projection lies on the first coordinate (i.e., the first principal component), the second largest variance lies on the second coordinate (i.e., the second principal component), and so on, thereby reducing the dimensionality of the dataset while preserving the features that contribute the most to the variance. S4 specifically includes the following steps:

[0088] S41. Calculate the mean vector of the feature samples:

[0089]

[0090] Where m is the number of samples, and each sample x i It is an n-dimensional vector.

[0091] S42. Subtract the corresponding mean from each feature:

[0092]

[0093] Where X is the feature vector.

[0094] S43. Calculate the covariance matrix of the dataset.

[0095]

[0096] Eigenvalue decomposition of the covariance matrix yields eigenvalues ​​λ1, λ2, ..., λ. n and the corresponding feature vectors v1, v2, ..., v n .

[0097] S44. Select the eigenvectors corresponding to the first S eigenvalues ​​as principal components, construct a projection matrix W (each column is an eigenvector), and project the dataset onto the subspace composed of the first S eigenvectors:

[0098] X reduced =X centered W

[0099] Among them, X reduced It is the dimensionality-reduced dataset.

[0100] Specifically, subtract the mean from each feature and divide by its standard deviation, so that the mean of each feature is 0 and the standard deviation is 1. Calculate the covariance matrix of the standardized data; the covariance matrix reflects the linear correlation between the features. Calculate the eigenvalues ​​and eigenvectors of the covariance matrix using eigenvalue decomposition or singular value decomposition (SVD). The eigenvalues ​​reflect the variance of the corresponding eigenvectors. Sort the eigenvalues ​​in descending order, and select the eigenvectors corresponding to the top k eigenvalues ​​as the basis vectors of the new coordinate system; these eigenvectors are called principal components.

[0101] Specifically, S5 involves constructing an anomaly detection dataset, including: selecting the feature data obtained in S4 as normal data; and using methods such as scaling up, scaling down, zeroing out, and deletion to manipulate a specific data point or segment, classifying it as anomaly data. Anomaly detection is then performed on the constructed normal and anomaly datasets as input. Experiments have verified that this method effectively detects anomalies that do not belong to the same cluster and those with low density and small proportions.

[0102] In one specific embodiment, in S6, the MSICOA algorithm is used to optimize the parameters of the K-means clustering algorithm to improve the adaptability and accuracy of anomaly detection. This specifically includes the following steps:

[0103] Anomaly detection dataset construction. Over 7800 daily load data points collected from a certain region at 1-hour intervals were selected as normal data. Amplification, scaling, zeroing, and deletion methods were used to manipulate specific data points or segments, classifying them as anomalous data. The constructed normal and anomalous data were then used as input datasets for anomaly detection. Specific experimental parameters were: population size 100, number of iterations 200, and cluster center range [2,10].

[0104] In one specific embodiment, in S6, multiple methods such as Sobol sequence, back learning, Levy flight, sine and cosine algorithms, and cross-multiplication strategies are used to optimize the population initialization, exploration, and development stages of the raccoon optimization algorithm, which can effectively solve the problems of randomness, periodicity, and local convergence of the algorithm.

[0105] Specifically, improvements to COA include: addressing the issue of uneven random distribution during COA population initialization, using Sobol sequences to make the initial population more ergodic and non-repetitive; employing a reverse learning strategy to generate opposite individuals in the initial population region, enhancing COA's global optimization capability; utilizing the periodicity of sine and cosine algorithms to perform global exploration during the COA exploration phase, avoiding local optima; addressing the local convergence problem during the COA development phase, using the Levy flight strategy to enhance the randomness of the raccoon search trajectory; and addressing the issue of COA easily getting trapped in local optima in later iterations, using a cross-cutting strategy to correct the population individuals. The overall MSICOA flowchart is shown below. Figure 3 As shown.

[0106] S6 specifically includes the following steps:

[0107] S61. Population Initialization. To address the relatively uneven distribution of the initial population when using random initialization, a Sobol sequence is used for initialization. A reverse learning strategy is employed to generate opposite individuals within the entire region, enhancing the optimization capability of the COA algorithm and increasing the probability of selecting the optimal solution. The expression is:

[0108] x reverse =x + r1·(r2·(ub) j +lb j -x)-x)

[0109] Where r1 and r2 are random numbers in the range [0,1], and x is the current solution.

[0110] S62, Exploration Phase. The sine and cosine algorithms are used to explore the optimal solution globally. The expression is:

[0111]

[0112] Where l1 controls the next position of the search agent, l1, l3 > 1, and l2 ∈ [0, 2π] is the movement step size. I is a random integer in {1, 2}, and F i , x represents the current fitness and the fitness of each raccoon at its new location. i,j It is the value of the j-th candidate solution. This represents the position of the j-th dimension of the i-th population.

[0113] S63. Development Phase. During the development phase of the COA algorithm, localized rapid convergence is a common problem. To address this, Levy flight is introduced into the COA algorithm to enhance the randomness of the search trajectory. The step size formula for Levy flight is as follows:

[0114]

[0115] Where u and v are n-dimensional spatial vectors, with a mean of 0 and a variance of σ. u σ v It follows a normal distribution, β = 1.5.

[0116]

[0117] Where λ is the step size control factor, r is a random number in [0,1], and ub j and lb j The upper and lower bounds of the j-th candidate solution

[0118] S64. In the later iterations of the COA algorithm, the population is prone to getting trapped in local optima. A cross-sectional strategy is adopted to correct the individuals.

[0119] The horizontal cross expression is:

[0120]

[0121] in, and F is the offspring obtained after the crossover of individuals i and j in the d-th dimension, where r1 and r2 are random numbers in the range [0,1]. i,d and F j,d It is the parent individual F i and F j The d-th dimension, c1 and c2 are random numbers between [-1, 1].

[0122] The vertical cross expression is:

[0123]

[0124] in, It is the offspring obtained after the parent generation crosses over.

[0125] More specifically, in step S6, the Multi-Strategy Improved Raccoon Optimization Algorithm (MSICOA) can be obtained. This algorithm is tested and verified using four functions selected in the CEC2005 test set. The results are shown in Figures 5(a)-(d). As can be seen from the figures, the improved algorithm has a faster convergence speed.

[0126] Specifically, S7 uses this algorithm to optimize the number of clusters and distance metric of K-means clustering for anomaly detection in power load.

[0127] See Figure 4As shown, the population is first initialized and the search for the target solution space begins. Then, K cluster centers are randomly selected, and raccoon individuals are divided into K clusters based on these centers. Fitness is then calculated and defined as the objective function. While maintaining the iguana's position in the search space, raccoons will attack the best prey during the exploration phase and randomly search for new food. During the development phase, when a predator attacks a raccoon, the raccoon flees its original position, generating a random position near each raccoon's current location. If the new position enhances fitness, that position is updated. An improved raccoon optimization algorithm is used to optimize all individuals in the population, calculating fitness values ​​and identifying the best individual and its corresponding fitness value, recording the optimal solution. The process stops if the maximum number of iterations T is reached. Based on the optimal position and clustering results, the detection results are output. Otherwise, updates continue.

[0128] The technical solution proposed in this invention will be further described below through specific embodiments.

[0129] In a proposed power load anomaly detection method based on an improved Raccoon Algorithm optimized by K-means clustering using a multi-strategy fusion approach, the effectiveness of MSICOA is first verified. Then, an improved Raccoon Algorithm is used to optimize K-means clustering for power load anomaly detection. The MSICOA-K-means algorithm effectively detects anomalies that do not belong to the same cluster and those with low density and small proportions; categories 2, 3, and 4 are identified as inter-cluster anomalies. To further verify the effectiveness of the proposed method, 100 data points were selected from normal data, and 10 of these were modified to be anomalies. Three algorithms were then used for anomaly detection. For comparison with the MSICOA-K-means algorithm, see [link to relevant documentation]. Figures 6(a)-6(c) The anomaly detection results show that the K-means algorithm divides the normal data clusters into two clusters, which leads to overfitting and inaccurate detection results, making it unsuitable for analysis.

[0130] See Figure 7 On the other hand, embodiments of the present invention disclose a power load anomaly detection system based on optimized K-means clustering, comprising:

[0131] Data collection module: Collects load data information from users in various industries in the region of interest;

[0132] Feature selection module: performs feature selection on the load data information;

[0133] Feature preprocessing module: The PEN coefficient method is used to draw a heatmap to perform correlation analysis on the features, remove highly correlated features, and obtain the feature dataset;

[0134] Feature dimensionality reduction module: Performs PCA dimensionality reduction on each feature in the feature dataset to obtain the dimensionality-reduced feature dataset;

[0135] Data construction module: Constructs anomaly detection dataset;

[0136] Raccoon Optimization Algorithm Improvement Module: Based on the constructed anomaly detection dataset, the Raccoon Optimization Algorithm is improved by using Sobol sequences, back learning strategy, Levy flight model, sine and cosine algorithms, and cross-multiplication strategy.

[0137] Anomaly detection module: The improved Raccoon Optimization algorithm is used to optimize the parameters of the K-means clustering algorithm and to perform anomaly detection on the anomaly detection dataset.

[0138] In another aspect, embodiments of the present invention disclose an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements a power load anomaly detection method based on optimized K-means clustering.

[0139] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.

[0140] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. An optimization-based K The power load anomaly detection method based on mean clustering is characterized by, Includes the following steps: S1. Collect load data information of users in various industries in the region of interest; S2. Perform feature selection on the load data information; S3. Use the PEN coefficient method to draw a heatmap and perform correlation analysis on the features. Remove features with strong correlation to obtain the feature dataset. S4. Perform PCA dimensionality reduction on each feature in the feature dataset to obtain the dimensionality-reduced feature dataset. S5. Construct an anomaly detection dataset; S6. Based on the constructed anomaly detection dataset, the Raccoon optimization algorithm is improved by using Sobol sequences, reverse learning strategy, Levy flight model, sine and cosine algorithms and cross-sectional strategy. S7. The improved Raccoon Optimization Algorithm is used to optimize the parameters of the K-means clustering algorithm, and anomaly detection is performed on the anomaly detection dataset. Specifically, S6, based on the constructed anomaly detection dataset, employs Sobol sequences, a back-learning strategy, a Levy flight model, sine and cosine algorithms, and a cross-sectional strategy to improve the raccoon optimization algorithm, including the following steps: S61. In the population initialization phase, the population is initialized using the Sobol sequence, and the reverse learning strategy is used to generate opposite individuals within the entire region. S62. In the exploration phase, the sine and cosine algorithms are used to explore the optimal solution in the global scope. S63. During the development phase, the Levy flight model was introduced into the COA algorithm; S64. In the later iterations, a cross-sectional strategy is used to correct individuals. The improved raccoon optimization algorithm is obtained based on steps S61-S64; The S7 algorithm employs an improved raccoon optimization algorithm. K The mean clustering algorithm is used to optimize parameters and perform anomaly detection on the anomaly detection dataset, including the following steps: The anomaly detection dataset is used as the input dataset; the population is initialized and the search for the target solution space begins; K cluster centers are randomly selected and raccoon individuals are divided; fitness is calculated and defined as the objective function; the iguana's position is maintained in the search space, and the position is updated based on fitness to find the best position and record the optimal solution; it is determined whether the maximum number of iterations T has been reached. If not, the update continues; if the maximum number of iterations T has been reached, the update stops; the detection results are output based on the best position and the clustering results.

2. An optimization-based method according to claim 1 K The power load anomaly detection method based on mean clustering is characterized by, The load data information includes: date, time, and load value.

3. An optimization-based method according to claim 1 K The power load anomaly detection method based on mean clustering is characterized by, The feature selection of the load data information includes: daily maximum load, daily minimum load, daily average load, daily load rate, minimum load rate, maximum load utilization hours, daily peak-to-valley difference, daily peak-to-valley difference rate, coefficient of variation, variance, median difference, and waveform entropy.

4. An optimization-based method according to claim 1 K The power load anomaly detection method based on mean clustering is characterized by, S3, using the PEN coefficient method to draw a heatmap and perform correlation analysis on the features, removing highly correlated features to obtain the feature dataset, includes the following steps: S31. Use the PEN coefficient to measure the linear relationship between two features; S32. Draw a heatmap and distinguish the magnitude of the correlation coefficient based on the color of the squares between features; S33. Based on the heatmap, remove highly correlated features to obtain the feature dataset.

5. An optimization-based method according to claim 1 K The power load anomaly detection method based on mean clustering is characterized by, Step S4 involves performing PCA dimensionality reduction on each feature in the feature dataset to obtain the dimensionality-reduced feature dataset, including the following steps: S41. Calculate the mean vector of the feature samples; S42. Subtract the corresponding mean vector from each feature; S43. Calculate the covariance matrix of the feature dataset; S44. Select the eigenvectors corresponding to the preset partial eigenvalues ​​as principal components, construct a projection matrix, and project the feature dataset onto the subspace composed of the eigenvectors of the preset partial features to obtain the dimensionality-reduced feature dataset.

6. The power load anomaly detection method based on optimized K-means clustering according to claim 1, characterized in that, S5, constructing the anomaly detection dataset, includes the following steps: S51. Treat the feature dataset obtained in S4 as normal data; S52. Use methods such as scaling up, scaling down, setting to zero, and deleting to operate on normal data and treat it as abnormal data; S53. Based on normal data and abnormal data, construct an anomaly detection dataset.

7. A power load anomaly detection system based on optimized K-means clustering, utilizing the power load anomaly detection method based on optimized K-means clustering as described in any one of claims 1 to 6, characterized in that, include: Data collection module: Collects load data information from users in various industries in the region of interest; Feature selection module: performs feature selection on the load data information; Feature preprocessing module: The PEN coefficient method is used to draw a heatmap to perform correlation analysis on the features, remove highly correlated features, and obtain the feature dataset; Feature dimensionality reduction module: Performs PCA dimensionality reduction on each feature in the feature dataset to obtain the dimensionality-reduced feature dataset; Data construction module: Constructs anomaly detection dataset; Raccoon Optimization Algorithm Improvement Module: Based on the constructed anomaly detection dataset, the Raccoon Optimization Algorithm is improved by using Sobol sequences, back learning strategy, Levy flight model, sine and cosine algorithms, and cross-multiplication strategy. Anomaly detection module: The improved Raccoon Optimization algorithm is used to optimize the parameters of the K-means clustering algorithm and to perform anomaly detection on the anomaly detection dataset.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the power load anomaly detection method based on optimized K-means clustering as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Electric energy metering abnormal data identification and compensation method based on parameter optimization

    CN114528949A

  • Artificial intelligence based fire and power anomaly prediction system and method

    KR102283884B1