An improved k-means abnormal load detection method and system

By calculating the weight and disparity parameters of the load data set in the k-means algorithm, eliminating outliers and selecting the initial cluster center, the traditional k-means algorithm is solved on the initial cluster center selection and outlier influence. The problem has improved the accuracy of abnormal load detection and the stability of the power system.

CN114358207BActive Publication Date: 2025-01-17ELECTRIC POWER RES INST OF STATE GRID ZHEJIANG ELECTRIC POWER COMAPNY +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210033466.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-12
Publication Date
2025-01-17
Estimated Expiration
2042-01-12

AI Technical Summary

Technical Problem

The traditional k-means algorithm is sensitive to the initial clustering center selection and has a great impact on outliers, resulting in poor detection accuracy and convergence, affecting the normal operation of the power system.

Method used

By calculating the weight of the load data set, the number of clusters K is determined by the elbow method, and outliers are eliminated according to the weighted anomaly parameters, the initial clustering center is selected, and the k-means algorithm is improved to improve the accuracy of abnormal data detection.

Benefits of technology

It improves the accuracy of abnormal load detection and reduces operating costs, which is of great significance to the analysis and control of smart grids.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114358207B_ABST
    Figure CN114358207B_ABST
Patent Text Reader

Abstract

The present invention discloses an improved k-means abnormal load detection method and system. The detection method of the present invention comprises the steps of: determining the number of clusters K by using the elbow method, and recording the clustering result when the optimal number of clusters K is reached as the first clustering result; calculating the weighted dissimilarity between each data, and calculating the dissimilarity parameter, the average dissimilarity of the overall data, and the average dissimilarity parameter of the overall data, and eliminating outliers according to the dissimilarity parameter; finding K initial cluster centers according to the principle that the dissimilarity parameter between the cluster center and other points is larger; inputting the number of clusters K and the K initial cluster centers into the k-means algorithm, and outputting the clustering result using the k-means algorithm; abnormal data determination. The present invention improves the k-means algorithm, increases the influence of weights when calculating the dissimilarity, and improves the detection accuracy of abnormal data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of power system data processing, in particular to an improved k-means abnormal load detection method and system. Background Art

[0002] At present, the rapid development of the power system and the continuous advancement of power reform have made the structure and operation of the power grid more and more complex. As an important part of the power grid, the distribution network is not only characterized by wide distribution, complex operation and large scale, but also for power users, the safe operation of the distribution network is the key to obtaining reliable and high-quality electricity. In the distribution network, there are many users and the data quality is uneven. Whether the user's load data is reliable and accurate greatly affects the progress and development of my country's power industry. However, with the increase in the scale of distribution network data, the imperfection of the measurement system and the influence of the transmission channel, some abnormal phenomena will inevitably occur in the power load data, such as missing points, continuous zero values, continuous fixed values, sudden increase points, sudden drop points, abnormal noise load points, etc. These abnormal loads will not only affect the control and analysis of the distribution network, but more seriously, the incorrect judgments made by the power system dispatcher based on these abnormal loads are likely to destroy the normal operation of the system, and then destroy the safety and stability of the power system. In order to ensure the safe operation of the power system and the optimal control of the distribution network, it is very necessary to detect these abnormal data.

[0003] Given the importance of load data of distribution network users, the detection method of abnormal load data has attracted the attention of many experts and scholars. They have studied the detection of abnormal data by analyzing the characteristics of load data and using theories such as statistical analysis, clustering, neural networks and data mining. Among them, the k-means algorithm is a widely used and easy-to-implement method.

[0004] As a clustering algorithm, the k-means algorithm can classify data according to its own attributes. The clustering results can show the density or sparseness of the data objects. Based on this feature, the k-means algorithm can be used to detect abnormal loads. The traditional k-means algorithm selects the initial cluster center randomly. Studies have found that the k-means algorithm is always sensitive to the initial cluster center. Different initial cluster centers will produce different clustering results, affecting the accuracy and convergence of the algorithm. In addition, studies have found that outliers will have a great impact on the k-means clustering effect. Summary of the invention

[0005] The technical problem to be solved by the present invention is to overcome the defects of the above-mentioned prior art and provide an improved k-means abnormal load detection method and system, which improves the k-means algorithm and increases the influence of weights when calculating the dissimilarity to improve the detection accuracy of abnormal data.

[0006] To this end, a technical solution adopted by the present invention is: an improved k-means abnormal load detection method, which comprises the steps of:

[0007] 1) Obtain distribution network load data and obtain a load data set;

