[scikit-learn] Calculate cohen_kappa_score class wise?

Pavel G. pavelgus at protonmail.com
Wed Dec 18 11:07:34 EST 2019


Hi sklearn developers ans users,

The cohen_kappa_score calculates overall score for all classes.

y_true = [0, 1, 2, 2, 2]
y_pred = [0, 0, 2, 2, 1]
target_names = ['class 0', 'class 1', 'class 2']
from sklearn.metrics import cohen_kappa_score
print (cohen_kappa_score(y_true, y_pred))
0.375

How can I calculate cohen_kappa_score class wise, like the classification_report does.

I hope someone can help me.
Thank you.

Pavel G.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-learn/attachments/20191218/0eb39a6f/attachment.html>


More information about the scikit-learn mailing list