## 2 Sample Customer Clustering Based on TSDC
### Customer Portrait Label System Construction
It satisfies the following formulas:  
\[U_{i}\in\overline{C},U_{j}\in C,\text{for }\forall U_{k}\in C,\exists d_{ik}-d_{ ij}>0\]  
After selecting the cluster nearest neighbor of customer \(SN(i)\), further distance discrimination of the cluster nearest neighbor is needed to confirm the attribution of customer \(SN(i)\). If the distance between \(SN(i)\) and its cluster nearest neighbor is less than or equal to the neighborhood \(\varepsilon\), then \(SN(i)\) is directly classified into the cluster where the cluster nearest neighbor is located. If the distance between \(SN(i)\) and its cluster nearest neighbor is farther than the neighborhood \(\varepsilon\) and there are multiple clusters at this time, that is, \(cn>1\), then \(SN(i)\) is also classified into the cluster where the cluster nearest neighbor is located. If there is only one cluster at this time, that is, \(cn=1\), then a new cluster \(C_{cn+1}\) is created with \(SN(i)\). What is more, the customer \(SN(i)\) is stored in the cluster center matrix \(ZX\). When the customer \(SN(i)\) completes the clustering, the clustering output matrix \(C\), \(E\), and \(cn\) are updated. According to this, the remaining \(SN\) is clustered in turn until all customers complete the clustering, and outputs \(C\), \(E\), and \(cn\) are obtained. In total, the steps of sample customer clustering based on the TSDC algorithm can be summarized as follows. Step 1: According to the monthly load data \(Q\) of the customer set \(U\), the customer portrait label and the distance \(d_{ij}\) between each customer are calculated. And the distance sorted in ascending order, recorded as \(dist\). Then, the customer density \(\rho(U_{i})\) is calculated and sorted in descending order, denoted as \(SN\). Step 2: The sum of the relative density differences between each customer is calculated, and the customer density with the minimum value is selected as the \(DT\). Step 3: All high-density customers and their associated customers are clustered in order of density ranking. \(C\), \(E\), and \(cn\) are updated. And the first customer of each cluster is set as the clustering center until there is no high-density customer in the neighborhood. Step 4: It is determined whether the remaining customers include low-density customers. Proceed to step 5 if they do; otherwise go to step 8. Step 5: It is determined whether the customer \(SN(i)\) is in the neighborhood of the nearest neighbor of the cluster. If so, it is classified into the cluster where the nearest neighbor of the cluster is located; otherwise go to step 6. Step 6: It is determined whether there is only one cluster in the current cluster number. If so, a new cluster is created with the customer, and the customer is set as the center of the cluster; otherwise they are classified into the cluster where the nearest neighbor of the cluster is located. Step 7: The clustering output matrix \(C\), \(E\), and \(cn\) is updated, and it is determined whether there are low-density customers that are not clustered. If there are, go to step 5; otherwise go to step 8. Step 8: Clustering results are output. The flowchart of the customer set clustering method based on TSDC is shown in Appendix B.