[0008] 2) Standardize the load data set to remove the impact of dimension on clustering; and calculate the weights of different dimensions of the load data set;

[0009] 3) Use the elbow method to determine the number of clusters K, and record the clustering result when the optimal number of clusters K is obtained as the first clustering result;

[0010] 4) Calculate the weighted dissimilarity between each data, and calculate the dissimilarity parameter, the average dissimilarity of the overall data, and the average dissimilarity parameter of the overall data, and remove outliers according to the dissimilarity parameter; find K initial cluster centers according to the principle that the dissimilarity parameter between the cluster center and other points is larger;

[0011] 5) Input the number of clusters K and the K initial cluster centers into the k-means algorithm, and use the k-means algorithm to output the clustering results;

[0012] 6) Determination of abnormal data.

[0013] Furthermore, the specific content of step 1) is: collect daily load data of each user of the distribution network, assuming that there are n users, with one point every hour, that is, the daily load of 24 sampling points per day, as the load data set X; convert the load data set X into a matrix form, where the rows represent the daily load data of different users, the columns represent the load at different times, and the data dimension is n×24.

[0014] Furthermore, in step 2), the weight calculation process of different dimensions of the load data set is as follows:

[0015] 21) Calculate dimension weights

[0016]

[0017] P ij is the proportion of the attribute in the jth column of the i-th sample, x ij is the data sample of the i-th row and j-th column of the load data set X;

[0018] 22) Calculate information entropy

[0019]

[0020] E j is the information entropy of the j-th column attribute;

[0021] 23) Calculate weight

[0022]

[0023] w j is the weight of the attribute in the jth column (the weight of the load at time j), 0≤w j ≤1, m represents 24 moments.

[0024] Furthermore, the specific contents of step 3) are as follows:

[0025] Assume that the load data set X is divided into K categories, and K ranges from 1 to For each K value, k-means clustering is performed. The specific process of k-means clustering is as follows: First, k-means clustering randomly selects K data as random initial cluster centers c i , i = 1, ... K; then calculate the Euclidean distance from each data to each cluster center, the formula is as follows:

[0026]

[0027] x p represents the load data of the pth user, c i Represents the random initial cluster center, j represents different moments, and m represents 24 moments; according to the principle of minimizing the distance within the class, each data is classified into the class closest to it, and then the new value of each cluster center is calculated. The formula is as follows:

[0028]

[0029] Among them, c′ i represents the new cluster center, M p represents the pth cluster, |M p |Represents M p The number of data in the cluster, p = 1, 2, ... n, x represents the data in the pth cluster, until the cluster center no longer changes, and finally output the clustering result; the SSE formula is as follows:

[0030]

[0031] Finally, record the data of K and SSE and form a relationship diagram. Select K corresponding to the elbow as the optimal number of clusters. The clustering result when the optimal number of clusters K is recorded is the first clustering result.

[0032] Furthermore, the specific contents of step 4) are as follows:

[0033] 41) Calculate the dissimilarity

[0034]

[0035] In the formula, x is Sample data of the i-th user at time s, x js represents the sample data of the jth user at the sth moment; r (s) ij represents the difference between the i-th user and the j-th user at time s; x rs are all values ​​of the load of all users at time s;

[0036] 42) Calculate sample data x i With x j The weighted dissimilarity between ij

[0037]

[0038] In the formula, w s is the weight at time s, w s Multiply the dissimilarity between user i and user j at time s to get the weighted dissimilarity between user i and user j at time s, where p represents 24 moments;

[0039] 43) Get the dissimilarity matrix

[0040]

[0041] 44) Calculate the dissimilarity parameter S for each data i And the average dissimilarity of the overall data mean.r

[0042]

[0043]

[0044] Where δ(z) is the defined function;

[0045] 45) Calculate the average value of the overall data dissimilarity parameter mean.S

[0046]

[0047] 46) Identify outliers and determine K cluster centers

[0048] S t <β*mean.S,

[0049] Among them, S tis the dissimilarity parameter of the abnormal data, β∈(0,1); if it satisfies the above formula, it is regarded as an outlier. Then the load data set X is divided into a normal data set U and an outlier data set V. The data point with the largest dissimilarity parameter S in the normal data set U is taken as the first initial clustering center. Then all data points whose dissimilarity with the data point is less than the average dissimilarity are deleted from U, and the remaining data points form a new data space U*. Then, step 41)-44) is performed. After calculation, the data point with the largest dissimilarity parameter S is found as the second initial clustering center. And so on, iterate until K clustering centers are found.

