MATLAB: Clustering evaluation with Silhouette extremely slow

clustering evaluationkmeansperformancesilhouette

I am evaluating my kmeans clustering solutions using the built-in evalclusters function with Silhouette criterion:
eva = evalclusters(data,idx,'Silhouette');
Data size is 434874×4, tested on my laptop (core i7, 8GB RAM). I have been waiting for more than an hour but it still has not completed. Is there any way to boost the speed of Silhouette evaluation in Matlab?
Thanks a lot.

Best Answer

Your computer is not infinitely large or infinitely fast, unless of course, you are on TV or in the movies. Then anything is computable, merely by typing a few characters, and it will happen immediately, because who wants to wait for a few hours if they are watching a movie?
In real life, big problems take time. No matter how fast is your chosen algorithm, you can always throw more data at it than the algorithm is able to handle efficiently, no matter what is the algorithm. In real life, I don't know of anybody who does not want their code to execute more quickly.
There are a few simple choices to make here:
1. Learn patience, get some coffee and read a good book while you wait. Preferably one about MATLAB, or perhaps one about numerical methods in computing.
2. Find a seriously faster computer to use. This is never as cheap as you want.
3. Choose a different, more efficient algorithm. Different tools have different properties, but faster tools need not be always as good as others.
4. Learn enough about the methods that you can implement the algorithm EFFICIENTLY in a lower level language. Note that merely compiling your code from MATLAB is rarely going to give much of a speedup. That question gets asked on a weekly basis here.
5. Learn enough about parallel computing that you can take advantage of tools like the parallel computing TB. There are many issues here, and not all codes can be sped up.
Related Question