# Spectral clustering

In multivariate statistics and the clustering of data, spectral clustering[1] techniques make use of the spectrum (eigenvalues) of the similarity matrix of the data to perform dimensionality reduction before clustering in fewer dimensions. The similarity matrix is provided as an input and consists of a quantitative assessment of the relative similarity of each pair of points in the dataset.

A figure showing the relative strengths of K-means and spectral clustering.[2]

In application to image segmentation, spectral clustering is known as segmentation-based object categorization.

## Algorithms

Given an enumerated set of data points, the similarity matrix may be defined as a symmetric matrix $A$, where $A_{ij}\geq 0$ represents a measure of the similarity between data points with indexes $i$ and $j$.

One spectral clustering technique is the normalized cuts algorithm or Shi–Malik algorithm introduced by Jianbo Shi and Jitendra Malik,[3] commonly used for image segmentation. It partitions points into two sets $(B_1,B_2)$ based on the eigenvector $v$ corresponding to the second-smallest eigenvalue of the symmetric normalized Laplacian defined as

$L^{norm}:=I-D^{-1/2}AD^{-1/2}$,

where $D$ is the diagonal matrix

$D_{ii} = \sum_j A_{ij}.$

A mathematically equivalent algorithm [4] takes the eigenvector corresponding to the largest eigenvalue of the random walk normalized Laplacian matrix $P = D^{-1}A$.

Another possibility is to use the Laplacian matrix defined as

$L:=D-A$

rather than the symmetric normalized Laplacian matrix.

Partitioning may be done in various ways, such as by taking the median $m$ of the components in $v$, and placing all points whose component in $v$ is greater than $m$ in $B_1$, and the rest in $B_2$. The algorithm can be used for hierarchical clustering by repeatedly partitioning the subsets in this fashion.

Alternatively to computiong just one eigenvector, k eigenvectors for some k, are computed, and then another algorithm (e.g. k-means clustering) is used to cluster points by their respective k components in these eigenvectors.

An efficiency of spectral clustering may be improved if the solve of the corresponding eigenvalue problem is performed in a matrix-free fashion, i.e., without explicitly manipulating or even computing the similarity matrix, as, e.g., in the Lanczos algorithm.

For large-size graphs, the second eigenvalue of the (normalized) graph Laplacian matrix is often ill-conditioned, leading to slow convergence of iterative eigenvalue solvers. Preconditioning is a key technology accelerating the convergence, e.g., in the matrix-free LOBPCG method.

Spectral clustering is closely related to Nonlinear dimensionality reduction, and dimension reduction techniques such as locally-linear embedding can be used to reduce errors from noise or outliers.[5]

## Relationship with k-means

The kernel k-means problem is an extension of the k-means problem where the input data points are mapped non-linearly into a higher-dimensional feature space via a kernel function $k(x_i,x_j) = \phi^T(x_i)\phi(x_j)$. The weighted kernel k-means problem further extends this problem by defining a weight $w_r$ for each cluster as the reciprocal of the number of elements in the cluster,

$\max_{C_i} \sum_{r=1}^k w_r \sum_{x_i,x_j \in C_r} k(x_i,x_j).$

Suppose $F$ is a matrix of the normalizing coefficients for each point for each cluster $F_{ij} = w_r$ if $i,j \in C_r$ and zero otherwise. Suppose $K$ is the kernel matrix for all points. The weighted kernel k-means problem with n points and k clusters is given as,

$\max_{F} \operatorname{ trace } \left(KF\right)$

such that,

$F = G_{n\times k}G_{n\times k}^T$
$G^TG = I$

such that $\text{rank}(G) = k$. In addition, there are identity constrains on $F$ given by,

$F\cdot \mathbb{I} = \mathbb{I}$

where $\mathbb{I}$ represents a vector of ones.

$F^T\mathbb{I} = \mathbb{I}$

This problem can be recast as,

$\max_G \text{ trace }\left(G^TG\right).$

This problem is equivalent to the spectral clustering problem when the identity constraints on $F$ are relaxed. In particular, the weighted kernel k-means problem can be reformulated as a spectral clustering (graph partitioning) problem and vice-versa. The output of the algorithms are eigenvectors which do not satisfy the identity requirements for indicator variables defined by $F$. Hence, post-processing of the eigenvectors is required for the equivalence between the problems.[6] Transforming the spectral clustering problem into a weighted kernel k-means problem greatly reduces the computational burden.[7]

2. ^ Martin, Charles (October 9, 2012), http://charlesmartin14.wordpress.com/2012/10/09/spectral-clustering/ Missing or empty |title= (help)