[0050] Furthermore, the specific contents of step 5) are as follows:

[0051] Input the number of clusters K and the K initial cluster centers into the k-means algorithm, and calculate the Euclidean distance between each data u in the data set U and the K cluster centers. The formula is as follows:

[0052]

[0053] u p represents the load data of the pth user in the dataset U, a i represents the K initial cluster centers selected in step 4), j represents different moments, and m represents 24 moments;

[0054] According to the principle of minimizing the distance within a class, each data is classified into the class closest to it, and then the new value of each cluster center is calculated. The formula is as follows:

[0055]

[0056] In the formula, a′ i represents the new cluster center, M p represents the pth cluster, |M p |Represents M p The number of data in the cluster, p = 1, 2, ... n, and then calculate the Euclidean distance between each data and the new cluster center, and divide the data into different classes until the cluster center no longer changes; until the cluster center no longer changes, finally output the clustering result.

[0057] Furthermore, the specific contents of step 6) are as follows:

[0058] The second clustering result is compared with the first clustering result. If the second clustering result is better than the first clustering result, the data in the outlier data set V is determined to be the load data of abnormal users.

[0059] The business data used in the present invention involves power system analysis, energy management system (EMS), data acquisition and monitoring control system (SCADA) and user load information collection system, etc. Based on the load information of distribution network users, the traditional k-means clustering algorithm is improved by using information entropy and dissimilarity matrix to perform abnormal load data detection for each user in the distribution network. Through the above improvements, the present invention can improve the accuracy of abnormal load detection, which can not only improve the accuracy of power load prediction and reduce operating costs, but also has important significance for the analysis and control of future smart grids.

[0060] Another technical solution adopted by the present invention is: an improved k-means abnormal load detection system, which includes:

[0061] Load data acquisition unit: acquires distribution network load data and obtains load data set;

[0062] Weight calculation unit: standardizes the load data set to remove the impact of dimension on clustering; and calculates the weights of different dimensions of the load data set;

[0063] K value determination unit: determines the number of clusters K using the elbow method, and records the clustering result when the optimal number of clusters K is reached as the first clustering result;

[0064] Initial cluster center acquisition unit: calculate the weighted dissimilarity between each data, and calculate the dissimilarity parameter, the average dissimilarity of the overall data, and the average dissimilarity parameter of the overall data, and remove outliers according to the dissimilarity parameter; find K initial cluster centers according to the principle that the dissimilarity parameter between the cluster center and other points is larger;

[0065] Clustering result output unit: input the number of clusters K and K initial cluster centers into the k-means algorithm, and output the clustering results using the k-means algorithm;

[0066] Abnormal data determination unit: used for abnormal data determination.

[0067] The beneficial effects of the present invention are as follows: the present invention uses the dissimilarity matrix and information entropy weighting to improve the weakness of the traditional k-means algorithm that is sensitive to the initial cluster center and outliers; in addition, the present invention improves two defects of the traditional k-means algorithm. First, the dissimilarity is weighted by information entropy, which can better reflect the distance and degree of dissimilarity between data of different dimensions, and the results of clustering accuracy and abnormal calculation are more accurate, thereby improving the performance of the algorithm; second, the average dissimilarity parameter is used to detect outliers and eliminate them, avoiding the adverse effects of outliers on the clustering effect of the k-means algorithm. Finally, the abnormal user data is judged by comparing the results of the two clusterings before and after. The present invention has better anomaly detection performance, can effectively detect abnormal user load data, and provides an important guarantee for achieving high-precision load forecasting. BRIEF DESCRIPTION OF THE DRAWINGS

[0068] Figure 1 is a flow chart of the abnormal load detection method of the present invention;

[0069] Figure 2 It is a structural diagram of the abnormal load detection system of the present invention. DETAILED DESCRIPTION

[0070] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0071] Explanation of relevant terms

[0072] K-means algorithm: K-means algorithm is also called K-means algorithm, which is one of the most widely used classic clustering algorithms. It is a clustering method that uses the distance from the data point to the cluster center as the optimization objective function. According to the core idea of ​​clustering algorithm, K-means algorithm divides data into different clusters according to the principle of maximizing the similarity within the cluster and minimizing the similarity between clusters.

[0073] Information entropy: Information entropy is a classic algorithm for calculating attribute weights, which can be used to calculate the discreteness of attributes. For a certain indicator, the smaller its entropy value, the greater the discreteness of the indicator and the greater the amount of information it contains.

