2011/11/7 SK Sn <[email protected]>:
> Hi all, I am looking into generating accuracy metrics of a classification,
> in the context of text classification.
>
> In API, there is no accuracy directly, I tried two things:
>
> 1: accuracy = np.mean(pred.ravel() == y_test.ravel())

This is the usual notion of accuracy. It coincides with our definition
of recall in the multi-class case, but not in the binary case:

In [1]: y_test = array([0,0,0,1,1,1,0,0,1])

In [2]: pred = array([1,0,0,0,1,1,0,0,1])

In [3]: recall_score(y_test, pred)
Out[3]: 0.75

In [4]: np.mean(pred == y_test)
Out[4]: 0.77777777777777779


-- 
Lars Buitinck
Scientific programmer, ILPS
University of Amsterdam

------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to