値の一般化
4 views (last 30 days)
Show older comments
以下のプログラムで値を一般化しクラスに分類しプロットしたですが、一般化がうまくできていいないようなのですが何かアドバイス頂けると幸いです。
xfilename =('average.txt');
x = load(xfilename);
yfilename =('variarance.txt');
y = load(yfilename);
a=15;
rng default;
X = [x;y];
X = reshape(X,10368,2);
%NX = normc(X);
opts = statset('Display','final');
[idx,C] = kmeans(X,2,'Distance','cityblock','Replicates',5,'Options',opts);
plot(X(idx==1,1),X(idx==1,2),'r.','MarkerSize',12);
hold on;
plot(X(idx==2,1),X(idx==2,2),'b.','MarkerSize',12);
%plot(X(idx==3,1),X(idx==3,2),'g.','MarkerSize',12);
plot(C(:,1),C(:,2),'kx','MarkerSize',15,'LineWidth',3);
legend('Cluster 1','Cluster 2','Centroids','Location','NW');
title 'Cluster Assignments and Centroids';
hold off;
2 Comments
Image Analyst
on 28 Oct 2016
I don't know what the question is, but you forgot to attach 'average.txt' and 'variarance.txt' so we can't run your code.
michio
on 28 Oct 2016
「一般化」とはどういう処理のことでしょうか。 できれば回答者が現象を再現できる形でのコード・ファイルを提供していただいて、具体的にどううまくできていないのか、どういう結果を求めていらっしゃるのかを指示頂けますと回答も得られやすいかと思います。 お手数かとは思いますがよろしくお願いします。
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Statistics and Machine Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!