[0074] Dissimilarity matrix: The dissimilarity matrix stores the similarity between n objects, expressed as an n×n dimensional matrix. r(i,j) is a quantitative representation of the dissimilarity between objects i and j, usually a non-negative value. The more similar or "close" the two objects are, the closer their value is to 0, and the more different they are, the larger their value is, and r(i,j)=r(j,i), r(i,i)=0.

[0075] Elbow method: A method for finding the number of clusters K. The principle is to determine the optimal number of clusters K by observing the inflection point in a two-dimensional rectangular coordinate system through the correspondence between the K value and SSE. First, assume (The K value here is an empirical value. For details, please refer to the following two documents: 1. Yu Jian, Cheng Qiansheng. Search range of optimal number of clusters in fuzzy clustering method [J], Chinese Science (Series E), 2002, 32(2): 274-280. 2. Li Hongyan, Hu Linlin, Wang Jiangbo, et al. Research on the method of determining the optimal number of clusters based on K-means [J]. Computer Knowledge and Technology: Academic Exchange, 2014. Both documents mentioned the selection of the maximum value of K, which is also obtained through most experience).

[0076] Calculate the SSE for each K value separately. As the K value increases, the SSE will decrease. It will decrease significantly at the beginning, and when K increases to a certain value, the SSE will slowly decrease. This value is the optimal number of clusters K.

[0077] Example 1

[0078] refer to Figure 1 This embodiment provides an improved k-means abnormal load detection method, which includes the following steps:

[0079] (1) Obtain the load data of the distribution network. Collect the daily load data of each user of a distribution network, assuming that there are n daily load data, with one point every hour, that is, the daily load of 24 sampling points, as the load data set X. Convert the load data set into a matrix form, where the rows represent the daily load data of different users, and the columns represent the load at different times. The data dimension is n×24.

[0080] (2) Standardization processing to remove the influence of dimension on clustering.

[0081]

[0082] x ij is the data in the i-th row and j-th column of the load data set X, μ is the mean of the sample data in the i-th row, and σ is the standard deviation of the sample data in the i-th row.

[0083] Calculate the weights of different dimensions of the load dataset X

[0084] (21) Calculate dimension weights

[0085]

[0086] P ij is the proportion of the attribute in the jth column of the i-th sample, x ij is the data sample in the i-th row and j-th column of the load data set X.

[0087] (22) Calculation of information entropy

[0088]

[0089] E j is the information entropy of the j-th column attribute.

[0090] (23) Calculate weight

[0091]

[0092] w j is the weight of the attribute in the jth column.

[0093] (3) Use the elbow criterion to determine the number of clusters K.

[0094] Assume that the load data set X is divided into K categories. According to experience, K is generally taken between 1 and For each K value, k-means clustering is performed. First, k-means clustering randomly selects K data as random initial cluster centers c i , i = 1, ... K; then calculate the Euclidean distance from each data to each cluster center, the formula is as follows:

[0095]

[0096] x p represents the load data of the pth user, c i Represents the random initial cluster center, j represents different moments, and m represents 24 moments; according to the principle of minimizing the distance within the class, each data is classified into the class closest to it, and then the new value of each cluster center is calculated. The formula is as follows:

[0097]

[0098] Among them, c′ i represents the new cluster center, M p represents the pth cluster, |M p |Represents M p The number of data in the cluster, p = 1, 2, ... n, x represents the data in the pth cluster, until the cluster center no longer changes, and finally output the clustering result; the SSE formula is as follows:

[0099]

[0100] Finally, record the data of K and SSE and form a relationship diagram. Select K corresponding to the elbow as the optimal number of clusters. The clustering result when the optimal number of clusters K is recorded is the first clustering result.

[0101] (4) Calculate the weighted dissimilarity matrix R between the data in the data set X, determine the outliers, select K cluster centers, and improve the k-means algorithm.

[0102] 41) Calculate the dissimilarity

[0103]

[0104] In the formula, x is Sample data of the i-th user at time s, x js represents the sample data of the jth user at the sth moment; r (s) ij represents the difference between the i-th user and the j-th user at time s; x rs are all values ​​of the load of all users at time s;

[0105] 42) Calculate sample data x i With x j The weighted dissimilarity between ij

[0106]

[0107] In the formula, w s is the weight at time s, w s Multiply the dissimilarity between user i and user j at time s to get the weighted dissimilarity between user i and user j at time s, where p represents 24 moments;

[0108] 43) Get the dissimilarity matrix

