Accelerated Spectral Clustering Using Graph Filtering Of Random Signals

Nicolas Tremblay, Gilles Puy, Pierre Borgnat, Remi Gribonval, Pierre Vandergheynst

Introduction

Spectral clustering has become a popular clustering algorithm, due to its simplicity of implementation and high performance for many different types of datasets . Given a set of NN data points (x1,x2,⋯ ,xN)(\bm{x}_{1},\bm{x}_{2},\cdots,\bm{x}_{N}), it basically transforms them non-linearly into a kk-dimensional space first, by computing a similarity matrix W\bm{W} from the data, and second by computing the kk first eigenvectors of its Laplacian. Calculating these eigenvectors is the computational bottleneck of spectral clustering: it becomes prohibitive when NN becomes large and/or when the kk-th eigengap becomes too small . Circumventing this issue is an active area of research . Another difficulty, common to all clustering methods, is the estimation of the usually unknown number of clusters kk .

We propose a new method that jointly avoids to partially diagonalize the Laplacian and proposes a stability measure to estimate kk. This method is based on the emerging field of graph signal processing , where the graph we consider here is defined by the weighted adjacency matrix W\bm{W}. In our previous work , we proposed the use of the graph wavelet or scaling function transforms of random vectors to detect multiscale communities in networks. In this paper, we build upon this idea of using filtered random vectors as probes of the underlying graph’s structure; and further prove that ideal low-pass graph filters have deep connections with spectral clustering. Taking advantage of the fast graph filtering defined in to low-pass filter such random signals without computing the first kk eigenvectors of the graph’s Laplacian, we propose an accelerated spectral clustering method that has the collateral advantage of defining a stability measure to estimate the number of clusters kk.

In Section 2, we recall the graph signal processing notations and tools we will use in the paper, as well as the classical spectral clustering algorithm. In Section 3, we prove that one can filter random signals to estimate the spectral clustering distance matrix. In Section 4, we detail our algorithm and propose a stability measure to estimate the number of clusters kk. We finally show results obtained on a controled dataset in Section 5; before concluding in Section 6.

Background

Let G=(V,E,W)\mathcal{G}=(\mathcal{V},\mathcal{E},\mathbf{W}) be an undirected weighted graph with V\mathcal{V} the set of NN nodes, E\mathcal{E} the set of edges, and W\mathbf{W} the weighted adjacency matrix such that Wij=Wji≥0W_{ij}=W_{ji}\geq 0 is the weight of the edge between nodes ii and jj.

Consider the graph’s combinatorial LaplacianOne could use other types of Laplacians, such as the normalized Laplacian; which adds a normalization step after step 2 of the spectral clustering algorithm (see Section 2.2) and slightly changes our subsequent proofs. matrix L=S−W\bm{L}=\mathbf{S}-\mathbf{W} where S\mathbf{S} is diagonal with Sii=si=∑j≠iWijS_{ii}=s_{i}=\sum_{j\neq i}W_{ij} the strength of node ii. L\bm{L} is real symmetric, therefore diagonalizable in an orthogonal basis: its spectrum is composed of its set of eigenvalues {λl}l=1…N\{\lambda_{l}\}_{l=1\dots N} that we sort: 0=λ1≤λ2≤λ3≤⋯≤λN0=\lambda_{1}\leq\lambda_{2}\leq\lambda_{3}\leq\dots\leq\lambda_{N}; and of χ\mathbf{\bm{\chi}} the orthonormal matrix of its eigenvectors: χ=(χ1∣χ2∣…∣χN)\bm{\chi}=\left(\bm{\chi}_{1}|\bm{\chi}_{2}|\dots|\bm{\chi}_{N}\right). Considering only connected graphs, the multiplicity of eigenvalue λ1=0\lambda_{1}=0 is one . By analogy to the continuous Laplacian operator whose eigenfunctions are the classical Fourier modes and eigenvalues their squared frequencies, the columns of χ\bm{\chi} are considered as the graph’s Fourier modes, and {λl}l\{\sqrt{\lambda_{l}}\}_{l} as its set of associated “frequencies” . Other types of graph Fourier matrices have been proposed (e.g. ), but in order to exhibit the link between graph signal processing and classical spectral clustering (that partially diagonalizes the Laplacian matrix), the Laplacian-based Fourier matrix is more natural.

2 Spectral clustering

Let us recall the method of spectral clustering . The input is the set of data points (x1,x2,⋯ ,xN)(\bm{x}_{1},\bm{x}_{2},\cdots,\bm{x}_{N}) and kk the number of clusters one desires. Follow the steps:

Compute the pairwise similarities s(xi,xj)s(\bm{x}_{i},\bm{x}_{j}) and create a similaritySee for several choices of similarity measure ss as well as several ways to create W\bm{W} from the s(xi,xj)s(\bm{x}_{i},\bm{x}_{j}). graph W\bm{W}. Compute its Laplacian L\bm{L}.

where δi(j)=1\delta_{i}(j)=1 if j=ij=i and elsewhere.

