Spectral Clustering Introduction:
This blog for the introduction of spectral clustering, including formula derivation is quite in place, then the class ppt is cut this figure, so can understand the words pretty good. http://www.cnblogs.com/FengYan/archive/2012/06/21/2553999.html Algorithm python implementation:
For the derivation of the formula what the individual understanding is not very deep, the following directly say the implementation of the algorithm bar:
First, because this algorithm is actually called the spectral method, for community mining or map mining, so to use in the cluster, you need a thing to directly connect to the sample, to achieve a similar diagram of the structure, here using KNN, is the former K neighbors have connectivity, others do not. So we can get the matrix W, however, there is a small problem, point a K nearest neighbor has B, but B's K nearest neighbor may be without a, this time, in order to let the Matrix W is a symmetric matrix, we adopt one or the principle, will w= (W+WT)/2 w= (w+w^t)/2, This will get a symmetric similarity matrix.
The second step is very simple, calculate the degree of each node, get the Matrix D.
To get the Laplace matrix L=d−w l=d-w, very simple, do not paste code.
Obtains the characteristic matrix of the Laplace Matrix L, which is good with the built-in function.
After obtaining the feature matrix, we use the Kmeans method to cluster the feature matrix, each feature vector is a column of the feature matrix, and each row is a cluster sample. Such a cluster is the ultimate achievement. For the sake of illustration, I use the Kmeans function in Sklearn directly here to invoke:
OK, here is basically done, the classification has been basically completed, and finally a wave of visualization, to see our experimental results, because the spectral cluster can be clustered on the spherical data, so we directly to try the spherical dataset:
Nice, it looks good.
All right, here's the experiment.
Full code Address: github/pp8818 Remember to star Oh ~ ~