User load clustering analysis method based on sparrow algorithm

By introducing the sparrow search algorithm and adaptive clustering mechanism into the K-means algorithm, the problems of poor clustering of large-scale power user load data and low processing efficiency in the existing technology are solved, and more accurate and efficient power user load clustering analysis is achieved.

CN119848581APending Publication Date: 2025-04-18JIANGXI HYDROPOWER ENG BUREAU
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411930947.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-26
Publication Date
2025-04-18

AI Technical Summary

Technical Problem

The existing K-means algorithms have problems in processing large-scale power user load data, are sensitive to initial clustering centers, are inefficient in processing, and lack of adaptability to load characteristics changes.

Method used

The user load clustering analysis method based on the sparrow algorithm is adopted, outliers are removed through data preprocessing, and the initial clustering center selection of the K-means algorithm is optimized using the improved sparrow search algorithm, and the clustering center and number are adjusted according to the changes in load characteristics through an adaptive clustering algorithm.

Benefits of technology

It improves the accuracy and efficiency of clustering results, reduces the impact of outliers on clustering results, can dynamically adapt to changes in load characteristics, and provides more accurate and efficient load clustering analysis for power users.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119848581A_ABST
    Figure CN119848581A_ABST
Patent Text Reader

Abstract

The invention discloses a user load clustering analysis method based on a sparrow algorithm, and relates to the technical field of regional power demand side management. The method comprises the steps that data preprocessing is conducted, abnormal value detection is conducted on load data through an isolation forest algorithm, and the processing process comprises data preparation, isolation forest algorithm training, abnormal score calculation and abnormal value recognition; adopting an improved sparrow search algorithm to select an initial clustering center, including determining an objective function, calculating an Euclidean distance, performing center optimization search, and performing iterative update optimization; carrying out improved K-means clustering analysis: preparing a clustering center, calculating a minimum Euclidean distance, updating the clustering center, and carrying out iterative updating optimization; and outputting a clustering result. According to the method, the initial clustering center selection of the K-means algorithm is optimized by adopting the sparrow search algorithm, the influence of abnormal values on the clustering result is reduced, the algorithm processing efficiency is improved, the clustering centers and the number can be adaptively adjusted according to the change of load characteristics, and a more accurate clustering result is provided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of regional power demand side management, and in particular to a user load clustering analysis method based on a sparrow algorithm. Background Art

[0002] Power user load clustering analysis is an important means of power system dispatch and demand-side management. Through in-depth analysis of power user load data, the regularity and similarity of user electricity consumption behavior can be revealed, thereby providing key information for the optimal operation and energy efficiency management of the power system. However, existing clustering analysis methods, especially the traditional K-means algorithm, face some significant shortcomings when processing large-scale power user load data sets:

[0003] (1) Poor clustering effect: The K-means algorithm is easily affected by outliers, resulting in inaccurate clustering results. In the power user load data, outliers may come from factors such as data collection errors and user behavior mutations. These outliers will have a negative impact on the clustering results.

[0004] (2) Sensitive to initial cluster centers: The performance of the K-means algorithm depends largely on the selection of initial cluster centers. If the initial centers are not selected properly, the algorithm may converge to a local optimal solution instead of a global optimal solution. This is particularly a problem for large-scale datasets, because the high dimensionality and complexity of the data increase the difficulty of finding a suitable initial center.

[0005] (3) Efficiency issues in processing large-scale data sets: With the advancement of power system monitoring technology, the amount of load data that can be obtained has increased dramatically. The traditional K-means algorithm is inefficient in processing these large-scale data sets and cannot meet the real-time or near real-time analysis requirements.

[0006] (4) Lack of adaptability to changes in load characteristics: The load of power users is affected by many factors, such as seasonal changes, weather conditions, economic activities, etc. These factors may cause the load characteristics to change over time. Traditional cluster analysis methods often lack adaptability to such dynamic changes and find it difficult to capture real-time changes in load characteristics.

[0007] In order to overcome the shortcomings of the above-mentioned existing technologies and improve the effect and efficiency of regional power user load clustering analysis, it is particularly necessary to develop a user load clustering analysis method based on the sparrow algorithm. Summary of the invention

[0008] In view of the deficiencies in the prior art, the purpose of the present invention is to provide a user load clustering analysis method based on the sparrow search algorithm, which adopts the sparrow search algorithm to optimize the initial clustering center selection of the K-means algorithm, reduce the influence of outliers on the clustering results, improve the efficiency of the algorithm in processing large-scale data sets, and can adaptively adjust the clustering center and number according to changes in load characteristics, provide more accurate clustering results, and be easy to promote and use.

[0009] In order to achieve the above object, the present invention is implemented through the following technical scheme: a user load clustering analysis method based on the sparrow algorithm, the steps of which are:

[0010] (1) Data preprocessing: The isolation forest algorithm is used to detect outliers in the load data and remove outliers in the data. The processing process is as follows:

[0011] 101. Data preparation;

[0012] 102. Isolation forest algorithm training: random selection of features, random selection of segmentation values, isolation process, path length calculation, isolation tree construction;

[0013] 103. Anomaly score calculation: Calculate an anomaly score for each data point, which reflects the probability that the data point is an outlier;

[0014] 104. Outlier identification: According to the threshold of the anomaly score, outliers are identified and the load data is smoothed to reduce the impact of noise;

[0015] (2) Optimization of initial clustering center: The improved sparrow search algorithm is used to select the initial clustering center. The process is as follows:

[0016] 201. Determine the objective function; 202. Calculate the Euclidean distance; 203. Center optimization search; 204. Iterate and update the optimization;

[0017] (3) Improved K-means clustering analysis:

[0018] 301. Cluster center preparation; 302. Calculate the minimum Euclidean distance; 303. Update cluster center; 304. Iterate update optimization;

[0019] (4) Output clustering results.

[0020] Preferably, the specific process of data preprocessing in step (1) is as follows:

[0021] 101. Data preparation: Load data set D = {X 1 , X 2 , …, X N}, X k Represents user load data pairs.

[0022] 102.Isolation Forest Algorithm Training:

[0023] ① Randomly select features: Data set D has F features, where F = {f 1 , f 2 , …, f F}; In each iteration, a feature f is randomly selected i , i = 1, 2, ..., F, select feature f i The probability of

[0024] ② Randomly select split value: For the selected feature f i , its value range is [f imin , f imax ], in each iteration, a split value s is randomly selected j , where s j ∈[f imin , f imax ].

