Sub topic 15
Analyzing Disagreements
This chapter assumes you can compute Cohen's kappa and Fleiss' kappa for categorical labels, and that you have a pilot round with at least two annotators. A kappa score tells you how much annotators disagree. It does not tell you why. This chapter covers how to find the cause and what to change.
Why a score is not a diagnosis
A kappa of 0.55 could come from many different problems:
- Two labels in the schema overlap.
- The guidelines are silent about a common case.
- One annotator misread an instruction.
- The texts themselves are ambiguous.
Each cause has a different fix. Retraining annotators will not repair a schema with overlapping labels, and rewriting the schema will not repair a careless annotator. Disagreement analysis separates these causes before you spend effort on any of them.
Step 1: List the disagreements and count label pairs
Start with the raw disagreements, then count which pairs of labels are confused. This reuses the sentiment data from the kappa chapters, with a text for each item.
from collections import Counter
texts = [
"Great phone, love the screen.",
"Battery is fine, I guess, if you charge it twice a day.",
"Arrived broken.",
"Does not work as advertised.",
"Best purchase this year.",
"It is a phone.",
"Support never replied.",
"Camera is excellent.",
"Delivery was on time.",
"Screen cracked after a week.",
]
ann1 = ["pos", "pos", "neg", "neg", "pos", "neu", "neg", "pos", "neu", "neg"]
ann2 = ["pos", "neg", "neg", "neg", "pos", "neu", "neg", "pos", "pos", "neg"]
disagreements = [
(i, t, a, b)
for i, (t, a, b) in enumerate(zip(texts, ann1, ann2))
if a != b
]
for i, t, a, b in disagreements:
print(i, a, b, t)
pairs = Counter(tuple(sorted((a, b))) for _, _, a, b in disagreements)
for pair, n in pairs.most_common():
print(pair, n)This prints two disagreeing items (index 1, pos versus neg, and index 8, neu versus pos) and one count for each of the pairs ('neg', 'pos') and ('neu', 'pos'). In a real pilot you would have dozens of disagreements. The most frequent pair tells you where to look first.
The confusion matrix from the earlier chapter gives the same information with direction. Rows are annotator 1 and columns are annotator 2:
| Annotator 1 \ Annotator 2 | pos | neu | neg |
|---|---|---|---|
| pos | 3 | 0 | 1 |
| neu | 1 | 1 | 0 |
| neg | 0 | 0 | 4 |
Compare the cells above and below the diagonal. In a symmetric pattern, both annotators confuse the labels in both directions, which usually points to ambiguous items or a vague boundary. In an asymmetric pattern, one annotator systematically picks one label where the other picks another. That points to annotator bias. Here the one neu/pos disagreement is below the diagonal and has no mirror, which hints that annotator 2 reads neutral facts such as on-time delivery as positive. Hints from ten items are only hints. You need enough disagreements for a pattern to mean something.
Step 2: Read the items and assign a cause
Counts point to where the problems are. Reading tells you what they are. Sample 30 to 50 disagreements, or all of them if there are fewer, and assign each one a cause. Keep the categories few and write the definitions down so two reviewers would sort items the same way.
| Cause | Typical signature | Usual fix |
|---|---|---|
| Guideline gap | The guidelines do not cover the case, such as sarcasm or mixed sentiment | Add a rule and an example |
| Schema overlap | The same two labels are confused across many different texts | Merge, split, or redefine labels |
| Ambiguous text | Reasonable readers differ even with the guidelines in hand | Keep as ambiguous, or add context |
| Annotator error | A clear slip, with the other annotator clearly right | Feedback, spot checks |
| Annotator bias | Asymmetric confusions concentrated in one annotator | Calibration session |
| Genuine subjectivity | The task asks for opinion, such as toxicity or humor | Accept variation, keep multiple labels |
Item 1 above ("Battery is fine, I guess, if you charge it twice a day.") is a guideline gap about sarcasm. The surface wording is positive and the intent is negative. A rule such as "label the intended sentiment, not the literal words" plus this example resolves it. Item 8 is a schema or guideline question: does a neutral statement of a good fact count as pos or neu?
Step 3: Find the hard items and the odd annotator
With more than two annotators, compute agreement per item and per annotator. The per-item score below is the same quantity that Fleiss' kappa averages, which is the fraction of annotator pairs that agree on that item.
from collections import Counter
ratings = [
[0, 0, 0],
[0, 1, 0],
[1, 1, 1],
[2, 2, 1],
[0, 0, 0],
[1, 1, 2],
]
def item_agreement(row):
n = len(row)
counts = Counter(row)
return (sum(c * c for c in counts.values()) - n) / (n * (n - 1))
scores = sorted((item_agreement(r), i) for i, r in enumerate(ratings))
for score, i in scores:
print(i, round(score, 3), ratings[i])
for j in range(3):
print("annotator", j, sorted(Counter(r[j] for r in ratings).items()))Items 1, 3 and 5 score 0.333 (two annotators agree, one differs) and come first in the output. Review these before any item that scored 1.0. The second loop prints each annotator's label distribution. Annotator 1 uses label 1 three times, and the other two use it twice. A gap that small proves nothing on six items. On a real pilot, a consistent gap in label rates for one annotator is the signal to check for bias.
Edge cases and common errors
- High agreement, low kappa. If one label dominates, observed agreement can be 0.95 while kappa is low, because chance agreement is also high. Disagreements are then concentrated on the rare label, so analyze those items first. They are often the items you care about most.
- Too few disagreements. With under about 20 disagreements, categories are unstable. Annotate more pilot items before concluding that a cause is dominant.
- Overfitting guidelines to the pilot. If you add a rule for every pilot disagreement, agreement on those items will rise, but the improvement may not carry over. Test the revised guidelines on a fresh sample.
- Treating all disagreement as error. In subjective tasks, disagreement carries information. Forcing consensus can hide real variation in how people read the text.
- Blaming annotators for schema problems. If both annotators are careful and still split on the same pair across many texts, the schema is the cause.
- Changing the schema mid-annotation. Relabeling after a schema change can leave you with items labeled under different rules. Version the guidelines and record which version each item was labeled under.
What to record
For each analysis round, save the confusion pairs, the cause categories with counts, the guideline changes you made, and the agreement before and after on a fresh sample. This record feeds the adjudication step and the quality report later in the tutorial.
Exercise
Annotator 1 labels 12 items "neu" that annotator 2 labels "pos", and only 1 item the other way around. Overall kappa is 0.58. What does this pattern suggest, and what would you do before changing the guidelines?
Show answer
The asymmetry suggests annotator bias rather than a vague boundary: annotator 2 tends to read neutral statements as positive, or annotator 1 under-uses "pos". Read a sample of the 12 items to check whether they share a feature, such as factual statements about good outcomes. If they do, add a guideline rule with examples. If they do not, hold a calibration session with both annotators, then annotate a fresh sample to check that the asymmetry shrinks.
Exercise
A pilot has 95% observed agreement and a kappa of 0.40, with 94% of items labeled "none". Where should disagreement analysis focus?
Show answer
On the items where at least one annotator used a label other than "none". High prevalence of one label makes chance agreement large, so kappa is low even though most items match. The few non-"none" items carry the real task difficulty, and nearly all disagreements are there, so reading those items shows which cases the guidelines fail to cover.