kmeans clustering on n*3 matrix
4 ビュー (過去 30 日間)
古いコメントを表示
I am evaluating an n*3 matrix using kmeans. The idx result which I get is only n*1. What does this mean? Is the algorithm only evaluating each column as separate observations?
0 件のコメント
回答 (2 件)
dpb
2018 年 7 月 9 日
>> help kmeans
kmeans K-means clustering.
IDX = kmeans(X, K) partitions the points in the N-by-P data matrix X
into K clusters. This partition minimizes the sum, over all clusters, of
the within-cluster sums of point-to-cluster-centroid distances. Rows of X
correspond to points, columns correspond to variables. ...
kmeans returns an N-by-1 vector IDX containing the cluster indices of each point.
...
Each row is a joint observation; how do you want the input array to be interpreted?
3 件のコメント
dpb
2018 年 7 月 9 日
編集済み: dpb
2018 年 7 月 10 日
Each row is then a RGB triplet, I gather? KMEANS will simply try to separate those based on a "distance" measure into non-overlapping groups based on solely that distance measure from the group centroid given an a priori number of groups.
It uses the three values to compute a single measure; there's no sense of 3D left for it to operate on.
I'm not enough of an image-processing type to have a more suitable algorithm otomh but I don't think this is what you're looking for...it should isolate areas of roughly the same hue/intensity, however, but it will do those globally throughout the image.
Image Analyst
2018 年 7 月 10 日
The output is the classified result. It will be a number 1, 2, or 3 depending on whether it thinks that row belongs to class 1, class 2, or class 3.
k-means is a lousy way to classify RGB images. Nonetheless, I attach a demo so you can see for yourself. Discriminant analysis is better and I also attach a demo for that.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Cluster Analysis and Anomaly Detection についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!