具有稳定结果的 k-原型
k-prototypes with stable results
我正在使用基于 python 的 k 模式包中的 k 原型。
作为 K-means,[k-prototypes] 每次输出不同的结果。
在 K-modes 中,我们可以设置 random_state 以获得稳定的结果,我如何对 k-prototypes 做同样的事情?
在这个函数调用中,init
参数可以是huang
、cao
和random
:
def k_prototypes_single(Xnum, Xcat, nnumattrs, ncatattrs, n_clusters, n_points,
max_iter, num_dissim, cat_dissim, gamma, init, init_no,
verbose, random_state):
将其更改为 random
以外的任何内容可能会有帮助。
另一方面,np.random.seed(42)
也可能有帮助,因为作者很可能使用 np.random()
我正在使用基于 python 的 k 模式包中的 k 原型。 作为 K-means,[k-prototypes] 每次输出不同的结果。
在 K-modes 中,我们可以设置 random_state 以获得稳定的结果,我如何对 k-prototypes 做同样的事情?
在这个函数调用中,init
参数可以是huang
、cao
和random
:
def k_prototypes_single(Xnum, Xcat, nnumattrs, ncatattrs, n_clusters, n_points,
max_iter, num_dissim, cat_dissim, gamma, init, init_no,
verbose, random_state):
将其更改为 random
以外的任何内容可能会有帮助。
另一方面,np.random.seed(42)
也可能有帮助,因为作者很可能使用 np.random()