Understanding Cohen's Kappa

The Paradox of High Agreement
Two radiologists review 100 chest X-rays, classifying each as "Normal" or "Abnormal." They agree on 90 X-rays—90% agreement! Time to celebrate?
Not quite. Here's the catch: 85 of those X-rays were obviously normal, and both radiologists marked them as such. They're agreeing on the easy cases. On the 15 ambiguous cases, they only agreed on 5.
Raw agreement conflates skill with task difficulty. If 95% of your data falls into one category, two raters who match that base rate while guessing will "agree" about 90% of the time by accident.
Enter Cohen's Kappa
Jacob Cohen's insight (1960) was to ask: how much better is our agreement than random chance?
Symbol guide:
- κ (kappa) — the agreement coefficient we're computing (range: -1 to 1)
- p_o — observed agreement — actual proportion of items where both raters agreed
- p_e — expected agreement — agreement we'd expect by pure chance
- 1 - p_e — maximum possible improvement over chance
Think of it as measuring the "improvement over guessing":
- : Perfect agreement—raters always agree
- : Agreement equals chance—no better than random
- : Worse than chance—systematic disagreement
The 2×2 Contingency Table
Kappa is computed from a simple table counting agreements and disagreements:
| Rater B: Yes | Rater B: No | |
|---|---|---|
| Rater A: Yes | (both yes) | (A yes, B no) |
| Rater A: No | (A no, B yes) | (both no) |
Observed agreement:
Expected agreement: If raters were independent:
This accounts for the marginal distributions—if Rater A says "Yes" 80% of the time and Rater B says "Yes" 70% of the time, we'd expect them to both say "Yes" about 56% of the time by chance.
A Worked Example
You're validating an LLM judge against a human reviewer. Both label the same 50 responses as Pass or Fail:
| Judge: Pass | Judge: Fail | |
|---|---|---|
| Human: Pass | 18 | 4 |
| Human: Fail | 6 | 22 |
Step 1 — observed agreement. They agree on responses: .
Step 2 — the marginals. The human says Pass times; the judge, times.
Step 3 — expected agreement.
Two raters with these base rates would agree half the time with zero skill.
Step 4 — kappa.
The 80% headline becomes "moderate, brushing substantial." The judge captured about 60% of the headroom that chance left available—useful, but not the near-perfect proxy the raw number implied.
Try It Yourself
Drag the raters to see how their positions affect Kappa. Notice how the class imbalance (controlled by the "Base rate" slider) changes what counts as "chance agreement."
| B: Yes | B: No | |
|---|---|---|
| A: Yes | 53 | 0 |
| A: No | 0 | 47 |
Experiments to try:
- Set base rate to 50% (balanced classes). Even modest agreement yields decent Kappa.
- Set base rate to 90%. Now watch Kappa plummet even with high raw agreement—the raters are mostly agreeing on obvious cases.
- Make both raters biased in the same direction. High agreement, but is it meaningful?
Your Turn
Fresh counts each time, same four moves as the worked example: agreements, marginals, the chance floor, then κ. If you get stuck, help escalates gently—a nudge first, then the setup with your numbers plugged in, and only then the full answer.
Practice problem
Moderation Queue
| Trainee moderator: Approve | Trainee moderator: Remove | |
|---|---|---|
| Senior moderator: Approve | 21 | 7 |
| Senior moderator: Remove | 5 | 17 |
n = 50 posts
Why Kappa Can Be Misleading
The Prevalence Problem
When one category dominates, Kappa can be counterintuitively low despite high agreement. With 95% base rate:
- Raw agreement might be 94%
- But chance agreement is ~90%
- So — only "fair" agreement!
This isn't a bug—it's revealing that most of your "agreement" comes from the easy majority class.
The Bias Problem
If both raters have the same bias (e.g., both tend to say "Yes"), Kappa will be higher than if they have opposite biases—even if their accuracy is identical.
Interpretation Guidelines
Landis & Koch (1977) proposed these benchmarks:
| Interpretation | |
|---|---|
| < 0.00 | Poor (worse than chance) |
| 0.00–0.20 | Slight |
| 0.21–0.40 | Fair |
| 0.41–0.60 | Moderate |
| 0.61–0.80 | Substantial |
| 0.81–1.00 | Almost perfect |
Caution: These thresholds are context-dependent. A Kappa of 0.60 might be excellent for a subjective task (rating "creativity") but unacceptable for a safety-critical classification.
Kappa vs Krippendorff's Alpha
| Feature | Cohen's Kappa | Krippendorff's Alpha |
|---|---|---|
| Number of raters | 2 only | Any number |
| Missing data | Not allowed | Handles gracefully |
| Data types | Nominal (extensions exist) | Nominal, ordinal, interval, ratio |
| Use case | Simple pairwise agreement | Complex annotation projects |
Rule of thumb: Use Kappa for quick two-rater sanity checks. Use Alpha for serious annotation quality measurement.
Code
from sklearn.metrics import cohen_kappa_score
rater_a = [1, 1, 0, 1, 0, 0, 1, 1, 0, 1]
rater_b = [1, 0, 0, 1, 0, 1, 1, 1, 0, 1]
kappa = cohen_kappa_score(rater_a, rater_b)
print(f"Cohen's Kappa: {kappa:.3f}")library(irr)
kappa2(data.frame(rater_a, rater_b))Further Reading
- Cohen, J. (1960). "A coefficient of agreement for nominal scales." Educational and Psychological Measurement
- Landis & Koch (1977). "The measurement of observer agreement for categorical data"
- Wikipedia: Cohen's kappa — good worked examples