## 2 Methodology
### Classification of Customer Groups
#### 2.1.2 Sample Customer Clustering Based on AAP Algorithm  
Considering the large number of customers, it is necessary to cluster the sample customers based on their constructed profiles to reduce computational complexity. The Adaptive Affinity Propagation (AAP) clustering algorithm [33] overcomes the limitations of the standard Affinity Propagation (AP) algorithm, such as the difficulty in selecting the \"preference\" parameter and the inability to automatically eliminate oscillations. It demonstrates better performance, particularly in handling complex or large-scale clustering tasks. Compared to traditional clustering methods, AAP clustering can automatically determine the number of clusters based on the similarity of customer data without the need to predefine the number of categories. It does not rely on randomly selected initial centers but instead uses information propagation to automatically identify cluster centers. This eliminates the sensitivity to initial conditions inherent in traditional clustering algorithms. Additionally, it can more accurately handle complex and nonlinear customer data structures and identify appropriate cluster boundaries in such structures, providing more precise and reliable clustering results. Due to these advantages, using the AAP clustering method is well-suited for clustering sample customers based on their profiles. AAP clustering only requires the input of similarity between customer profiles. The similarity \(s(R_{i},R_{j})\) between profiles of customers \(R_{i}\) and \(R_{j}\) represents the degree to which \(R_{j}\) is suitable as a clustering center for \(R_{i}\). The self-similarity \(s(R_{i},R_{i})\), which indicates the reference level of customer \(R_{i}\)'s own profile, is usually set to the median of \(R_{i}\)'s similarity with other customer profiles, ensuring the minimum number of clusters. Some customers may tend to give higher ratings to electricity retail packages, while others may be more critical and give lower ratings. This issue of rating scale inflation can affect the accuracy of similarity calculations. However, the Pearson correlation coefficient can address this issue, as it accounts for the overall rating tendencies of customers rather than just the absolute values of the ratings. By calculating the Pearson correlation coefficient between customers, it is possible to more accurately identify customers with similar interests. In recommendation systems, if two customers have similar interests, a retail electricity package adopted by one customer is likely to be adopted by the other. Therefore, this paper uses the Pearson correlation coefficient to calculate the similarity between the target customer and the sample customers, as follows:  
\[s(R_{i},R_{j})\ =\ \frac{\sum\limits_{x\ =\ 1}^{6}{(b_{R_{i}}^{x}-\overline{b_{R_{i }}})(b_{R_{j}}^{x}-\overline{b_{R_{j}}})}}{\sqrt{\sum\limits_{x\ =\ 1}^{6}{(b_{R_{i}}^{x}-\overline{b_{R_{i}}})^{2}}\cdot\sqrt{\sum \limits_{x\ =\ 1}^{6}{(b_{R_{j}}^{x}-\overline{b_{R_{j}}})^{2}}}}}\ i\
eq j, \tag{7}\]  
where \(b_{R_{i}}^{x}\) and \(b_{R_{j}}^{x}\) represent the \(x\)-th portrait table of customers \(R_{i}\) and \(R_{j}\), respectively, while \(\overline{b_{R_{i}}}\) and \(\overline{b_{R_{j}}}\) denote the average values of the profile labels for customers \(R_{i}\) and \(R_{j}\), respectively. The absolute value of \(s(R_{i},R_{j})\) indicates the strength of the linear relationship between two customers. The closer the correlation coefficient \(s(R_{i},R_{j})\) is to 1, the stronger the correlation between the two customers. When \(s(R_{i},R_{j})\) is closer to 1, it suggests a stronger relationship, meaning that the similarity is higher, and it is more likely that both customers will choose similar packages. The detailed steps of the traditional AP clustering algorithm are as follows:  
Step 1: Initialize the responsibility and availability of customer profiles, as shown in Equations (8) and (9).