## 2 Sample Customer Clustering Based on TSDC  
### Customer Portrait Label System Construction  
There are differences in the electricity consumption and consumption habits of each customer. In order to identify similar customers among target customers, the monthly load data \(P=\left\{P_{U_{1}},P_{U_{2}},\cdots,P_{U_{t}},\cdots,P_{U_{t}}\right\}\) of the sample customer set \(U=\left\{U_{1},U_{2},\cdots,U_{i},\cdots,U_{t}\right\}\) are employed. In this paper, an electricity customer's portrait is constructed in five labels. The labels include (1) monthly load factor, (2) monthly minimum load factor, (3) monthly peak load utilization hours, (4) average peak/valley/flat load factor, and (5) average peak/valley/flat minimum load factor. Here, \(U_{i}\) represents the \(i\)-th customer, and \(P_{U_{i}}\) represents the load data \(P_{U_{i}}=\left\{P_{U_{i},1},P_{U_{i},2},\cdots,P_{U_{i},r},\cdots,P_{U_{i},R}\right\}\) of the \(i\)-th customer \(U_{i}\) in a month. \(P_{U_{i},r}\) is the load of customer \(U_{i}\) in the \(r\)-th period of a month. \(R\) is the total number of monthly periods, where the unit of a single period is half an hour. The physical meaning and definition of each portrait label are shown in Table 1. The specific meanings can be found in Appendix A. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Label** & **Physical Meaning** & **Definition** \\ \hline Monthly load factor & Fluctuation of monthly load & \(g_{U_{i},l}=\frac{P_{U_{i},\mu}}{P_{U_{i},\mu}}\) \\ \hline Monthly minimum load factor & Stability of customers’ electricity consumption & \(g_{U_{i},\mu l}=\frac{P_{U_{i},\mu m}}{P_{U_{i},\mu m}}\) \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Portrait label system of customers. Firstly, in order to identify high-density customers and cluster them, the sample customer set \(U\) is clustered based on density ranking and a self-adaptive search, that is, RSN. In order to quantify the density of customers in each sample set, the distance between customer \(U_{i}\) and another customer is calculated based on the constructed customer portraits. In addition, based on the distance, these customers are sorted in ascending order, which is recorded as \(dist\). The distance between customer \(U_{i}\) and customer \(U_{j}\) is \(d_{ij}\):  
\[d_{ij}=\sqrt{\sum\limits_{k=1}^{K}\left(g_{U_{i},k}-g_{U_{j},k}\right)^{2}} \tag{1}\]  
where \(g_{U_{i},k}\) and \(g_{U_{j},k}\) respectively represent the \(k\)-th portrait labels of customer \(U_{i}\) and customer \(U_{j}\). Based on Euclidean distance \(d_{ij}\), the similarity \(s_{\rho}(U_{i},U_{j})\) between customer \(U_{i}\) and customer \(U_{j}\) is as follows:  
\[s_{\rho}(U_{i},U_{j})=\frac{1}{1+d_{ij}}. \tag{2}\]  
Based on the distance \(d_{ij}\), the density \(\rho(U_{i})\) of customer \(U_{i}\) is calculated, which is the number of customers in the neighborhood \(\varepsilon\) of customer \(U_{i}\):  
\[\rho(U_{i})=\sum\limits_{j}\eta(d_{ij}-\varepsilon), \tag{3}\]  
where \(\eta(x)\) is a 0-1 function; when \(x<0\), \(\eta(x)=1\), and when \(x\geq 0\), \(\eta(x)=0\). Secondly, in order to solve the randomness problem of clustering and improve the stability of clustering, each customer is arranged in descending order according to the density. Based on this method, a new sort under the density sorting strategy is obtained, which is denoted as \(SN\). After the new ranking is obtained, customers can be clustered in order from high to low. This method can avoid the randomness of clustering results caused by the randomness of customer ranking order. Then, in order to clarify the boundary between high-density customers and low-density customers, a density threshold (\(DT\)) is introduced. The density \(\rho(U_{i})\) of customer \(U_{i}\) with the minimum sum of relative density differences is defined as \(DT\). The sum of the relative density difference of customer \(U_{i}\) is \(\sum\limits_{j=1}^{I}d_{ij}\). In order to record the current number of clusters, the variable \(cn\) is introduced, and the initial value is 0.