[0025] ③Isolation process: Initialize all data points X k The length of the path to the root node is L(X k )=0, for each data point X k , if X k In the feature f i Value Less than or equal to the split value s j , then X k Isolate to the left subtree; otherwise, isolate to the right subtree; update data point X k The path length to the leaf node is L(X k ), if X k is isolated to the left subtree, then L(X k )=L(X k )+1; if X k is isolated to the right subtree, then L(X k )=L(X k )+1.

[0026] ④ Path length calculation: Path length L(X k ) represents the data point X k The cumulative effect of all split values ​​on the path to a leaf node. The longer the path length, the more likely the data point is to be considered an anomaly.

[0027] ⑤ Isolation tree construction: Repeat the above steps to construct multiple isolation trees T 1 , T 2 , …, T M, M≤N, each isolation tree is used to isolate data points and improve the accuracy of anomaly detection.

[0028] 103. Anomaly score calculation:

[0029] Anomaly score S(X k ) Definition: The isolation forest algorithm calculates an anomaly score for each data point, which reflects the probability that the data point is an outlier; the anomaly score YF(X k ) is calculated based on the average path length of the data point in all isolation trees:

[0030]

[0031] C(D)=2·(γ+log(|log 2 (len(D))-1|))

[0032] Where L(X k , T l ) represents the data point X k In the isolation tree T l is the path length, γ is the Euler-Mascheroni constant; data points with lower anomaly scores are considered normal values, while data points with higher anomaly scores are considered outliers.

[0033] 104. Outlier Identification:

[0034] According to the threshold of the abnormal score, the value is 0.8-1, the abnormal value is identified, and the load data is smoothed. The moving average method is used to process the smoothed load data set M≤N to reduce the impact of noise.

[0035] Preferably, the specific process of optimizing the initial cluster center in step (2) is as follows:

[0036] 201. Determine the objective function: In the power user load analysis, for the load data set after data processing and smoothing The fitness value is associated with the objective function of cluster analysis and is used to measure the performance of each sparrow position, i.e., each potential cluster center.

[0037] 202. Calculating Euclidean distance: Optimizing the objective function of the K-means algorithm Where C = {c 1 , c 2 , …, c w}, w is the number of clusters, c s is the cluster center, is the data point X k The square of the Euclidean distance to the cluster center C.

[0038] 203. Center Optimization Search: The improved sparrow algorithm searches for the optimal clustering center by iteratively updating the position of the sparrow The iterative formula is expressed as:

[0039]

[0040] Where t is the number of iterations, α∈[0.1, 1] controls the step size of the discoverer’s behavior, and β∈[0.1, 1] controls the step size of the follower and the guard’s behavior, both of which are learning factors; B(t) is the iteration step size, B(t) = B 0 ·r, B 0 is the initial value of the iteration, B 0 ∈[1, 10], r is the step size decreasing rate, r∈[0.9, 0.99], Rand() is a random function used to control the degree to which the sparrow individuals move to the optimal and worst individual positions, with a value range of 0-1. This randomness helps the algorithm to explore more widely in the search space, thereby improving the global search ability of the algorithm.

[0041] 204. Iterative update optimization; after each iteration, the objective function value of each sparrow individual is calculated Find the sparrow individual with the smallest objective function value and update it as the optimal sparrow individual in the current iteration Find the sparrow individual with the largest objective function value and update it to the worst sparrow individual in the current iteration and The initial value of the iteration is specified in C according to expert experience; when the difference in the change of the objective function value is less than the preset threshold ε, the iteration ends, otherwise it returns to step 203, where ε∈[10 -6 , 10 -4 ]. Through iterative updating, the optimal or approximately optimal initial cluster center C can be searched more accurately and effectively. * ,These centers can be used in the subsequent improved K-means clustering analysis to improve the accuracy of power user load clustering analysis.

[0042] Preferably, the specific process of the improved K-means clustering analysis in step (3) is as follows:

[0043] 301.Cluster center preparation: based on the optimal cluster center obtained Improved K-means was used for cluster analysis.

[0044] 302. Calculate the minimum Euclidean distance: Calculate the load data set D = {X 1 , X 2 , …, X N} to the cluster center The minimum distance, for each data set pair X k Belongs to cluster According to the formula to confirm.

[0045] 303. Update cluster center: Calculate the average value of all data sets in each cluster to get the new cluster center, and confirm it according to the following formula

[0046]

[0047] Where D' s Is a cluster A set of data sets.

[0048] 304. Iterative update optimization; if |d′ s+1 -d′ s |<δ, then the iteration stops, otherwise, return to step 303, δ∈[0, 10 -5 ].

[0049] The beneficial effects of the present invention are as follows: the present method introduces a data preprocessing step, uses a sparrow search algorithm to optimize the initial cluster center selection of the K-means algorithm, reduces the influence of outliers on the clustering results, utilizes parallel computing or distributed computing technology to improve the efficiency of the algorithm in processing large-scale data sets, and can adaptively adjust the cluster center and number according to changes in load characteristics through an adaptive clustering algorithm, thereby providing more accurate clustering results, and has broad application prospects. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] The present invention will be described in detail below with reference to the accompanying drawings and specific embodiments;

[0051] Figure 1 The sparrow algorithm flow chart of the present invention;

[0052] Figure 2 This is a flow chart of the K-Means clustering algorithm based on cluster center optimization in the present invention.

[0053] Figure 3 It is the algorithm flow chart of the present invention. DETAILED DESCRIPTION

[0054] In order to make the technical means, creative features, objectives and effects achieved by the present invention easy to understand, the present invention is further explained below in conjunction with specific implementation methods.

[0055] Reference Figure 1-3 This specific implementation adopts the following technical solution: a user load clustering analysis method based on the sparrow algorithm, the steps of which are:

[0056] (1) Data preprocessing: Statistical methods or machine learning techniques are used to detect and remove outliers in the data. The present invention uses the isolation forest algorithm to detect outliers in the load data. The specific processing process is as follows:

[0057] 101. Data preparation: Load data set D = {X 1 , X 2 , …, X N}, X k Represents user load data pairs.

[0058] 102.Isolation Forest Algorithm Training:

[0059] ① Randomly select features: Data set D has F features, where F = {f 1 , f 2 , …, f F}; In each iteration, a feature f is randomly selected i , i = 1, 2, ..., F, select feature f i The probability of

[0060] ② Randomly select split value: For the selected feature f i , its value range is [f imin , f imax ], in each iteration, a split value s is randomly selected j , where s j ∈[f imin , f imax ].

