我正在经历k-means 维基百科页面 http://en.wikipedia.org/wiki/K-means_clustering。根据算法,我认为复杂度是O(n*k*i)
(n
= 总元素,k
= 簇迭代次数)
那么有人可以向我解释一下维基百科上的这个说法以及这个 NP 有多难吗?
If k
and d
(the dimension) are fixed, the problem can be exactly solved in time O(ndk+1 log n)
, where n
is the number of entities to be clustered.
这取决于你叫什么k-means.
寻找全局最优值的问题k-means https://en.wikipedia.org/wiki/K-means_clustering目标函数
is NP-hard, where Si
is the cluster i
(and there are k
clusters), xj
is the d
-dimensional point in cluster Si
and μi
is the centroid (average of the points) of cluster Si
.
但运行固定次数t
的迭代次数标准算法 https://en.wikipedia.org/wiki/Lloyd%27s_algorithm只需要O(t*k*n*d)
, for n
(d
-维)点,其中k
是质心(或簇)的数量。这就是实际实现所做的(通常在迭代之间随机重新启动)。
标准算法仅逼近上述函数的局部最优,所有的算法也是如此k- 表示我见过的算法。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)