http://css.dzone.com/articles/k-means-clustering-scipy
http://docs.scipy.org/doc/scipy/reference/generated/scipy.cluster.vq.kmeans.html
or
PyCluster http://bonsai.hgc.jp/~mdehoon/software/cluster/software.htm
which is documented here.
http://bonsai.hgc.jp/~mdehoon/software/cluster/cluster.pdf
or
http://scikit-learn.org/stable/install.html#macports
Choose which of the above implementations are easiest to use quickly.
http://scikit-learn.org/stable/tutorial/statistical_inference/unsupervised_learning.html#k-means-clustering
VERY SIMPLE K-MEANS IMPLEMENTATION above, i.e.
from sklearn import cluster, datasets
iris = datasets.load_iris()
X_iris = iris.data
Y_iris = iris.target
k_means = cluster.KMeans(n_clusters = 3)
k_means.fit(X_iris)
print k_means.labels_[::10]
print Y_iris[::10]
No comments:
Post a Comment