poster
2019-12-10, 16:49
我有一个矩阵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));
更多&回答... (https://stackoverflow.com/questions/1373516)
[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));
更多&回答... (https://stackoverflow.com/questions/1373516)