[0109]

[0110] 44) Calculate the dissimilarity parameter S for each data i And the average dissimilarity of the overall data mean.r

[0111]

[0112]

[0113] Where δ(z) is the defined function;

[0114] 45) Calculate the average value of the overall data dissimilarity parameter mean.S

[0115]

[0116] 46) Identify outliers and determine K cluster centers

[0117] S t <β*mean.S,

[0118] Among them, S t is the dissimilarity parameter of the abnormal data, β∈(0,1); if it satisfies the above formula, it is regarded as an outlier. Then the load data set X is divided into a normal data set U and an outlier data set V. The data point with the largest dissimilarity parameter S in the normal data set U is taken as the first initial clustering center. Then all data points whose dissimilarity with the data point is less than the average dissimilarity are deleted from U, and the remaining data points form a new data space U*. Then, step 41)-44) is performed. After calculation, the data point with the largest dissimilarity parameter S is found as the second initial clustering center. And so on, iterate until K clustering centers are found.

[0119] (5) Input the number of clusters K and the K initial cluster centers into the k-means algorithm and calculate the Euclidean distance between each data u in the data set U and the K cluster centers. The formula is as follows:

[0120]

[0121] u p represents the load data of the pth user in the dataset U, a i represents the K initial cluster centers selected in step (4), j represents different moments, and m represents 24 moments;

[0122] According to the principle of minimizing the distance within a class, each data is classified into the class closest to it, and then the new value of each cluster center is calculated. The formula is as follows:

[0123]

[0124] In the formula, a′ i represents the new cluster center, M p represents the pth cluster, |M p |Represents M p The number of data in the cluster, p = 1, 2, ... n, and then calculate the Euclidean distance between each data and the new cluster center, and divide the data into different classes until the cluster center no longer changes; until the cluster center no longer changes, finally output the clustering result.

[0125] (6) Determination of abnormal data.

[0126] The second clustering effect is compared with the first clustering effect. If the result is better than the first clustering, the data in V is determined to be the load data of abnormal users.

[0127] Example 2

[0128] like Figure 2 As shown, this embodiment provides an improved k-means abnormal load detection system, which includes:

[0129] Load data acquisition unit: acquires distribution network load data and obtains load data set;

[0130] Weight calculation unit: standardizes the load data set to remove the impact of dimension on clustering; and calculates the weights of different dimensions of the load data set;

[0131] K value determination unit: determines the number of clusters K using the elbow method, and records the clustering result when the optimal number of clusters K is reached as the first clustering result;

[0132] Initial cluster center acquisition unit: calculate the weighted dissimilarity between each data, and calculate the dissimilarity parameter, the average dissimilarity of the overall data, and the average dissimilarity parameter of the overall data, and remove outliers according to the dissimilarity parameter; find K initial cluster centers according to the principle that the dissimilarity parameter between the cluster center and other points is larger;

[0133] Clustering result output unit: input the number of clusters K and K initial cluster centers into the k-means algorithm, and output the clustering results using the k-means algorithm;

[0134] Abnormal data determination unit: used for abnormal data determination.

[0135] The specific contents of the load data acquisition unit are as follows: collect the daily load data of each user in the distribution network, assuming that there are n users, with one point every hour, that is, the daily load of 24 sampling points per day, as the load data set X; convert the load data set X into a matrix form, where the rows represent the daily load data of different users, and the columns represent the load at different times, and the data dimension is n×24.

[0136] In the weight calculation unit, the weight calculation process of different dimensions of the load data set (i.e., the load of the user at different times) is as follows:

[0137] 21) Calculate dimension weights

[0138]

[0139] P ij is the proportion of the attribute in the jth column of the i-th sample, x ij is the data sample of the i-th row and j-th column of the load data set X;

[0140] 22) Calculate information entropy

[0141]

[0142] E j is the information entropy of the j-th column attribute;

[0143] 23) Calculate weight

[0144]

[0145] w j is the weight of the attribute in the jth column (the weight of the load at time j), 0≤w j ≤1,m represents 24 moments.

[0146] The specific contents of the K value determination unit are as follows:

[0147] Assume that the load data set X is divided into K categories, and K ranges from 1 to For each K value, traditional k-means clustering is performed. First, k-means clustering randomly selects K data as random initial cluster centers c i , i = 1, ... K; then calculate the Euclidean distance from each data to each cluster center, the formula is as follows:

[0148]

