## 2 Inference Methods  
### Enhanced K-Means Clustering Algorithm for Electrical Signal Analysis  
Clustering algorithms, unlike traditional classification methods, which operate with predefined targets, are unsupervised algorithms primarily engaged in the analysis of non-labeled data. The outcome of clustering is inherently indeterminate, as opposed to the predetermined categories in classification. Utilizing clustering algorithms allows for the discovery and grouping of data based on structural information, with the objective of maximizing intra-cluster similarity and minimizing inter-cluster similarity. This encompasses a range of algorithms, including hierarchical clustering, partitioned clustering, density-based clustering, and grid-based clustering. Among these, the K-means clustering algorithm, a type of partitioned clustering method, is notably prevalent across various data processing fields. Given the distinctive electrical signal characteristics of devices during operation, the application of clustering methods in NILM remains a focal point of research. Studies have indicated that K-means, one of the most suitable unsupervised clustering algorithms for NILM research, effectively scales to a large number of samples, segmenting them into disjoint clusters [39]. The K-means algorithm operates by dividing data into 'K' groups, initially selecting 'K' objects as provisional cluster centers. It calculates the distance between each object and these seed cluster centers, assigning each object to the nearest cluster. The cluster centers, along with their associated objects, define a cluster. With each sample allocation, the cluster center is recalculated based on the existing objects in the cluster. This iterative process continues until a termination condition is met, which could be the stabilization of object assignment to clusters, no significant change in cluster centers, or the localization of the minimum sum of error squares. However, K-means also has its limitations, particularly in scenarios involving a large number of devices (i.e., clusters), where the necessity to predetermine the number of clusters can be a significant impediment in NILM applications with numerous appliances [40]. Accurate determination of the number of clusters is feasible only when the cluster count is relatively low, achievable by running K-means over a range of cluster numbers and identifying the 'elbow point' for the true quantity of clusters. In this study, the K-means algorithm is utilized for clustering analysis, with strategic modifications implemented to augment its suitability for NILM applications. These enhancements specifically target the challenge of randomly selecting initial centroids, a critical aspect that, if not meticulously handled, can result in suboptimal clustering or delayed convergence. This enhancement is pivotal for optimizing the clustering process, especially in complex NILM applications with diverse appliance profiles. This iterative clustering analysis algorithm, in contrast to the traditional K-means method, generates only one cluster center initially and determines 'K' cluster centers through the iterative application of the roulette method. The distance between each object and each cluster center is computed, assigning each object to the nearest cluster center. Clusters are thus represented by their cluster centers and the assigned objects. The recalibration of cluster centers continues with each sample data allocation until the termination conditions are satisfied. These conditions include no or minimal reassignment of objects to different clusters, no or minimal change in the number of cluster centers, and the localization of the minimum sum of error squares. Figure 1 illustrates the process of the improved K-means clustering algorithm. Utilizing this enhanced approach, the electrical signals collected from operational electrical equipment are divided into multiple clusters.