Evaluating K means clustering using python
Question: I have a data set slightly similar like this:

![enter image description here](http://i.stack.imgur.com/ss0GM.png)

I have performed **K means clustering** using this code:

    
    
    from scipy.cluster.vq import kmeans, vq
    data=np.matrix(dataAll.ix[:,:-1])
    centers, _ = kmeans(data, 3, iter=100)
    cluster, _ = vq(data, centers)
    

In here I want to ask how to evaluate **k means clustering**. I want to get
value such as precision, accuracy, **f measure**.


Answer: If you have the Gold standard/Ground truth values, you can use my code
[**[Link](https://sutanto.org/pairwise-fscore-nmi/)**] to calculate pairwise
precision, recall, FScore & NMI.

Notes, that the article is in Indonesian language, but don't worry you can
skip all of the explanations and go straight to the code at the bottom of the
article. [I wrote Matlab & Python implementation] The python code is a fork of
**[this work](http://eprints.qut.edu.au/60711/)** that is available
**[here](http://greententacle.techfak.uni-
bielefeld.de/reseed/reseed_eval.py)**.