[0149] x p represents the load data of the pth user, c i Represents the random initial cluster center, j represents different moments, and m represents 24 moments; according to the principle of minimizing the distance within the class, each data is classified into the class closest to it, and then the new value of each cluster center is calculated. The formula is as follows:

[0150]

[0151] Among them, c′ i represents the new cluster center, M p represents the pth cluster, |M p |Represents M p The number of data in the cluster, p = 1, 2, ... n, x represents the data in the pth cluster, until the cluster center no longer changes, and finally output the clustering result; the SSE formula is as follows:

[0152]

[0153] Finally, record the data of K and SSE and form a relationship diagram. Select K corresponding to the elbow as the optimal number of clusters. The clustering result when the optimal number of clusters K is recorded is the first clustering result.

[0154] The specific contents of the initial cluster center acquisition unit are as follows:

[0155] 41) Calculate the dissimilarity

[0156]

[0157] In the formula, x is Sample data of the i-th user at time s, x js represents the sample data of the jth user at the sth moment; r (s) ij represents the difference between the i-th user and the j-th user at time s; x rs are all values ​​of the load of all users at time s;

[0158] 42) Calculate sample data x i With x j The weighted dissimilarity between ij

[0159]

[0160] In the formula, w s is the weight at time s, w s Multiply the dissimilarity between user i and user j at time s to get the weighted dissimilarity between user i and user j at time s, where p represents 24 moments;

[0161] 43) Get the dissimilarity matrix

[0162]

[0163] 44) Calculate the dissimilarity parameter S for each data i And the average dissimilarity of the overall data mean.r

[0164]

[0165]

[0166] Where δ(z) is the defined function;

[0167] 45) Calculate the average value of the overall data dissimilarity parameter mean.S

[0168]

[0169] 46) Identify outliers and determine K cluster centers

[0170] S t <β*mean.S,

[0171] Among them, St is the dissimilarity parameter of the abnormal data, β∈(0,1); if it satisfies the above formula, it is regarded as an outlier. Then the load data set X is divided into a normal data set U and an outlier data set V. The data point with the largest dissimilarity parameter S in the normal data set U is taken as the first initial clustering center. Then all data points whose dissimilarity with the data point is less than the average dissimilarity are deleted from U, and the remaining data points form a new data space U*. Then, step 41)-44) is performed. After calculation, the data point with the largest dissimilarity parameter S is found as the second initial clustering center. And so on, iterate until K clustering centers are found.

[0172] The specific contents of the clustering result output unit are as follows:

[0173] Input the number of clusters K and the K initial cluster centers into the k-means algorithm, and calculate the Euclidean distance between each data in the data set U and the K cluster centers. The formula is as follows:

[0174]

[0175] u p represents the load data of the pth user in the dataset U, a i represents the K initial cluster centers selected in step (4), j represents different moments, and m represents 24 moments;

[0176] According to the principle of minimizing the distance within a class, each data is classified into the class closest to it, and then the new value of each cluster center is calculated. The formula is as follows:

[0177]

[0178] In the formula, a′ i represents the new cluster center, M p represents the pth cluster, |M p |Represents M p The number of data in the cluster, p = 1, 2, ... n, and then calculate the Euclidean distance between each data and the new cluster center, and divide the data into different classes until the cluster center no longer changes; until the cluster center no longer changes, finally output the clustering result.

[0179] The specific contents of the abnormal data determination unit are as follows:

[0180] The second clustering result is compared with the first clustering result. If the second clustering result is better than the first clustering result, the data in the outlier data set V is determined to be the load data of abnormal users.

[0181] The present invention uses specific examples to illustrate the principles and implementation methods of the present invention. The above examples are only used to help understand the method and core ideas of the present invention. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present invention, the present invention can also be improved and modified, and these improvements and modifications also fall within the scope of protection of the claims of the present invention.

Claims