[0061] ③Isolation process: Initialize all data points X k The length of the path to the root node is L(X k )=0, for each data point X k , if X k In the feature f i Value Less than or equal to the split value s j , then X k Isolate to the left subtree; otherwise, isolate to the right subtree; update data point X k The path length to the leaf node is L(X k ), if X k is isolated to the left subtree, then L(X k )=L(X k )+1; if X k is isolated to the right subtree, then L(X k )=L(X k )+1.

[0062] ④ Path length calculation: Path length L(Xk ) represents the data point X k The cumulative effect of all split values ​​on the path to a leaf node. The longer the path length, the more likely the data point is to be considered an anomaly.

[0063] ⑤ Isolation tree construction: Repeat the above steps to construct multiple isolation trees T 1 , T 2 , …, T M , M≤N, each isolation tree is used to isolate data points and improve the accuracy of anomaly detection.

[0064] 103. Anomaly score calculation:

[0065] Anomaly score S(X k ) Definition: The isolation forest algorithm calculates an anomaly score for each data point, which reflects the probability that the data point is an outlier; the anomaly score YF(X k ) is calculated based on the average path length of the data point in all isolation trees:

[0066]

[0067] C(D)=2·(γ+log(|log 2 (len(D))-1|))

[0068] Where L(X k , T l ) represents the data point X k In the isolation tree T l is the path length, γ is the Euler-Mascheroni constant; data points with lower anomaly scores are considered normal values, while data points with higher anomaly scores are considered outliers.

[0069] 104. Outlier Identification:

[0070] According to the threshold of the anomaly score, the value is 0.8-1, and the outliers are identified. If the anomaly score threshold is set to 0.9, the data points with anomaly scores lower than 0.9 are considered normal values, and the data points with anomaly scores higher than 0.9 are considered outliers; the load data is smoothed, and the moving average method is used to process the smoothed load data set M≤N to reduce the impact of noise.

[0071] (2) Optimization of initial clustering center: The improved sparrow search algorithm is used to select the initial clustering center. The specific process is as follows:

[0072] 201. Determine the objective function: In the power user load analysis, for the load data set after data processing and smoothing The fitness value is associated with the objective function of cluster analysis and is used to measure the performance of each sparrow position, i.e., each potential cluster center.

[0073] 202. Calculating Euclidean distance: Optimizing the objective function of the K-means algorithm Where C = {c 1 , c 2 , …, c w}, w is the number of clusters, c s is the cluster center, is the data point X k The square of the Euclidean distance to the cluster center C.

[0074] 203. Center Optimization Search: The improved sparrow algorithm searches for the optimal clustering center by iteratively updating the position of the sparrow The iterative formula is expressed as:

[0075]

[0076] Where t is the number of iterations, α∈[0.1, 1] controls the step size of the discoverer’s behavior, and β∈[0.1, 1] controls the step size of the follower and the guard’s behavior, both of which are learning factors; B(t) is the iteration step size, B(t) = B 0 ·r, B 0 is the initial value of the iteration, B 0 ∈[1, 10], r is the step size decreasing rate, r∈[0.9, 0.99], Rand() is a random function used to control the degree to which the sparrow individuals move to the optimal and worst individual positions, with a value range of 0-1. This randomness helps the algorithm to explore more widely in the search space, thereby improving the global search ability of the algorithm.

[0077] 204. Iterative update optimization; after each iteration, the objective function value of each sparrow individual is calculated Find the sparrow individual with the smallest objective function value and update it as the optimal sparrow individual in the current iteration Find the sparrow individual with the largest objective function value and update it to the worst sparrow individual in the current iteration and The initial value of the iteration is specified in C according to expert experience; when the difference in the change of the objective function value is less than the preset threshold ε, the iteration ends, otherwise it returns to step 203, where ε∈[10 -6 , 10 -4 ]. Through iterative updating, the optimal or approximately optimal initial cluster center C can be searched more accurately and effectively. *,These centers can be used in the subsequent improved K-means clustering analysis to improve the accuracy of power user load clustering analysis.

[0078] (3) Improved K-means clustering analysis:

[0079] 301.Cluster center preparation: based on the optimal cluster center obtained Improved K-means was used for cluster analysis.

[0080] 302. Calculate the minimum Euclidean distance: Calculate the load data set D = {X 1 , X 2 , …, X N} to the cluster center The minimum distance, for each data set pair X k Belongs to cluster According to the formula to confirm.

[0081] 303. Update cluster center: Calculate the average value of all data sets in each cluster to get the new cluster center, and confirm it according to the following formula

[0082]

[0083] Where D's are clusters A set of data sets.

[0084] 304. Iterative update optimization; if |d′ s+1 -d′ s |<δ, then the iteration stops, otherwise, return to step 303, δ∈[0, 10 -5 ].

[0085] (4) Output clustering results.

[0086] This specific implementation method can provide more accurate clustering results, reduce the impact of outliers on clustering results, improve computing efficiency, better adapt to changes in load characteristics, and provide strong support for power system scheduling and demand-side management by combining the improved sparrow algorithm with K-means clustering in power user load analysis; at the same time, through accurate analysis of user loads, more personalized services can be provided, such as customized power usage suggestions and improved user satisfaction. The improved sparrow algorithm combined with K-means clustering is applied in power user load analysis, and the technical advantages are:

[0087] ⅰ. Optimize the initial cluster center: The improved sparrow algorithm can effectively search for the optimal or nearly optimal initial cluster center by simulating the foraging and anti-predation behaviors of sparrows, making up for the deficiency of the traditional K-means algorithm that is very sensitive to the selection of the initial cluster center. It can provide a better initial center and thus improve the clustering effect.

[0088] ⅱ. Dynamically adapt to changes in load characteristics: Combined with K-means clustering, the improved sparrow algorithm can dynamically adapt to changes in load characteristics and find the best clustering center through iterative updates, which makes up for the deficiency that the traditional K-means algorithm may not be able to obtain the best clustering effect when processing dynamically changing load data.

[0089] ⅲ. Adaptive adjustment of cluster centers and numbers: Combined with the adaptive clustering algorithm, the improved sparrow algorithm can dynamically adjust the cluster centers and the number of clusters according to changes in load characteristics, making up for the deficiency of the traditional K-means algorithm that cannot automatically adapt to changes in data distribution, and can better adapt to data characteristics.

