Matlab language to realize spectral clustering algorithm, the code is as follows:
The function C=spectralCluster (S, num_clusters)
M=size (S, 1);
D=full (sparse (1: m, 1: m, the sum (S)));
L=eye (m) - (D ^ ^ (1/2) * S * D (1/2));
[V, ~]=eigs (L, num_clusters, 'SM');
C=kmeans (V, num_clusters);
End
An error is as follows:
Guide for bosses,