1. An improved k-means abnormal load detection method, characterized in that: Includes steps: 1) Obtain distribution network load data and obtain a load data set; 2) Standardize the load data set to remove the impact of dimension on clustering; and calculate the weights of different dimensions of the load data set; 3) Use the elbow method to determine the number of clusters K, and record the clustering result when the optimal number of clusters K is obtained as the first clustering result; 4) Calculate the weighted dissimilarity between each data, and calculate the dissimilarity parameter, the average dissimilarity of the overall data, and the average dissimilarity parameter of the overall data, and remove outliers according to the dissimilarity parameter; According to the principle that the dissimilarity parameter between the cluster center and other points is large, find K initial cluster centers; 5) Input the number of clusters K and the K initial cluster centers into the k-means algorithm, and use the k-means algorithm to output the clustering results; 6) Abnormal data determination; In step 2), the weight calculation process of different dimensions of the load data set is as follows: 21) Calculate dimension weights P ij is the proportion of the attribute in the jth column of the i-th sample, x ij is the data sample of the i-th row and j-th column of the load data set X; 22) Calculate information entropy E j is the information entropy of the j-th column attribute; 23) Calculate weight w j is the weight of the attribute in the jth column, 0≤w j ≤1, m represents 24 moments; In step 2), the standardization process uses the following formula: In the formula, x ij is the data of the i-th row and j-th column of the load data set X, μ is the mean of the sample data of the i-th row, and σ is the standard deviation of the sample data of the i-th row; The specific contents of step 3) are as follows: Assume that the load data set X is divided into K categories, and K ranges from 1 to For each K value, k-means clustering is performed. The specific process of k-means clustering is as follows: First, k-means clustering randomly selects K data as random initial cluster centers c i , i = 1, ... K; then calculate the Euclidean distance from each data to each cluster center, the formula is as follows: x p represents the load data of the pth user, c i Represents the random initial cluster center, j represents different moments, and m represents 24 moments; according to the principle of minimizing the distance within the class, each data is classified into the class closest to it, and then the new value of each cluster center is calculated. The formula is as follows: Among them, c i ′ represents the new cluster center, M p represents the pth cluster, |M p |Represents M p The number of data in the cluster, p = 1, 2, ... n, x represents the data in the pth cluster, until the cluster center no longer changes, and finally output the clustering result; the SSE formula is as follows: Finally, record the data of K and SSE and form a relationship diagram. Select K corresponding to the elbow as the optimal number of clusters. The clustering result when the optimal number of clusters K is recorded is the first clustering result. The specific contents of step 4) are as follows: 41) Calculate the dissimilarity In the formula, x is Sample data of the i-th user at time s, x js represents the sample data of the jth user at the sth moment; r (s) ij represents the difference between the i-th user and the j-th user at time s; x rs are all values ​​of the load of all users at time s; 42) Calculate sample data x i With x j The weighted dissimilarity between ij In the formula, w s is the weight at time s, w s Multiply the dissimilarity between user i and user j at time s to get the weighted dissimilarity between user i and user j at time s, where p represents 24 moments; 43) Get the dissimilarity matrix 44) Calculate the dissimilarity parameter S for each data i And the average dissimilarity of the overall data mean.r Where δ(z) is the defined function; 45) Calculate the average value of the overall data dissimilarity parameter mean.S 46) Identify outliers and determine K cluster centers S t <β*mean.S, Among them, S t is the dissimilarity parameter of the abnormal data, β∈(0,1); if it satisfies the above formula, it is regarded as an outlier. Then the load data set X is divided into a normal data set U and an outlier data set V. The data point with the largest dissimilarity parameter S in the normal data set U is taken as the first initial clustering center. Then all data points whose dissimilarity with the data point is less than the average dissimilarity are deleted from U, and the remaining data points form a new data space U*. Then, step 41)-44) is performed. After calculation, the data point with the largest dissimilarity parameter S is found as the second initial clustering center. And so on, iterate until K clustering centers are found.

2. The improved k-means abnormal load detection method according to claim 1, characterized in that: The specific content of step 1) is: collect the daily load data of each user in the distribution network, assuming that there are n users, with one point every hour, that is, the daily load of 24 sampling points per day, as the load data set X; convert the load data set X into a matrix form, where the rows represent the daily load data of different users, the columns represent the load at different times, and the data dimension is n×24.

3. The improved k-means abnormal load detection method according to claim 1, characterized in that: The specific contents of step 5) are as follows: Input the number of clusters K and the K initial cluster centers into the k-means algorithm, and calculate the Euclidean distance between each data u in the data set U and the K cluster centers. The formula is as follows: u p represents the load data of the pth user in the dataset U, a i represents the K initial cluster centers selected in step 4), j represents different moments, and m represents 24 moments; According to the principle of minimizing the distance within a class, each data is classified into the class closest to it, and then the new value of each cluster center is calculated. The formula is as follows: In the formula, a i ′ represents the new cluster center, M p represents the pth cluster, |M p |Represents M p The number of data in the cluster, p = 1, 2, ... n, and then calculate the Euclidean distance between each data and the new cluster center, and divide the data into different classes until the cluster center no longer changes; until the cluster center no longer changes, finally output the clustering result.

