cohen_kappa#
- scikitplot.corpus.cohen_kappa(rater_a, rater_b, *, labels=None, weights=None)[source]#
Cohen’s kappa between two raters of the same items.
- Parameters:
- rater_a, rater_bsequence
One label per item, in the same item order; no missing values.
- labelssequence or None, default=None
Label order (it matters for weights);
Nonesorts the labels seen.- weights{None, “linear”, “quadratic”}, default=None
Disagreement weights: none (each disagreement counts 1),
|i - j|or(i - j) ** 2over label positions.
- Returns:
- float
NaN(with a warning) when chance agreement is already perfect.
- Raises:
- ValueError
For different lengths, no items, missing values or an unknown weight.
- Parameters:
- Return type:
Examples
>>> round(cohen_kappa(["a", "b", "a"], ["a", "b", "b"]), 4) 0.4