[0090] ⅳ. Improve the accuracy and efficiency of clustering analysis: The improved sparrow algorithm combined with K-means clustering makes up for the shortcomings of the traditional K-means algorithm in processing complex data sets, such as poor clustering effect and low processing efficiency, and can improve the accuracy and efficiency of power user load clustering analysis.

[0091] In summary, the application of the improved sparrow algorithm combined with K-means clustering in power user load analysis in this specific implementation method has important practical significance for improving the operating efficiency of the power system, optimizing resource allocation, supporting the development of smart grids, and improving user service quality.

[0092] Example 1: The above algorithm flow is described in combination with this example. Consider a set of power user load data, including the user's power consumption, power consumption time, power consumption type, power consumption time period, weather conditions, economic activity level and power consumption equipment type. This data set can be expressed as: D = {x 1 ,y 1 , t 1 , w 1 , e 1 , d 1}, where x i is the user's electricity consumption (kWh), y i is the electricity usage time (hours), t i is the type of electricity used (such as commercial electricity, residential electricity, industrial electricity, etc.), w i is the electricity consumption period (such as daytime and night), e i is the weather conditions on the day of electricity consumption (such as temperature, humidity, rainfall, etc.),i It is the type of electrical equipment (such as air conditioners, water heaters, televisions, etc.).

[0093] Without loss of generality, the following is an example of load data of 8 users, and the technical implementation advantages of the present invention are respectively explained by the traditional K-mean algorithm and the algorithm of the present invention: D = {(500, 4, residents, night, sunny, air conditioning), (300, 2, residents, daytime, cloudy, TV), (200, 3, business, daytime, rainy day, computer), (100, 1, industry, daytime, snowy day, machine), (400, 3, residents, night, sunny day, air conditioning), (250, 2, business, daytime, cloudy, TV), (350, 2.5, industry, daytime, rainy day, computer), (150, 1.5, industry, night, snowy day, machine)};

[0094] "Residential", "Industrial" and "Commercial" can be regarded as three points on the electricity type dimension, and their distance is the absolute difference between them on the electricity type dimension. However, since "residential", "industrial" and "commercial" are categorical variables rather than numerical variables, the numerical difference between them cannot be directly calculated. Therefore, a method is needed to convert the categorical variables into numerical values. This embodiment uses the one-hot encoding method for attribute encoding definition, as follows:

[0095] One-hot encoding creates a binary column for each category, where the column value for that category is 1 and the other column values ​​are 0. Here are the one-hot encodings for the three electricity usage categories:

[0096] The binary vector of "resident" is [1, 0, 0]

[0097] The binary vector for "Business" is [0, 1, 0]

[0098] The binary vector for "industry" is [0, 0, 1]

[0099] Similarly, the unique hot encoding of weather:

[0100] The binary vector for "sunny day" is [1, 0, 0]

[0101] The binary vector for "rainy day" is [0, 1, 0]

[0102] The binary vector for "cloudy" is [0, 0, 1]

[0103] One-hot encoding of device type:

[0104] Conditioning: [1, 0, 0, 0]

[0105] TV: [0, 1, 0, 0]

[0106] Computer: [0, 0, 1, 0]

[0107] Machine: [0, 0, 0, 1]

[0108] One-hot encoding of time:

[0109] Daytime: [1, 0]

[0110] Night: [0, 1]

[0111] The following is the data mapping after one-hot encoding:

[0112] X 1 =(500, 4, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0) → Residents, evening, sunny, air-conditioning

[0113] X 2 =(300, 2, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0) → Resident, Daytime, Cloudy, TV

[0114] X 3 =(200,3,0,1,0,0,1,0,0,0,0,1,0)→Business, Daytime, Rainy Day, Computer

[0115] X 4 =(100, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) → Industry, Daytime, Snow, Machine

[0116] X 5 =(400, 3, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0) → Residents, evening, sunny, air-conditioning

[0117] X 6 =(250, 2, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0) → Commercial, Daytime, Cloudy, TV

[0118] X 7 =(350, 2.5, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0) → Industry, Daytime, Rainy Day, Computer

[0119] X 8 =(150, 1.5, 0, 0, 0, 0, 1, 0, 0, 0, 1) → industry, night, snow, machine

[0120] A performs cluster analysis on the above data based on traditional clustering algorithms:

[0121] The initial centroid C1 = (500, 4, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0); defined as a high energy consumption user, C2 = (300, 2, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0); defined as an energy-saving user;

[0122] In the first iteration, data points are assigned to clusters.

[0123] The new centroid is: C1_new = (450, 3.5, 0.8, 0.2, 0.9, 0.1, 0, 0, 0, 0.8, 0.2, 0, 0) C2_new = (325, 2.25, 0.75, 0.75, 0.25, 0.75, 0, 0, 0, 0.25, 0.75, 0, 0);

[0124] Calculate the distance between the new and old centroids: distance_C1 = sqrt((450-500)^2+(3.5-4)^2+…+(0-0)^2)=50.0025; distance_C2 = sqrt((325-300)^2+(2.25-2)^2+…+(0-0)^2)=25.0012; distance_C1 and distance_C2 are both greater than 0.0001, and the iteration continues.

[0125] In the second iteration, use C1_new and C2_new as the new centroids and repeat the steps of assigning data points and calculating new centroids.

[0126] The new centroid is: C1_new_2 = (440, 3.3, 0.9, 0.1, 0.95, 0.05, 0, 0, 0, 0.85, 0.15, 0, 0); C2_new_2 = (330, 2.4, 0.8, 0.8, 0.2, 0.8, 0, 0, 0, 0.2, 0.8, 0, 0);

[0127] Calculate the distance between the new and old centroids: distance_C1_2 = sqrt((440-450)^2+(3.3-3.5)^2+…+(0-0)^2) = 10.0020;

[0128] distance_C2_2=sqrt((330-325)^2+(2.4-2.25)^2+…+(0-0)^2)=5.0022;

[0129] Both distance_C1_2 and distance_C2_2 are greater than 0.00001, so continue iterating.

[0130] Continue the above clustering process. The iterative convergence condition is that the distance between two adjacent data points and the cluster center is less than 0.0001. The algorithm converges after 204 iterations, and the cluster center is as follows:

[0131] C1_new_204=[300, 2, 0.75, 0.5, 0.5, 0.5, 0, 0, 0, 0.5, 0.5, 0, 0];

[0132] C2_new_204=[350, 2.5, 0, 0.75, 0, 0, 0.5, 0.5, 0, 0, 0, 0.5, 0.5];

