## 3 Clustering Methods
### Gaussian Mixture Model (GMM)  
Gaussian Mixture Models (GMMs) offer a probabilistic framework that models the data as a mixture of \(K\) Gaussian distributions. Each component in the mixture is characterized by a mean vector \(\mu_{k}\), a covariance matrix \(\Sigma_{k}\), and a mixing coefficient \(\pi_{k}\) and the overall probability density function is given by the following [25]:  
\[p(\,x\mid\Theta)=\sum_{k=1}^{K}\pi_{k}\mathcal{N}(x;\mu_{k},\Sigma_{k}) \tag{8}\]  
\[\pi_{k}\geq 0\text{ and }\sum_{k=1}^{k}\pi k=1\]  
\[\mathcal{N}(x;\mu_{k},\Sigma_{k})=\frac{1}{(2\pi)^{\frac{d}{2}}|\Sigma_{k}|^{ \frac{1}{2}}}e^{exp(-\frac{1}{2}(x-\mu_{1})^{T}\Sigma_{k}(x-\mu_{k}))}\]  
\[\Theta=\{\pi_{k},\mu_{k},\Sigma_{k}\}_{k=1}^{K}\]  
where \(\pi_{k}\) represents the mixing coefficient for the \(kth\) component and \(\Theta\) denotes the set of all model parameters. A crucial step in fitting a GMM is choosing the initial parameter values, since poor initialization can lead to suboptimal clustering or slow convergence in the EM algorithm. In our case, we initialize the GMM means \(u_{k}\) using K-means++, which was proposed by [PERSON] and [PERSON] in 2007 [26]. We employ K-means++ to initialize the means of the Gaussian components prior to the expectation-maximization procedure. K-means++ selects initial centroids that are more widely dispersed than those from random initialization, which significantly reduces the likelihood of convergence to suboptimal local maxima in the likelihood function. This approach not only accelerates convergence but also improves the stability and reproducibility of the GMM clustering results, as documented in  
Figure 5: K-Means clustering results. prior studies. Specifically, we first use K-means++ to select \(K\) well-spaced centroids. These centroids then serve as the initial means \(u_{k}\). The covariance matrices \(\Sigma_{k}\) can be initialized (for instance) as the identity matrix or estimated from the local neighborhoods of these initial means, while the mixing coefficients \(\pi_{k}\) are set to \(\frac{1}{K}\) by default. This initialization strategy helps to avoid the local maxima often encountered by random initialization. Once we have initial parameter estimates, the GMM parameters are iteratively refined using the expectation-maximization (EM) algorithm [27]. Each iteration of EM comprises the following two steps:  
3.3.1. Expectation Step  
Compute the posterior probability \(\gamma_{ik}\) that data point \(x_{i}\) belongs to cluster \(k\) through the following:  
\[\gamma_{ik}=p(z_{k}\mid x_{i})=\frac{\pi_{k}N(x_{i};u_{k},\Sigma_{k})}{\sum_{i= 1}^{N}\pi_{j}N(x_{i};\mu_{k},\Sigma_{k})} \tag{9}\]  
where \(z_{k}\) denotes the event that \(x_{i}\) comes from the kth Gaussian component. The responsibilities \(\gamma_{ik}\) quantify soft cluster membership, allowing a single data point to have fractional membership in different clusters. 3.3.2. Maximization Step  
Update the model parameters \(\{\pi_{k},u_{k},\Sigma_{k}\}\) to maximize the expected complete-data log-likelihood. The standard formulas for the updates are as follows:  
\[ \begin{cases}\pi_{k}^{new}=\frac{1}{N}\sum_{i=1}^{N}\gamma_{ik},\ \ \mu_{k}^{new}=\frac{\sum_{i=1}^{N}\gamma_{ik}x_{i}}{\sum_{i=1}^{N}\gamma_{ik}},\\ \sum_{k}^{new}=\frac{\sum_{i=1}^{N}\gamma_{ik}(x_{i}-\mu_{k}^{new})\left(x_{i} -\mu_{k}^{new}\right)^{\text{T}}}{\sum_{i=1}^{N}\gamma_{ik}}\end{cases}  \tag{10}\]  
where \(N\) is the total number of data points. Each update step re-estimates the mixing coefficients, means, and covariances based on the current responsibilities. These two steps (E and M) alternate until convergence, typically when changes in the log-likelihoods or parameter values fall below a chosen threshold. After all this process, the resulting clusters of GMMs are shown in Figure 6.  
Soft clustering is a defining characteristic of Gaussian Mixture Models (GMMs) that proves especially valuable in second-life battery applications, where cells often exhibit overlapping performance characteristics.