MATLAB: Rectify error in kmeans

errormammogram

i wanted to do kmeans clustering in mammogram image…. i took the datavector of the image and gave as input to kmeans…. when i execute the code error is displayed as…."An empty cluster error occurred in every replicate."…. what should i do to rectify this error….

Best Answer

The kmeans function has an option 'EmptyAction' that you could try. With this option you can request that, if a cluster becomes empty, the function either accept a smaller number of clusters or create a new one from a point that is relatively far from the others.