[SciPy-User] [SciPy-user] different answers got from scipy.cluster.vq.kmeans

Keith Goodman kwgoodman at gmail.com
Tue Jul 19 17:48:56 EDT 2011


On Tue, Jul 19, 2011 at 2:37 PM, qingkunl <qingkunlqk at gmail.com> wrote:

> When I run scipy.cluster.vq.kmeans with exactly the same parameters passed
> to the function, I got different answers each time.
>
> I know they are all correct answers. But is there a way for me to get a
> deterministic answer?

>From the kmeans docstring:

k_or_guess: The initial k centroids are chosen by randomly selecting
observations from the observation matrix. Alternatively, passing a k
by N array specifies the initial k centroids.

For example:

    >>> kmeans(a, k_or_guess=a, iter=20, thresh=1e-5)



More information about the SciPy-User mailing list