## 3 Grassmann MTS Clustering
### Semi-Intrinsic Grassmann Clustering  
The main focus of the two previous approaches is on how to measure similarities between MTS samples, such as geodesic distances. However, we are frequently required to compute not only the dissimilarity but also the mean of the given data. For example, \(k\)-means and mean shift [51] and their variants require the mean computation of the given data. On the Grassmann manifold, computing the data mean is not straightforward and requires a specific form of mean computation known as Karcher mean [30; 54]. As shown in Algorithm 6, the Karcher mean computes the data mean by minimizing the squared distances between points and the mean on a manifold, iteratively. With the Karcher mean, the last approach, namely, the semi-intrinsic approach performs the MTS clustering directly on the Grassmann manifold. Typical instances of this approach applied in \(k\)-means (see Algorithm 7 for details) and mean shift clustering on the Grassmann manifold can be found in [20; 51], respectively.  
Since this approach is directly performed on the Grassmann manifold, the geodesic distances shown in (5)-(7) can be used as similarity/dissimilarity measures. The semi-intrinsic approach differs from the intrinsic approach in the sense that it performs clustering on the manifold based on Karcher mean as well as geodesic distance while mean computation is undefined for the intrinsic approach.  
```
1:Input: Given a set of \(n\) points \(\{\mathbf{U}_{i}\}_{i=1}^{n}\) on the Grassmann manifold, maximum iteration \(N\)
2: Randomly select a \(\mathbf{U}_{i}\) and use an initial estimate of the Karcher mean \(\boldsymbol{\mu}_{o}\), and set \(j=1\).
3:while\((j\leq N)\)do
4: Compute the inverse exponential map \(\mathbf{v}_{i}\) of \(\mathbf{U}_{i}\) by \(\mathbf{v}_{i}=\exp_{\mu_{j}}^{-1}(\mathbf{U}_{i})\).
5: Compute the average tangent vector \(\tilde{\mathbf{v}}=\frac{1}{n}\sum_{i=1}^{n}\mathbf{v}_{i}\).
6: If \(\|\tilde{\mathbf{v}}\|\) is small, then stop. Else, move \(\boldsymbol{\mu}_{j}\) in the average tangent direction using \(\boldsymbol{\mu}_{j+1}=\exp_{\boldsymbol{\mu}_{j}}(e\tilde{\mathbf{v}})\), where \(e>0\) is small step size, typically 0.5.
7:\(j=j+1\)
8:endwhile
9:Output: Karcher mean \(\boldsymbol{\mu}\) over the input points \(\{\mathbf{U}_{i}\}_{i=1}^{n}\)
```  
**Algorithm 6** Karcher mean  
```
1:Input: \(n\) points \(\{\mathbf{U}_{i}\}_{i=1}^{n}\) on the Grassmann manifold, number of clusters \(K\), maximum iteration \(N\)
2: Initialize \(K\) cluster centers \(\{\boldsymbol{\mu}_{k}^{(0)}\}_{k=1}^{K}\) randomly and set \(j=1\).
3:while\((j\leq N)\)do
4: Measure a **dissimilarity** between \(U_{j}\) and \(\mu_{k}^{(j)}\) using **distance functions** on manifold such as depicted in (5), (6) or (7).
5: Assign \(\mathbf{U}_{j}\) to cluster \(C_{k}\), which shows \(\min\,d\Big{(}\mathbf{U}_{j},\boldsymbol{\mu}_{k}^{(j)}\Big{)}\).
6: Re-compute the \(K\) cluster centers \(\{\boldsymbol{\mu}_{k}^{(j)}\}_{k=1}^{K}\) using the Karcher mean.
7:\(j=j+1\)
8:endwhile
9:Output: Clusters \(\{C_{1},...,C_{K}\}\) with \(C_{k}=\{i|\mathbf{z}_{i}\in C_{k}\}\)
```  
**Algorithm 7** Semi-intrinsic Grassmann clustering based on \(k\)-means.