4. The improved k-means abnormal load detection method according to claim 3, characterized in that: The specific contents of step 6) are as follows: The second clustering result is compared with the first clustering result. If the second clustering result is better than the first clustering result, the data in the outlier data set V is determined to be the load data of abnormal users.

5. An improved k-means abnormal load detection system, characterized in that: include: Load data acquisition unit: acquires distribution network load data and obtains load data set; Weight calculation unit: standardizes the load data set to remove the impact of dimension on clustering; And calculate the weights of different dimensions of the load data set; K value determination unit: determines the number of clusters K using the elbow method, and records the clustering result when the optimal number of clusters K is reached as the first clustering result; Initial cluster center acquisition unit: calculate the weighted dissimilarity between each data, and calculate the dissimilarity parameter, the average dissimilarity of the overall data, and the average dissimilarity parameter of the overall data, and remove outliers according to the dissimilarity parameter; According to the principle that the dissimilarity parameter between the cluster center and other points is large, find K initial cluster centers; Clustering result output unit: input the number of clusters K and K initial cluster centers into the k-means algorithm, and output the clustering results using the k-means algorithm; Abnormal data determination unit: used for abnormal data determination; In the weight calculation unit, the weight calculation process of different dimensions of the load data set is as follows: 21) Calculate dimension weights P ij is the proportion of the attribute in the jth column of the i-th sample, x ij is the data sample of the i-th row and j-th column of the load data set X; 22) Calculate information entropy E j is the information entropy of the j-th column attribute; 23) Calculate weight w j is the weight of the attribute in the jth column, 0≤w j ≤1, m represents 24 moments; The normalized processing load data set uses the following formula: In the formula, x ij is the data of the i-th row and j-th column of the load data set X, μ is the mean of the sample data of the i-th row, and σ is the standard deviation of the sample data of the i-th row; The specific content of the K value determination unit is as follows: Assume that the load data set X is divided into K categories, and K ranges from 1 to For each K value, traditional k-means clustering is performed. First, k-means clustering randomly selects K data as random initial cluster centers c i , i = 1, ... K; then calculate the Euclidean distance from each data to each cluster center, the formula is as follows: x p represents the load data of the pth user, c i Represents the random initial cluster center, j represents different moments, and m represents 24 moments; according to the principle of minimizing the distance within the class, each data is classified into the class closest to it, and then the new value of each cluster center is calculated. The formula is as follows: Among them, c i ′ represents the new cluster center, M p represents the pth cluster, |M p |Represents M p The number of data in the cluster, p = 1, 2, ... n, x represents the data in the pth cluster, until the cluster center no longer changes, and finally output the clustering result; the SSE formula is as follows: Finally, record the data of K and SSE and form a relationship diagram. Select K corresponding to the elbow as the optimal number of clusters. The clustering result when the optimal number of clusters K is recorded is the first clustering result. The specific contents of the initial cluster center acquisition unit are as follows: 41) Calculate the dissimilarity: In the formula, x is The data of the i-th user at time s, x js represents the data of the jth user at the sth moment; r (s) ij represents the difference between the i-th user and the j-th user at time s; x rs are all values ​​of the load of all users at time s; 42) Calculate sample x i With x j The weighted dissimilarity between ij In the formula, w s is the weight at time s, w s Multiply by the dissimilarity between user i and user j at time s to get the weighted dissimilarity between the loads of user i and user j at time s, where p represents 24 moments; 43) Get the dissimilarity matrix 44) Calculate the dissimilarity parameter S for each data i And the average dissimilarity of the overall data mean.r Where δ(z) is the defined function; 45) Calculate the average value of the overall data dissimilarity parameter mean.S 46) Identify outliers and determine K cluster centers S t <β*mean.S, Among them, S t is the dissimilarity parameter of the abnormal data, β∈(0,1); if it satisfies the above formula, it is regarded as an outlier. Then the load data set X is divided into a normal data set U and an outlier data set V. The data point with the largest dissimilarity parameter S in the normal data set U is taken as the first initial clustering center. Then all data points whose dissimilarity with the data point is less than the average dissimilarity are deleted from U, and the remaining data points form a new data space U*. Then, step 41)-44) is performed. After calculation, the data point with the largest dissimilarity parameter S is found as the second initial clustering center. And so on, iterate until K clustering centers are found.

Citation Information

Patent Citations

  • A clustering method based on near neighbor density and manifold distance

    CN109271427A

  • Improved K-means abnormal value detection method and device

    CN109978070A