spectralcluster error during kmeans for large number of clusters

4 views (last 30 days)
Hello, I made this call:
idx = spectralcluster(D,1000,'Distance','precomputed');
where size(D) = ~[14k,14k]. I get the error given below. When I greatly reduce the number of clusters (~30), the function runs successfully.
What can I do to get more clusters?
Error using kmeans (line 166)
Invalid data type. The first argument to KMEANS must be a real array.
Error in spectralcluster>clusterEigenvectors (line 191)
idx = kmeans(V,k,'Replicates',5);
Error in spectralcluster (line 179)
labels = clusterEigenvectors(Vnonan,k,clustMethod);

Answers (1)

Dheeraj Singh
Dheeraj Singh on 4 Nov 2019
For estimating the number of clusters, you can use the following Tips:
  1. Consider using spectral clustering when the clusters in your data do not naturally correspond to convex regions
  2. From the spectral clustering algorithm, you can estimate the number of clusters k as:
  • The number of eigenvalues of the Laplacian matrix that are equal to 0.
  • The number of connected components in your similarity graph representation. Use graph to create a similarity graph from a similarity matrix, and use conncomp to find the number of connected components in the graph.
Refer to the following link for an example:

Categories

Find more on Statistics and Machine Learning Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!