Run kk-means (or any clustering algorithm) with the Euclidean distance Dij=∣∣fi−fj∣∣D_{ij}=||\bm{f}_{i}-\bm{f}_{j}|| to obtain kk clusters.

3 Graph filtering

and Hλc\bm{H}_{\lambda_{c}} its associated graph filter operator.

4 Fast graph filtering

In order to filter a signal by hh without diagonalizing the Laplacian matrix, one may rely on a polynomial approximation of order mm of hh on [0,λN][0,\lambda_{N}]: ∃{αl}l∈[0,m]\mboxs.t.h(λ)≃∑l=0mαlλl\exists\{\alpha_{l}\}_{l\in[0,m]}\mbox{ s.t. }h(\lambda)\simeq\sum_{l=0}^{m}\alpha_{l}\lambda^{l}. This enables us to approximate Hx\bm{Hx}:

where we note that the approximation only requires matrix-vector multiplication and effectively bypasses the diagonalisation of the Laplacian; and where we introduce the notation Fhm\mathcal{F}^{m}_{h} to design the fast filtering operator of order mm associated to hh. This fast filtering method has a total complexity of O(m(∣E∣+N))O(m(|\mathcal{E}|+N)) , which in the case of sparse graph where ∣E∣∼N|\mathcal{E}|\sim N, ends up being O(mN)O(mN); compared to the O(N3)O(N^{3}) complexity needed to diagonalize the Laplacian matrix.

In this study, we only consider ideal low-pass hλch_{\lambda_{c}} defined on [O,λN][O,\lambda_{N}]. Notice that hλc/λN=hλc(λ×λN)h_{\lambda_{c}/\lambda_{N}}=h_{\lambda_{c}}(\lambda\times\lambda_{N}) is always defined on $anddoesnotdependonanygraphanymore.Onecanthereforebeforehandtabulateand does not depend on any graph anymore. One can therefore beforehand tabulatem^{*}asafunctionofitssoleparameteras a function of its sole parameter\lambda_{c}/{\lambda_{N}}(and(and\delta).Then,givenarealfilter). Then, given a real filterh_{\lambda_{c}}definedondefined on[O,\lambda_{N}]toapproximate,oneonlyneedstorefertothistableandchooseto approximate, one only needs to refer to this table and choosem=m^{*}(\lambda_{c}/\lambda_{N};\delta).Inthefollowing,wefix. In the following, we fix\delta=0.1$.

Accelerating spectral clustering

We show that we can estimate the distance Dij=∣∣fi−fj∣∣D_{ij}=||\bm{f}_{i}-\bm{f}_{j}|| by filtering a few random signals with the ideal low-pass hλkh_{\lambda_{k}} (as defined in Eq. (2) with λc=λk\lambda_{c}=\lambda_{k}). First of all, consider the matrix operator Hλk\bm{H}_{\lambda_{k}} associated to hλkh_{\lambda_{k}}. One may write:

where Ik\bm{I}_{k} is the identity of size kk, and 0\bm{0} null block matrices.

Proposition: Let ϵ,β>0\epsilon,\beta>0 be given. If η\eta is larger than:

then with probability at least 1−N−β1-N^{-\beta}, we have: ∀(i,j)∈[1,N]2\forall(i,j)\in[1,N]^{2}

As i) the columns of U\bm{U} are normalized to 1 and orthogonal to each other, and ii) R\bm{R} is a random Gaussian matrix with mean zero and variance 1/η1/\eta, then R′=R⊤U\bm{R}^{\prime}=\bm{R}^{\top}\bm{U} is also Gaussian with same mean and variance; and Equation (9) reads:

This enables us to apply Theorem 1.1 of (an instance of the Johnson-Lindenstrauss lemma) and finish the proof. ∎

Consequence: Setting β\beta to 1, and therefore the failure probability of Equation (8) to 1/N1/N, we only need to filter η≳12ϵ2log⁡N\eta\gtrsim\frac{12}{\epsilon^{2}}\log{N} random signals to estimate (up to an error ϵ\epsilon) the spectral clustering distance matrix. How this error ϵ\epsilon on the distance estimation theoretically affects the performance of the spectral clustering algorithm is still, to our knowledge, an open question. We observe experimentally (see Sec. 5) that using a number η≳k\eta\gtrsim k (i.e. allowing a relatively high error ϵ2≃12log⁡Nk\epsilon^{2}\simeq 12\frac{\log{N}}{k}) is usually enough for satisfying performance.

2 Fast filtering of random signals

In practice, we do not exactly filter these random signals by hλkh_{\lambda_{k}} as the computation of Hλk\bm{H}_{\lambda_{k}} requires the diagonalisation of the Laplacian, which is precisely what we are trying to avoid. Instead, we take advantage of the fast filtering scheme recalled in Section 2.4. Still, one question remains: the fast filtering is based on the polynomial approximation of hλkh_{\lambda_{k}}, which is itself parametrized by λk\lambda_{k}. Unless we compute the first kk eigenvectors of L\bm{L}, thereby loosing our efficiency edge on other methods, we cannot know exactly the value of λk\lambda_{k}.