[0133] According to the K-mean clustering algorithm, cluster assignment is performed and the Euclidean distance calculation results are as follows:

[0134] The first data point: the distance to C1 is 1.14564392, the distance to C2 is 2.13600094, so user 1 belongs to C1_new_204;

[0135] The second data point: the distance to C1 is 1.14564392, the distance to C2 is 2.01556444, so user 2 belongs to C1_new_204;

[0136] The third data point: the distance to C1 is 1.95256242, and the distance to C2 is 1.03077641, so user 3 belongs to C2_new_204;

[0137] The fourth data point: the distance to C1 is 1.95256242, and the distance to C2 is 1.03077641, so user 4 belongs to C2_new_204;

[0138] The fifth data point: the distance to C1 is 1.14564392, and the distance to C2 is 2.13600094, so user 5 belongs to C1_new_204;

[0139] The sixth data point: The distance to C1 is 1.3462912, and the distance to C2 is 1.75, so user 6 belongs to C1_new_204;

[0140] The seventh data point: the distance to C1 is 1.95256242, the distance to C2 is 1.03077641, so user 7 belongs to C2_new_204;

[0141] The eighth data point: distance to C1 is 1.95256242, distance to C2 is 1.25, so user 8 belongs to C2_new_204.

[0142] In summary, the subset of C1_new_204 belonging to high energy consumption users includes {user 1, user 2, user 5, user 6}, and the subset of C2_new_204 belonging to energy-saving users includes {user 3, user 4, user 7, user 8}.

[0143] From the above classification, it can be seen that the iteration converges slowly, the user classification is relatively average, and the classification accuracy is relatively poor. The classification of user 7 and user 6 is likely to fall into the local optimum.

[0144] B. The cluster center optimization process of the improved sparrow algorithm of the present invention is performed based on the same load data:

[0145] X 1 =(500, 4, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0) → Residents, evening, sunny, air-conditioning

[0146] X 2 =(300, 2, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0) → Resident, Daytime, Cloudy, TV

[0147] X 3 =(200,3,0,1,0,0,1,0,0,0,0,1,0)→Business, Daytime, Rainy Day, Computer

[0148] X 4 =(100, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) → Industry, Daytime, Snow, Machine

[0149] X 5 =(400, 3, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0) → Residents, evening, sunny, air-conditioning

[0150] X 6 =(250, 2, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0) → Commercial, Daytime, Cloudy, TV

[0151] X 7 =(350, 2.5, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0) → Industry, Daytime, Rainy Day, Computer

[0152] X 8 =(150, 1.5, 0, 0, 0, 0, 1, 0, 0, 0, 1) → industry, night, snow, machine

[0153] (1) Data preprocessing: Use isolation forest to detect outliers in load data:

[0154] 101. Data preparation: Load data set D = {X 1 , X 2 , …, X 8}.

[0155] 102. Isolation Forest Algorithm Training: Constructing Isolation Tree T 1 ,

[0156] ① Randomly select features: select F = 3 features from the dataset D, where F = x 1 ,y 1 , t1}, in each iteration, a feature f is randomly selected 1 =x 1 , select feature f 1 The probability of

[0157] ② Randomly select split value: For the selected feature f 1 , randomly select an initial split value s 1 =250.

[0158] ③Isolation process: Initialize all data points X k The length of the path to the root node is L(X k )=0, for each data point X k , if X k In the feature f i Value Less than or equal to the split value s j , then X k Isolate to the left subtree; otherwise, isolate to the right subtree; update data point X k The path length to the leaf node is L(X k ), if X k is isolated to the left subtree, then L(X k )=L(X k )+1; if X k is isolated to the right subtree, then L(X k )=L(X k )+1.

[0159] ④ Path length calculation: Path length L(X k ) represents the data point X k The cumulative effect of all split values ​​on the path to the leaf node. The longer the path length, the more likely the data point is considered an anomaly. Specifically:

[0160] Split the data points. For the left subset L, which contains data points with power consumption less than or equal to 250: L = {(x, y, z)∈D|x≤250}, the calculation process is as follows:

[0161] (500, 4, 1, 0, 0, 0) → not included, because 500>250

[0162] (300, 2, 0, 1, 0, 0) → not included, because 300>250

[0163] (200, 3, 0, 0, 1, 0) → included, because 200 ≤ 250

[0164] (100, 1, 0, 0, 0, 1) → included, because 100 ≤ 250

[0165] (400, 3, 1, 0, 0, 0) → not included, because 400>250

[0166] (250, 2, 0, 1, 0, 0) → included, because 250 = 250

[0167] (350, 2.5, 0, 0, 1, 0) → not included, because 350>250

[0168] (150, 1.5, 0, 0, 0, 1) → included, because 150 ≤ 250

[0169] Therefore, the left subset L is: L = [(200, 3, 0, 0, 1, 0), (100, 1, 0, 0, 0, 1), (250, 2, 0, 1, 0, 0), (150, 1.5, 0, 0, 0, 1)].

[0170] For the right subset R, which contains data points with power consumption greater than 250: R = {(x, y, z)∈D|x>250}, the calculation process is as follows:

[0171] (500, 4, 1, 0, 0, 0) → included, because 500>250

[0172] (300, 2, 0, 1, 0, 0) → included, because 300>250

[0173] (200, 3, 0, 0, 1, 0) → not included, because 200≤250

[0174] (100, 1, 0, 0, 0, 1) → not included, because 100 ≤ 250

[0175] (400, 3, 1, 0, 0, 0) → included, because 400>250

[0176] (250, 2, 0, 1, 0, 0) → not included, because 250=250

[0177] (350, 2.5, 0, 0, 1, 0) → included, because 350>250

[0178] (150, 1.5, 0, 0, 0, 1) → not included, because 150 ≤ 250

[0179] Therefore, the right subset R is: R = [(500, 4, 1, 0, 0, 0), (300, 2, 0, 1, 0, 0), (400, 3, 1, 0, 0, 0), (350, 2.5, 0, 0, 1, 0)].

