## 2 Sample Customer Clustering Based on TSDC
### Customer Portrait Label System Construction
Whenever a new cluster is created, \(cn=cn+1\). When there are high-density customers in \(SN\), that is, \(\exists\rho(SN(i))\geq DT\), a new cluster \(C_{cn}\) is created with \(SN(1)\) and stored in the cluster output matrix C. Correspondingly, a cumulative number of clustered customers \(E_{cn}\) is created. And it is stored in the cumulative number of the clustered customer matrix \(E\). \(E\) serves to record the number of customers in each cluster. The customer \(SN(1)\) is used to create a new cluster. And this customer is also recorded as the center of the cluster and stored in the cluster center matrix \(ZX\). Then, let the high-density customer \(HU=SN(1)\), and \(SN(1)\) is removed from \(SN\), where \(SN(1)\) denotes the number one customer in \(SN\). The associated customers (direct density-reachable customers, density-reachable customers) of \(SN(1)\) are found in the remaining \(SN\). Note that when customer \(U_{i}\) is a high-density customer, if customer \(U_{j}\) is in the neighborhood \(\varepsilon\) of customer \(U_{i}\), customer \(U_{j}\) is called the direct density-reachable customer of customer \(U_{i}\). That is, if \(\rho(U_{i})\geq DT,d_{ij}\leq\varepsilon\), then \(U_{j}\) is the direct density-reachable customer of customer \(U_{i}\). If customer \(U_{j}\) is a high-density customer and at the same time is the direct density-reachable customer of customer \(U_{i}\), then customer \(U_{k}\) is the direct density-reachable customer of customer \(U_{j}\). At this time, if customer \(U_{k}\) is a high-density customer, then customer \(U_{k}\) is called the density-reachable customer of customer \(U_{i}\); otherwise, customer \(U_{k}\) is the density-connected customer of customer \(U_{i}\). That is, \(\rho(U_{i})\geq DT\), \(d_{ij}\leq\varepsilon,\rho(U_{j})\geq DT,d_{jk}\leq\varepsilon\). What is more, if \(\rho(U_{k})\geq DT\), then \(U_{k}\) is the density-reachable customer of customer \(U_{i}\), Otherwise, if \(\rho(U_{k})<DT\), then \(U_{k}\) is the density-connected customer of customer \(U_{i}\). The found customers are classified into the cluster of \(SN(1)\) in turn. For each classified customer, the corresponding \(C_{cn}\) and \(E_{cn}\) are updated once, and the customer is deleted from \(SN\). When all the associated customers of \(HU\) are classified into the same cluster, \(HU=SN(1)\), and the previous operation is repeated until there is no high-density customer in \(SN\), that is, \(\forall\rho(SN(i))<DT\), and the end of the RSN. Then, considering the possibility of low-density customers remaining after the RSN is completed, we cluster the remaining customers using density sorting, nearest-neighbor allocation, and adaptive search. This process is known as search the nearest neighbor in cluster (SNNC). In order to find the nearest neighbor of the cluster of low-density customers in the remaining \(SN\) for the customer \(SN(i)\), the point pair set \(A(i)\) is formed with it is first found in \(dist\), where \(A(i,j)\) represents the \(j\)-th customer in \(dist\) that can form a point pair with \(SN(i)\). Since \(dist\) is arranged in ascending order of distance, the point pair set \(A(i)\) is also arranged in ascending order of distance. That is, the larger \(j\) is, the farther \(A(i,j)\) is from \(SN(i)\). The cluster nearest neighbors of the customer \(SN(i)\) are found in all \(A(i)\). The cluster nearest neighbor refers to the following: if customer \(U_{i}\) is not in the cluster output matrix, and customers \(U_{j}\) and \(U_{k}\) are in the cluster output matrix, then for all customers \(U_{k}\), the distance from customer \(U_{j}\) to customer \(U_{i}\) is less than the distance from customer \(U_{k}\) to customer \(U_{i}\). In this case, \(U_{j}\) is called the cluster nearest neighbor of \(U_{i}\).