Raw agreement can mislead. Two annotators who label 90 percent of items "not spam" will agree about 80 percent of the time just by chance. Cohen's kappa measures agreement beyond chance: it compares observed agreement with the agreement you would expect if both sides labeled independently with their own class frequencies.
Implement cohens_kappa(y_true, y_pred) for any number of classes.
1.0.ValueError.Open one at a time. Each gives away a little more than the last.
Use np.unique on the concatenation of both arrays so both marginals share one label set.
For each label c, the marginal fraction in y_true is np.mean(y_true == c). Multiply it by the same fraction from y_pred and sum over labels.
No results yet
Run your code to check it against the examples, or submit to run every test.