[0180] In summary, we can get: left subset L (power consumption ≤ 250), L = {(x, y, z) ∈ D | x ≤ 250} L = [(200, 3, 0, 0, 1, 0), #power consumption 200 (100, 1, 0, 0, 0, 1), #power consumption 100 (250, 2, 0, 1, 0, 0), #power consumption 250 (150, 1.5, 0, 0, 0, 1) #power consumption 15 0]; right subset R (power consumption > 250), R = {(x, y, z)∈D|x>250}R = [(500, 4, 1, 0, 0, 0), #power consumption 500 (300, 2, 0, 1, 0, 0), #power consumption 300 (400, 3, 1, 0, 0, 0), #power consumption 400 (350, 2.5, 0, 0, 1, 0) #power consumption 350].

[0181] ⑤ Isolation tree construction: Repeat the above steps. When the length of the left and right subsets is less than 1, stop the iteration, and repeat this process to construct other isolation trees T. 2 , T 3 Each isolation tree is used to isolate data points, thereby improving the accuracy of anomaly detection.

[0182] 103. Anomaly score calculation: Anomaly score S(X k )Definition: The Isolation Forest algorithm calculates an anomaly score for each data point, which reflects the probability that the data point is an outlier. Anomaly score YF(X k ) is calculated based on the average path length of a data point in all isolation trees.

[0183]

[0184] C(D)=2·(γ+log(|log 2 (len(D))-1|))

[0185] Where L(X k , T l ) represents the data point X k In the isolation tree T l , γ is the Euler-Mascheroni constant, data points with lower anomaly scores are considered normal values, and data points with higher anomaly scores are considered outliers. The outliers of the embodiment of the present invention calculated according to the above principle are as follows:

[0186] Anomaly score for the first point: 1.0

[0187] Anomaly score for the second point: 0.4162

[0188] Anomaly score for the third point: 0.1732

[0189] Anomaly score for the fourth point: 0.0721

[0190] Anomaly score for the fifth point: 0.0300

[0191] Anomaly score for the sixth point: 0.0125

[0192] Anomaly score for the seventh point: 0.0052

[0193] Anomaly score for the eighth point: 0.0022.

[0194] 104. Outlier identification: Identify outliers based on the threshold of the anomaly score, that is, the first point is an outlier, remove the point and smooth the new load data to reduce the impact of noise. This embodiment uses the moving average method to obtain the load data set after data processing and smoothing. The data set after moving average is as follows: p = 3, the sliding average order.

[0195]

[0196] (2) Optimization of initial clustering centers: for the new data set D p An improved sparrow search algorithm is used to select the initial cluster centers.

[0197] 201. In the sparrow search algorithm, the fitness value is used to evaluate the quality of each individual sparrow. In the load analysis of power users, for the load data set D after data processing and smoothing, p The fitness value is usually associated with the objective function of cluster analysis and is used to measure the performance of each sparrow position.

[0198] 202.Objective function for optimizing K-means algorithm Where C = {c 1 , c 2 , …, c w}, w is the number of clusters, c s is the cluster center, is the data point The square of the Euclidean distance to the cluster center C.

[0199] In this embodiment, the number of clusters is selected based on business needs and the initial value is identified and confirmed according to the power consumption: the initial high energy consumption user c 1 ={400.000, 3.000, 1.000, 0.500, 0.500, 0.500, 0.000, 0.0, 0.0, 0.500, 0.500, 0.000, 0.000} and the initial energy-saving user c 2={200.000, 2.000, 0.333, 1.000, 0.000, 0.333, 0.333, 0.0, 0.0, 0.000, 0.333, 0.333, 0.333}. Based on the number of classifications w=2, the square of the Euclidean distance of each cluster center is calculated as follows:

[0200] With c 1 The square of the Euclidean distance is 4444.961335; With c 2 The square of the Euclidean distance is 17779.244001

[0201] With c 1 The square of the Euclidean distance is 40002.583334; With c 2 The square of the Euclidean distance is 0.0

[0202] With c 1 The square of the Euclidean distance is 27779.694668; With c 2 The square of the Euclidean distance is 1111.75489

[0203] With c 1 The square of the Euclidean distance is 22502.02789; With c 2 The square of the Euclidean distance is 2500.555112

[0204] With c 1 The square of the Euclidean distance is 4445.433779; With c 2 The square of the Euclidean distance is 17778.494001

[0205] With c 1 The square of the Euclidean distance is 22502.916001; With c 2 The square of the Euclidean distance is 2500.222445

[0206] With c 1 The square of the Euclidean distance is 22503.75 With c 2 The square of the Euclidean distance is 2500.666334.

[0207] According to the objective function It can be obtained that F(C)=8890.395+8613.1988=17503.593917503.5939.

[0208] 203.The improved sparrow algorithm searches for the optimal clustering center by iteratively updating the position of the sparrow The iteration formula can be expressed as Where t is the number of iterations, the maximum value of which is 100. α∈[0.1, 1] controls the step size of the behavior of the discoverer, and α=0.1 is selected. β∈[0.1, 1] controls the step size of the behavior of the follower and the vigilant, and β=0.55 is selected. Both are learning factors. B(t) is the iteration step size, and B(t)=B 0 ·r·t, B 0 is the initial value of the iteration, B 0 ∈[1, 10], select B 0 =5.5, r is the step size decreasing rate, r∈[0.9, 0.99], r=0.95 is selected, Rand() is a random function, which is used to control the degree to which the sparrow individual moves to the optimal and worst individual positions. This randomness helps the algorithm to conduct a wider exploration in the search space and adapt to the changes in dynamic loads, thereby improving the global search ability of the algorithm. The value range is 0-1. When the difference SSE of the change in the objective function value is less than the preset threshold ε, the iteration ends, where ε∈[10 -6 , 10 -4 ], in this embodiment, the value ε=10 -4 .

[0209]

[0210] The calculation example of some search iteration process is as follows:

[0211] c1(1,t+1)=c1(1,t)+0.1\times 0.95^t\times(c1(1,t)-c(t)(1))+0.55\times\text{rand()}\times(c1(1,t)-c(t+1)(1) )c1(1,t+1)=c1(1,t)+0.1×0.95t×(c1(1,t)-c(t)(1))+0.55×rand()×(c1(1,t)-c(t+1)(1))

[0212] c1(1,t+1)=395.0+0.1\times 0.95\times(395.0-395.0)+0.55\times 0.3\times(395.0-205.0)c1(1,t+1)=395.0+0.1×0.95×(395.0-395.0)+0.55×0.3×(395.0-205.0)

[0213] c1(1,t+1)=395.0+0+0.55\times 0.3\times 190.0c1(1,t+1)=395.0+0+0.55×0.3×190.0

[0214] c1(1,t+1)=395.0+32.65c1(1,t+1)=395.0+32.65

[0215] c1(1,t+1)≈427.65c1(1,t+1)≈427.65

[0216] c1(2,t+1)=c1(2,t)+0.1\times 0.95^t\times(c1(2,t)-c(t)(2))+0.55\times\text{rand()}\times(c1(2,t)-c(t+1)(2))c1(2,t+1)=c1(2,t)+0.1×0.95t×(c1(2,t)-c(t)(2))+0.55×rand()×(c1(2,t)-c(t+1)(2))

[0217] c1(2,t+1)=3.1+0.1\times 0.95\times(3.1-3.1)+0.55\times 0.3\times(3.1-2.1)c1(2,t+1)=3.1+0.1×0.95×(3.1-3.1)+0.55×0.3×(3.1-2.1)

[0218] c1(2,t+1)=3.1+0+0.55\times 0.3\times 1.0c1(2,t+1)=3.1+0+0.55×0.3×1.0

[0219] c1(2,t+1)=3.1+0.165c1(2,t+1)=3.1+0.165

[0220] c1(2,t+1)≈3.265c1(2,t+1)≈3.265

[0221] c2(1,t+1)=c2(1,t)+0.1\times 0.95^t\times(c2(1,t)-c(t)(1))+0.55\times\text{rand()}\times(c2(1,t)-c(t+1)(1) )c2(1,t+1)=c2(1,t)+0.1×0.95t×(c2(1,t)-c(t)(1))+0.55×rand()×(c2(1,t)-c(t+1)(1))

[0222] c2(1,t+1)=205.0+0.1\times 0.95\times(205.0-395.0)+0.55\times 0.3\times(205.0-205.0)c2(1,t+1)=205.0+0.1×0.95×(205.0-395.0)+0.55×0.3×(205.0-205.0)

[0223] c2(1,t+1)=205.0-0.1\times 0.95\times 190.0+0c2(1,t+1)=205.0-0.1×0.95×190.0+0

[0224] c2(1,t+1)=205.0-18.05c2(1,t+1)=205.0-18.05

[0225] c2(1,t+1)≈186.95c2(1,t+1)≈186.95

[0226] The iterative calculation is repeated in this way until step 204 is reached.

[0227] 204. After each iteration, the objective function value F(C) of each sparrow individual is calculated, and the sparrow individual with the smallest objective function value is found and updated as the optimal sparrow individual in the current iteration. Find the sparrow individual with the largest objective function value and update it to the worst sparrow individual in the current iteration and Initial value for iteration and

[0228] When the difference in the objective function value |F(C) t+1 -F(C) t | is less than the preset threshold ε, the iteration ends, otherwise it returns to step 203, where ε∈[10 -6 , 10 -4 ], in this embodiment, the value ε=10 -4 .

[0229] The iteration process is as follows:

[0230] In the first iteration, the SSE of each sparrow (the sum of the squared distances from each data point to the center of its cluster) is calculated to obtain the SSE list.

[0231] The SSE for the first iteration is 17503.5939. Find the optimal position and worst position Update sparrow position.

[0232]

[0233] Iteration 2: The SSE for iteration 2 is 17490.1234.

[0234] Since |17503.5939-17490.1234|=13.4705>0.0001, continue to iterate and update the sparrow position.

[0235]

[0236] Iteration 3: The SSE for iteration 3 is 17485.2345.

[0237] Since |17490.1234-17485.2345|=4.8889>0.0001, the iteration continues.

[0238] This process will continue until the stop condition is met. The following table 1 is the iterative process:

[0239] Table 1 Iteration process

[0240]

[0241]

[0242] After 98 iterations, the optimal cluster center data set is obtained as follows: Through iterative updates, the optimal or approximately optimal initial clustering center can be searched more accurately and effectively. These centers can be used in the subsequent improved K-means clustering analysis to improve the accuracy of power user load clustering analysis.

[0243] (3) Improved K-means clustering analysis:

[0244] 301. Based on the optimal cluster center obtained The improved K-means algorithm was used for cluster analysis.

[0245] 302. Calculate D = {X2 , X 2 , …, X 8} to the cluster center C*, for each data set pair X K Belongs to cluster Confirm using the following formula: Data point assignment process:

[0246] X 2 arrive The distance is about 92.01, to The distance is about 95.01 and is assigned to c1.

[0247] X 3 arrive The distance is about 195.01, to The distance is about 5.21 and is assigned to c2.

[0248] X 4 arrive The distance to The distance is about 105.02 and is assigned to c2.

[0249] X 5 arrive The distance is about 5.13, to The distance is about 195.01 and is assigned to c1.

[0250] X 6 arrive The distance is about 145.01, to The distance is about 45.01 and is assigned to c1.

[0251] X 7 arrive The distance is about 45.04, to The distance is about 145.01. It is assigned to c1.

[0252] X 8 arrive The distance to The distance is about 55.03. It is assigned to c2.

[0253] Get the set D' assigned to c1 1 ={X 2 , X 5 , X 6 , X 7}, assigned to the set D' of c2 2 ={X 3 , X 4, X 8 .

[0254] 303. Update cluster center Calculate the average of all pairs of data sets in each cluster to obtain the new cluster center, which is confirmed by the following formula:

[0255]

[0256] Where D' s Is a cluster The specific calculation results are as follows:

[0257]

[0258] 304. If |d′ s+1 -d′ s |<δ, then stop the iteration, otherwise return to 208, δ∈[0, 10 -5 ], δ = 0.0001. The distribution result after 1 iteration is:

[0259] X 2 arrive The distance is 1.16, to The distance is 1.70, so it is assigned to

[0260] X 5 arrive The distance to The distance is 100.01, so it is assigned to

[0261] X 6 arrive The distance to The distance is 150.01, so it is assigned to

[0262] X 7 arrive The distance to The distance is 50.03, so it is assigned to

[0263] X 3 arrive The distance to The distance is 100.00, so it is assigned to

[0264] X 4 arrive The distance is 1.47 to The distance is 0.82, so it is assigned to

[0265] X 8 arrive The distance to The distance is 100.00, so it is assigned to

[0266] Update the new cluster center:

[0267] because When the iteration termination condition is met, clustering ends.

[0268] The final clustering results are as follows: Clustering of high energy consumption users Energy-saving user clustering Pay special attention to users with abnormal energy consumption 1}.

[0269] It can be seen that according to the new cluster center, the iteration is repeated. The embodiment converges after one iteration, which indicates that the initial cluster center is close enough to the final clustering result, so that the algorithm converges after the first iteration, which also shows that the optimization ability of the sparrow algorithm of the present invention and the accuracy of clustering make up for the shortcomings of the single K-means clustering algorithm. No matter the convergence speed, classification accuracy and refinement, it is more efficient and of higher quality than the traditional clustering.

[0270] The above shows and describes the basic principles and main features of the present invention and the advantages of the present invention. It should be understood by those skilled in the art that the present invention is not limited to the above embodiments. The above embodiments and descriptions are only for explaining the principles of the present invention. Without departing from the spirit and scope of the present invention, the present invention may have various changes and improvements, which fall within the scope of the present invention to be protected. The scope of protection of the present invention is defined by the attached claims and their equivalents.

Claims

1. A user load clustering analysis method based on the sparrow algorithm, characterized in that: The steps are: (1) Data preprocessing: The isolation forest algorithm is used to detect outliers in the load data and remove outliers in the data. The processing process is as follows:

101. Data preparation; 102. Isolation forest algorithm training: random selection of features, random selection of segmentation values, isolation process, path length calculation, isolation tree construction; 103. Anomaly score calculation: Calculate an anomaly score for each data point, which reflects the probability that the data point is an outlier; 104. Outlier identification: According to the threshold of the anomaly score, outliers are identified and the load data is smoothed to reduce the impact of noise; (2) Optimization of initial clustering center: The improved sparrow search algorithm is used to select the initial clustering center. The process is as follows:

201. Determine the objective function; 202. Calculate Euclidean distance; 203. Center optimization search; 204. Iterative update optimization; (3) Improved K-means clustering analysis:

301. Cluster center preparation; 302. Calculate the minimum Euclidean distance; 303. Update cluster center; 304. Iterative update optimization; (4) Output clustering results.

2. The user load clustering analysis method based on the sparrow algorithm according to claim 1 is characterized in that: The specific process of the data preprocessing in step (1) is as follows:

101. Data preparation: Load data set D = {X1, X2, ..., X N }, X k Represents user load data pair; 102.Isolation Forest Algorithm Training: ① Randomly select features: Data set D has F features, where F = {f1, f2, ..., f F }; In each iteration, a feature f is randomly selected i , i = 1, 2, ..., F, select feature f i The probability of ② Randomly select split value: For the selected feature f i , its value range is [f imin , f imax ], in each iteration, a split value s is randomly selected j , where s j ∈[f imin , f imax ]; ③Isolation process: Initialize all data points X k The length of the path to the root node is L(X k )=0, for each data point X k , if X k In the feature f i Value Less than or equal to the split value s j , then X k Isolate to the left subtree; otherwise, isolate to the right subtree; update data point X k The path length to the leaf node is L(X k ), if X k is isolated to the left subtree, then L(X k )=L(X k )+1; if X k is isolated to the right subtree, then L(X k )=L(X k )+1; ④ Path length calculation: Path length L(X k ) represents the data point X k The cumulative impact of all split values ​​on the path to the leaf node; ⑤ Isolation tree construction: Repeat the above steps to construct multiple isolation trees T1, T2, ..., T M , M≤N, each isolation tree is used to isolate data points and improve the accuracy of anomaly detection; 103. Anomaly score calculation: Anomaly score S(X k ) Definition: The isolation forest algorithm calculates an anomaly score for each data point, which reflects the probability that the data point is an outlier; the anomaly score YF(X k ) is calculated based on the average path length of the data point in all isolation trees: C(D)=2·(γ+log(|log2(len(D))-1|)) Where L(X k , T l ) represents the data point X k In the isolation tree T l The path length is , and γ is the Euler-Mascheroni constant; data points with lower anomaly scores are considered normal values, while data points with higher anomaly scores are considered outliers; 104. Outlier Identification: According to the threshold of the abnormal score, the value is 0.8-1, the abnormal value is identified, and the load data is smoothed. The moving average method is used to process the smoothed load data set M≤N to reduce the impact of noise.

3. The user load clustering analysis method based on the sparrow algorithm according to claim 1 is characterized in that: The specific process of optimizing the initial cluster center in step (2) is as follows:

201. Determine the objective function: In the power user load analysis, for the load data set after data processing and smoothing The fitness value is associated with the objective function of cluster analysis and is used to measure the performance of each sparrow position, i.e., each potential cluster center; 202. Calculating Euclidean distance: Optimizing the objective function of the K-means algorithm Where C = {c1, c2, ..., c w }, w is the number of clusters, c s is the cluster center, is the data point X k The square of the Euclidean distance to the cluster center C; 203. Center Optimization Search: Searching for the optimal clustering center by iteratively updating the position of sparrows The iterative formula is expressed as: Where t is the number of iterations, α∈[0.1, 1], which controls the step size of the discoverer's behavior, β∈[0.1, 1], which controls the step size of the follower and the guard, both of which are learning factors; B(t) is the iteration step size, B(T) = B0·r, B0 is the initial value of the iteration, B0∈[1, 10], r is the step size reduction rate, r∈[0.9, 0.99], Rand() is a random function used to control the degree to which the sparrow individual moves to the optimal and worst individual positions, with a value range of 0-1; 204. Iterative update optimization; after each iteration, the objective function value of each sparrow individual is calculated Find the sparrow individual with the smallest objective function value and update it as the optimal sparrow individual in the current iteration Find the sparrow individual with the largest objective function value and update it to the worst sparrow individual in the current iteration and The initial value of the iteration is specified in C according to expert experience; when the difference in the change of the objective function value is less than the preset threshold ε, the iteration ends, otherwise it returns to step 203, where ε∈[10 -6 , 10 -4 ].

4. The user load clustering analysis method based on the sparrow algorithm according to claim 1 is characterized in that: The specific process of the improved K-means clustering analysis in step (3) is as follows: 301.Cluster center preparation: based on the optimal cluster center obtained Improved K-means was used for cluster analysis; 302. Calculate the minimum Euclidean distance: Calculate the load data set D = {X1, X2, ..., X N } to the cluster center The minimum distance, for each data set pair X k Belongs to cluster According to the formula to confirm; 303. Update cluster center: Calculate the average value of all data sets in each cluster to get the new cluster center, and confirm it according to the following formula Where D' s Is a cluster A set of data sets; 304. Iterative update optimization; if |d′ s+1 -d′ s |<δ, then the iteration stops, otherwise, return to step 303, δ∈[0, 10 -5 ].

Citation Information

Cited By

  • Electric equipment load waveform characteristic analysis and complexity classification evaluation method and system

    CN121542795A