## 3 Example Analysis
### Experimental Analysis and Verification  
#### 3.3.1 Clustering Visualization and Comparison Experiment  
We used SVD to downscale the load data of the 3533 households from 17,500 to 2000. The time required for clustering was significantly reduced from seven days to less than one day. We used the K-Shape algorithm to cluster the 3533 real residential user load curves into two categories. To display the data distribution after clustering more vividly,we used Principal Component Analysis to map the data from high-dimensional space to two-dimensional space. The clustering visualization diagram is shown in Figure 5.  
The x-axis and y-axis, respectively, represent the first dimension and the second dimension after the data are reduced to two dimensions, and the difference between different clusters is obvious after clustering. To further demonstrate the clustering effect, the average daily load of residents in different clusters after clustering is shown in Figure 3. The vertical axis represents the load in kW. The horizontal axis represents time, with a minimum time unit of 30 min and a total of 48-time steps.  
As can be seen in Figure 6, the K-Shape clustering algorithm can divide residents into two categories according to the difference in residential electricity consumption. The first is high-electricity residents, and the other is low-electricity residents. Among them, the peak daily load of Class I residents is 0.33 kw/h, which is about 33% higher than that of Class II residents at 0.22 kW/h. The daily load valley value of Class I residents is 0.18 kW/h and that of Class II residents is 0.13 kW/h, while the daily trough value of Class I residents is about 38% higher than that of Class II residents, with obvious differences.  
Figure 5: Cluster visualization.  
Figure 6: Daily average electricity consumption of two types of residents after clustering.  
To further verify the effect of differentiated clustering on subsequent experiments, ablation experiments were performed on the above results. In this project, residents are divided into two categories, high-electricity residents and low-electricity residents, and the daily load is forecasted on the same grid residential electricity consumption dataset. In Table 1, ALL represents the results of the direct prediction without clustering, and K-Shape_2 indicates the results of the prediction after clustering into two categories.  
As shown in Table 1, when the clustering is two classes, the MAPE is 1.49%, and the MAE is 23.77, both of which are better than the unclustered results. This is because we divide the load curves of group residents into two categories through clustering, which are high power consumption curves and low power consumption curves. Predicting them separately can ensure that the input vectors of the prediction model have a higher similarity so that the prediction is more accurate.  
As shown in Table 2, K-Shape has a significant improvement compared to K-means and DBSAN. Compared to K-means and DBSAN, the method in this paper improves the MAPE by 5.82% and 14.47%, respectively. Improvements of 47.22 and 107.52 are achieved on the MAE, respectively. Compared to the other two methods, K-Shape significantly improves the results of all the metrics. This is mainly due to the optimization of the distance calculation method, the centroid calculation method, and the introduction of the frequency-domain feature extraction method.  
Overall, the prediction performance after clustering is better than that without clustering. Through clustering, the load sequences with the highest similarity in the samples can be screened out and grouped as subsequent prediction training samples. We selected the historical load sequence with the highest similarity to the input vector. It can be guaranteed that the output of the predictive model is closer to the true value, and the input space of the predictive model can be mapped more reasonably.