# Weighted \(z\)-Distance-Based Clustering and Its Application to Time-Series Data
## 3 Proposed Methods
### Weighted SCC-I (SCC-Iw)  
In SCC and SCC-I, each dimension is equally weighted in the calculation of \(z\)-distances, as shown in Equation (1). For some applications, e.g., time-series clustering, where certain relevance exists between different dimensions, allowing different dimensions to be weighted differently could be a useful idea [56]. This motivates the development of the weighted SCC-I, abbreviated as SCC-IW. Let the weighted \(z\)-distance between instance \(i\) and cluster \(C_{j}\), \(1\leq i\leq N\), \(1\leq j\leq J\), be defined as  
\[Z_{w}(i,j)=\sum_{k=1}^{n}w_{j,k}\bigg{(}\frac{x_{i,k}-c_{j,k}}{\sigma_{j,k}} \bigg{)}^{2} \tag{7}\]where \(\mathbf{w}_{j}=\left[w_{j,1}\ \cdots\ w_{j,n}\right]^{T}\) is the weight vector associated with \(C_{j}\), \(w_{j,k}\geq 0\) for \(1\leq k\leq n\), and \(w_{j,1}+\cdots+w_{j,n}=1\). Accordingly, the MD of instance \(i\) belonging to \(C_{j}\) is defined as:  
\[\mu_{j}(\mathbf{x}_{i})=\exp\{-Z_{w}(i,j)\}. \tag{8}\]  
Clearly, we have \(0\leq\mu_{j}(\mathbf{x}_{i})\leq 1\). If  
\[\exp\{-Z_{w}(i,j)\}<\rho \tag{9}\]  
for all existing clusters \(C_{j}\), \(1\leq j\leq J\), a new cluster is created; otherwise, instance \(i\) is assigned to the cluster with the largest MD, as described before. **Remark 1**. : _In Equation (3), the test is \(\exp\{-Z(i,j)\}<\rho^{n}\) where \(\rho\) is the pre-specified similarity threshold. Note that for \(\exp\{-Z(i,j)\}\), we have_  
\[\exp\{-Z(i,j)\}\] \[=\exp\{-\sum\limits_{k=1}^{n}\left(\frac{x_{j,k}-c_{j,k}}{\sigma_ {jk}}\right)^{2}\}\] \[=\exp\{-\left(\frac{x_{j,1}-c_{j,1}}{\sigma_{j,1}}\right)^{2}\} \cdots\exp\{-\left(\frac{x_{j,n}-c_{j,n}}{\sigma_{j,n}}\right)^{2}\}\] \[<\rho\cdots\rho=\rho^{n}\.\]  
_For \(\exp\{-Z_{w}(i,j)\}\), we have_  
\[\exp\{-Z_{w}(i,j)\}\] \[=\exp\{-\sum\limits_{k=1}^{n}w_{j,k}\left(\frac{x_{j,k}-c_{j,k}}{ \sigma_{j,k}}\right)^{2}\}\] \[=\exp\{-w_{j,1}\left(\frac{x_{j,1}-c_{j,1}}{\sigma_{j,1}}\right)^ {2}\}\cdots\exp\{-w_{j,n}\left(\frac{x_{j,n}-c_{j,n}}{\sigma_{j,n}}\right)^{2}\}\] \[\mu_{j}(\mathbf{x}_{i})=\exp\{-Z_{w}(i,j)\}. \tag{8}\]0 \[\mu_{j}(\mathbf{x}_{i})=\exp\{-Z_{w}(i,j)\}. \tag{8}\]1 \[\mu_{j}(\mathbf{x}_{i})=\exp\{-Z_{w}(i,j)\}. \tag{8}\]2  
_This is Equation (9)._  
Now the problem left is how the weights are determined to optimize the clustering work under consideration. Here, we consider time-series clustering as an exemplar application [56]. Firstly, it is required that the instances assigned to each cluster be close together as much as possible. In other words, we want to maximize:  
\[\mu_{j}(\mathbf{x}_{i})=\exp\{-Z_{w}(i,j)\}. \tag{8}\]3  
where \(u_{i,j}=1\) if instance \(i\) is assigned to cluster \(C_{j}\) and \(u_{i,j}=0\) otherwise, for \(1\leq i\leq N\) and \(1\leq j\leq J\), and \(\mu_{j}(\mathbf{x}_{i})\) is the MD defined in Equation (8). Note that \(\mu_{j}(\mathbf{x}_{i})\) is an exponential function which is non-linear on \(w_{j,1},\cdots,w_{j,n}\). Maximizing Equation (10) is a kind of non-linear optimization which is hard. However, maximizing \(\mu_{j}(\mathbf{x}_{i})\) is identical to minimizing \(Z_{w}(i,j)\). Therefore, instead of maximizing Equation (10), we minimize:  
\[\mu_{j}(\mathbf{x}_{i})=\exp\{-Z_{w}(i,j)\}. \tag{8}\]4Since \(Z_{w}(i,j)\) is linear on \(w_{j,1},\cdots,w_{j,n}\), minimizing Equation (11) is kind of linear optimization which is much easier. Secondly, since the neighboring dimensions are next to each other in the time line, the weights of neighboring dimensions should be close to each other.