Classification
Cohen's kappa
Implemented
classification.cohen_kappaDefinition
Agreement between predicted and true labels corrected for agreement expected by chance.
Formula
κ = (pₒ − pₑ) / (1 − pₑ)
Range: [−1, 1]
Inputs and outputs
- y_true: array of class labels
- y_pred: array of predicted labels
Returns: float
Assumptions
No assumptions beyond valid, aligned inputs of the documented types.
Limitations
- Depends on the marginal distributions, so values are hard to compare across datasets with different prevalence.
Python API
import evalsuite as es
es.cohen_kappa(y_true, y_pred, weights="quadratic")References
- Cohen, J. (1960). A coefficient of agreement for nominal scales. Educational and Psychological Measurement, 20(1), 37–46.