Cohen Kappa Score - Unofficial Python Implementation using matrix multiplication
The kappa score is used to compare more accurate performance on nominal and ordinal scales.
I inspired by 데이터마이닝에서 Cohen의 kappa를 이용한 분류정확도 측정. More information about the formula can be found here.
I wrote about the implementation on my blog.
pred = [0, 0, 0, 1, 1, 1, 2, 2, 2, 2]
label = [0, 0, 1, 2, 0, 1, 0, 0, 1, 2]
calculate_kappa_score(pred, label) # kappa score
calculate_kappa_score(pred, label, 'linear') # linear weighted kappa score
calculate_kappa_score(pred, label, 'quadratic') # quadratic weighted kappa score