1

Suppose that we have a 64dim matrix to cluster, let's say that the matrix dataset is dt=64x150.

Using from vl_feat's library its kmeans function, I will cluster my dataset to 20 centrers:

[centers, assignments] = vl_kmeans(dt, 20);

centers is a 64x20 matrix.

assignments is a 1x150 matrix with values inside it.

According to manual: The vector assignments contains the (hard) assignments of the input data to the clusters.

I still can not understand what those numbers in the matrix assignments mean. I dont get it at all. Anyone mind helping me a bit here? An example or something would be great. What do these values represent anyway?

4

2 回答 2

8

在 k-means 中,您要解决的问题是将您的150点聚类为 20 个聚类的问题。每个点都是一个 64 维点,因此由一个大小为 64 的向量表示。所以在你的情况下dt是点集,每列是一个 64 维向量。

运行算法后,你得到centersassignmentscenters是集群中心在 64 维空间中的 20 个位置,如果您想将其可视化,请测量点和集群之间的距离等。另一方面,“分配”包含每个 64 维空间中的实际分配dt. 所以 if assignments[7]is15表示第 7 个向量dt属于第 15 个簇。

例如在这里你可以看到很多点的聚类,比如说2d成簇。在这种情况下,将是,将是,并且分配将是并且将持有从to (或to ,如果你正在使用)的数字10003dt2x1000centers2x31x10001302openCV

在此处输入图像描述

编辑:生成此图像的代码位于此处:http : //pypr.sourceforge.net/kmeans.html#k-means-example 以及有关 pyPR 的 kmeans 的教程。

于 2014-07-09T05:21:00.277 回答
0

在openCV中,它是每个输入点所属的簇的数量

于 2014-07-09T03:56:01.597 回答