MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   Matlab:K-均值聚类 (https://www.labfans.com/bbs/showthread.php?t=22765)

poster 2019-12-10 16:49

Matlab:K-均值聚类
 
我有一个矩阵A(369x10),我想将其集群为19个集群。我用这种方法

[idx ctrs]=kmeans(A,19) 产生idx(369x1)和ctrs(19x10)

我的意思是,我在A中的所有行都聚集在19个集群中。

现在我有一个数组B(49x10),我想知道这个B的行在给定的19个簇中对应的位置。

在MATLAB中怎么可能?

先感谢您


回答:
我想不出比您描述的更好的方法。内置函数可以节省一行,但我找不到。这是我要使用的代码:

[ids ctrs]=kmeans(A,19); D = dist([testpoint;ctrs]); %testpoint is 1x10 and D will be 20x20 [distance testpointID] = min(D(1,2:end));

[url=https://stackoverflow.com/questions/1373516]更多&回答...[/url]


所有时间均为北京时间。现在的时间是 01:11

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.