How can I let function 'kmeans' run reliably?

1 view (last 30 days)
I am trying to cluster data. The data variable is 'DailyValue'. The dimension of it is 367*48. I use a for loop to run 'kmeans' for each column. The group number K I set is 9. Sometimes, kmeans returned results. Othertimes, I was given Error message like:
[idx c] = kmeans(DailyValue(:,1),9); Error using kmeans/loopBody/batchUpdate (line 453) Empty cluster created at iteration 1.
Error in kmeans/loopBody (line 378) converged = batchUpdate();
Error in internal.stats.parallel.smartForReduce (line 128) reduce = loopbody(iter, S);
Error in kmeans (line 296) ClusterBest = internal.stats.parallel.smartForReduce(...
Anyone can solve it, please?

Accepted Answer

Walter Roberson
Walter Roberson on 20 Mar 2014
Look at the documentation page, at the 'emptyaction' option.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!