How to show class label of each data point in 3D scatter plot from clustering evaluation result?

1 次查看(过去 30 天)
How to show by plotting class label of each data point within each cluster obtained by any clustering?
Here is an illustration of kmeans clustering:
load fisheriris
eva = evalclusters(meas,'kmeans','gap','KList',[1:6])
scatter3(meas(:,1), meas(:,2), meas(:,3), 15, eva.OptimalY, 'filled')
So above example outputs 5 flusters which I can represent with colors. However, I will like to identify which data point fell into which cluster by putting label or coloring original data point (each data point represent an image).
Say, I pick cluster number 1. I can get the data indices within each cluster as follows:
find(eva.OptimalY == 1) % Here, we will get indices of all data points within
% cluster number 1
I will like to see (by plotting) which data points are within this cluster by class labels. So final output plot can have colored contours (circles) around each cluster, containing differently colored data points corresponding to their respective class labels.

回答(1 个)

Image Analyst
Image Analyst 2018-7-31
Use gscatter() instead of scatter3().
  4 个评论
hello_world
hello_world 2018-7-31
编辑:hello_world 2018-7-31
@Image Analyst: Yes, clustering part is done. Now, I need to identify each data point within it's cluster by class label so that I can show how good/bad clustering results are. So, for instance, given the indices of those data points within each cluster, I may trace back original data point and represent it on the gscatter plot by coloring it. By the way, it colors clusters not classes, that being said, we can not see if a colored cluster has data points from different classes (though we can know it by getting their indices as shown above in my example). In my example above, evalclusters found 5 optimal clusters and it colored them with 5 different colors. However, there are only 3 classes.

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by