Initialization of the kmeans2 in python
Question: I am using `scipy.cluster.vq.kmeans2` which, by definition, initializes the
K-means randomly (given the pre-defined initialization method - random,
points).

Is there a way to make the initialization stable, i.e., for the same initial
centroids to obtain the same clustering results, but without using
`minit='matrix'`? I really don't know what the initial point are but I want
them to be the same for all simulations runs (e.g. for reproducible outputs).


Answer: You can seed the default numpy random number generator, for example:

    
    
    from numpy import random
    random.seed(123)
    

as shown in the last example
[here](http://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.cluster.vq.kmeans.html)
(which seems to be applicable to `kmeans2` as well).

