## 4 Experiment and Analysis
### Clustering for Electricity Consumption Data  
The threshold for the cosine similarity filter was set empirically at 0.8 to remove irrelevant window subsequences, balancing computational efficiency and sequence alignment  
Figure 8: Data visualization.  
accuracy. The CH index was adopted to guide the splitting process. Splitting continued until the CH index decreases below 70% of its previous value, which ensured robust cluster formation while avoiding over-segmentation. Optimal clusters were determined by the silhouette index.  
The Improved-C algorithm was utilized for clustering and analyzing time-series data on user electricity usage. We performed an evaluation of the standard K-means algorithm, the PSO-based K-means algorithm (PSO-K), and the CLUBS algorithm using the silhouette index (SI).  
The silhouette index (SI), also known as the silhouette coefficient, is a metric utilized for evaluating the effectiveness of clustering. It assesses cluster compactness and distinction by examining intra-cluster cohesion and inter-cluster separation. The formula for SI is as follows:  
\[SI(i)=\frac{b(i)-a(i)}{max(a(i),b(i))} \tag{29}\]  
where \(a(i)\) denotes the mean distance of sample \(i\) to other samples within the same cluster (mean intra-cluster distance), and \(b(i)\) represents the average distance from sample \(i\) to all samples in another specific cluster, where the cluster with the smallest distance is considered the \"neighboring cluster\" of sample \(i\). Depending on the SI(i), the silhouette index of the entire dataset is the mean of the silhouette coefficients of all the samples. The nearer the SI is to 1, the more effective the clustering result is; the closer the SI is to 0, the poorer the clustering outcome is; when a negative value appears, it indicates that the clustering outcome is very bad.  
According to the silhouette scores, shown in Figure 9, the optimal numbers of clusters for Improved-C, CLUBS, K-means, and PSO-K are 10, 10, 7, and 9, respectively.  
The results are shown in Table 1.  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Model** & **SI** & **Time(s)** \\ \hline K-means & 0.55 & 125 \\ PSO-K & 0.60 & 306 \\ CLUBS & 0.62 & 102 \\ Improved-C & 0.63 & 115 \\ \hline \hline \end{tabular}
\end{table}
Table 1: Comparison of three clustering models.  
Figure 9: SI scores for clusters and algorithm.  
The outcomes indicate that, compared to the standard K-means, PSO-K, and CLUBS clustering methods, the Improved-C algorithm has obvious advantages in terms of theclustering effect, but only a small loss of efficiency, demonstrating the superiority of the improved algorithm.  
In addition to the previous plots, Figure 10 shows a comprehensive visualization of all clusters, each of which is shown in a separate subplot. This combined representation offers a comprehensive view of the clustering results, providing a deeper understanding of each cluster. In addition, the cluster center containing each cluster feature further improves the interpretability of the clustering. A histogram search for the number of users per electricity consumption pattern was conducted to examine the characteristics of the ten clusters (Figure 11).  
The clustered electricity consumption pattern labels were combined with the original data and user information to generate a new electricity consumption characteristic dataset.  
Figure 11: Histogram of the cluster.  
Figure 10: Visualization of typical electricity usage patterns.  
The same electricity consumption pattern can be characterized by centroid data, as shown in Table 2 (partial data). It can be seen that different categories show differentiated electricity consumption behavior. For the same category, the electricity consumption increases significantly in winter and summer due to the influence of season.