Accelerated spectral clustering

Consider a set of data points (x1,x2,⋯ ,xN)(\bm{x_{1}},\bm{x_{2}},\cdots,\bm{x_{N}}) and kk the number of desired clusters. The first step of the algorithm does not change as compared to Section 2.2: compute the pairwise similarities sijs_{ij}, create a similarity graph W\bm{W}, and compute its Laplacian L\bm{L}. Then:

Estimate L\bm{L}’s largest eigenvalue λN\lambda_{N} (necessary for steps 2 and 3).

2 Complexity considerations

We compare the time complexity of this algorithm and the classical spectral clustering algorithm. Let us separate our algorithm (resp. the classical algorithm) into two parts: the spectral estimation part consisting of steps 1 and 2 (resp. step 2) and the clustering part consisting in steps 4 to 6 (resp. steps 3 and 4). According to , kk-means has complexity O(ηN)O(\eta N) where η\eta is the dimension of the NN considered vectors. Considering the discussion of Section 2.4, the time complexity of the clustering part is thus O(η(m+1)N)O(\eta(m+1)N) (resp. O(kN)O(kN)). The time complexity of the spectral estimation part is difficult to estimate, as it depends on the graph-dependent eigengap λk+1−λk\lambda_{k+1}-\lambda_{k}. In both algorithms, the larger is this eigengap, the faster is the convergence. Nevertheless, empirical observations show that, even though the clustering part of the classical algorithm is faster than ours; our algorithm makes up to that difference by computing even faster (especially for large NN) its spectral estimation part than the classical one.

3 Estimate the number of clusters k𝑘k

In real data, the number of clusters kk to find is usually unknown. Instead, one has access to a (possibly large) interval of values [kmin,kmax][k_{min},k_{max}]. Notions of stability to estimate kk have been used in various contexts ; and we propose here a new one that naturally comes from the random vectors’ stochasticity. For all k∈[kmin,kmax]k\in[k_{min},k_{max}], we perform our algorithm JJ times using JJ different realisations of the η\eta random signals, to obtain JJ different clusterings {Ckj}j∈[1,J]\{\mathcal{C}^{j}_{k}\}_{j\in[1,J]}. We define a stability measure as the mean of the Adjusted Rand Index similarity between all pairs of clusterings :

Denote k∗k^{*} the value of kk for which γ\gamma reaches its global maximum: we consider it as the relevant number of clusters.

Results

From these N points, we create a similarity matrix by building a KK nearest neighbours graph with K ∼log⁡NK~{}\sim\log{N} as suggested in as a classical way of generating sparse similarity graphs. Other wiring possibilities exist to create such a graph (see ) but we only show this particular one as the choice of construction does not affect our results (but still considering graphs with same sparsity).

We use Matlab’s kk-means function (with 20 replicates) and the GSP toolbox for steps 2 and 3 of our algorithm.

First, we remark in this dataset that values of λk=10/λN\lambda_{k=10}/\lambda_{N} are small (of the order of 10−410^{-4}), which necessitates a large m∼200m\sim 200 for a correct approximation of the ideal low-pass on [0,λN][0,\lambda_{N}] (see Section 2.4).

Let us now illustrate in Fig. 2 the stability measure γ\gamma obtained using our method with N=5000N=5000, η=2k\eta=2k and J=20J=20: the global maximum correctly detects k=10k=10 and Fig. 1 (right) shows one recovered labeling for k=10k=10.

We compare our method vs. classical spectral clustering in Figure 3 in terms of performance and time of computation. We note that for η=2k\eta=2k and η=3k\eta=3k, our method performs as well as the classical algorithm; while for η=k\eta=k, on the other hand, the number of random signals becomes insufficient as we observe the recovery starting to fail. Up to N≃4.104N\simeq 4.10^{4}, the computation time is slightly faster with the classical algorithm. But as NN increases, the classical algorithm’s computing time increases significantly faster than our proposition’s: for N=105N=10^{5} for instance, computation time is 2 (resp. 2.5, 3) times faster when one uses η=3k\eta=3k (resp. 2k2k, kk) random signals than the classical algorithm.

Conclusion

We propose a new method that paves the way to alternative spectral clustering methods bypassing the usual computational bottleneck of extracting the Laplacian’s first kk eigenvectors. We take advantage of the fast graph low-pass graph filtering of a few random vectors to estimate the spectral clustering distance. The use of random vectors makes our algorithm stochastic, which in turn enables us to define a stability measure γ\gamma for any kk: scales of interest maximize γ\gamma. Results on synthetic data show that our method is scalable and for η≳k\eta\gtrsim k, one has the same performance as with the classical spectral algorithm while reducing the time complexity by a few factors.

We prooved that the error on the estimation of the distance DijD_{ij} is well controlled, but the question of how such an error propagates on the estimation of the clusters themselves is open. Moreover, the impact of the error δ\delta of the polynomial approximation on the rest of the algorithm is still largely unknown and matter of future work.

References