NumPy allowed · plain Python earns 10 bonus points
Implement Cohen's Kappa, the real, standard statistic for measuring agreement between two evaluators (human or LLM-judge) beyond what chance alone would predict.
Implement cohens_kappa(rater_a, rater_b). Observed agreement p_o = fraction where rater_a[i] == rater_b[i]. Expected agreement p_e = sum(freq_a[c] * freq_b[c] for c in categories), where freq_a[c]/freq_b[c] are each rater's fraction of ratings equal to category c. Kappa = (p_o - p_e) / (1 - p_e). Return 1.0 if p_e == 1.
cohens_kappa(rater_a: list[str], rater_b: list[str]) -> float