Worked tutorial · about 45 minutes
Measure label agreement before resolving disagreements
Build a three-label agreement matrix for twelve fictional messages, calculate Cohen's kappa, and preserve the original judgments through a worked adjudication.
Original editorial exercise · fictional practice data · checked 25 October 2026
A tidy final label file can conceal uncertainty in the task definition. This exercise starts with two annotation columns for twelve short messages. You will measure their agreement before resolving any differences, then record final labels and rubric clarifications separately.
The messages, annotator A and B columns, and final decisions are invented editorial examples. They are not judgments collected from real independent reviewers. The exercise demonstrates the arithmetic and recordkeeping; it measures no person's skill or production dataset quality.
1. Read the task definition before the labels
The intended use is to identify messages that ask their current recipient to carry out a task. Use three labels:
action: a current action request with enough information to identify the task.information: a statement or informational question without a current action request.unclear: missing context prevents choosing between the other labels, or leaves the requested task unidentified.
Read each message in isolation, with no preceding conversation. Avoid supplying a missing object or assuming that a reported instruction is being issued again. Question marks alone do not decide whether a message requests an action.
id,text,annotator_a,annotator_b
L01,Send the attendance sheet to Mira.,action,action
L02,Book Room C by Friday.,action,action
L03,Please replace the faded sign.,action,action
L04,Bring the borrowed projector back.,action,action
L05,Could you send the receipt?,action,information
L06,Can the room be opened?,action,unclear
L07,The session starts at 15:00.,information,information
L08,The projector arrived yesterday.,information,information
L09,The sign is now blue.,information,information
L10,"Mira reported that Leo said, ""Send the sheet.""",information,action
L11,Room C?,unclear,information
L12,Can you handle it?,unclear,unclear
Before looking at the worked adjudication, list the IDs where A and B differ. Preserve both original columns. In a real annotation round, collect independent labels before reviewers discuss their decisions.
2. Build the agreement matrix
Use A's labels for rows and B's labels for columns. Put each message in one cell. Diagonal cells contain agreements; off-diagonal cells contain disagreements. Include all three labels even if a cell is zero.
Show the complete matrix
| A / B | Action | Information | Unclear | A total |
|---|---|---|---|---|
| Action | 4 | 1 | 1 | 6 |
| Information | 1 | 3 | 0 | 4 |
| Unclear | 0 | 1 | 1 | 2 |
| B total | 5 | 5 | 2 | 12 |
The diagonal is 4 + 3 + 1 = 8 agreements. The four disagreements are L05, L06, L10 and L11. A uses the labels 6/4/2 times; B uses them 5/5/2 times. The two reviewers' marginal totals are different and must be retained separately.
3. Calculate observed agreement and Cohen's kappa
Observed agreement, po, is 8/12 = 2/3 ≈ 66.7%. Cohen's kappa adjusts this by an expected agreement value, pe, calculated from the two sets of label proportions.
For these three labels, pe = (6/12 × 5/12) + (4/12 × 5/12) + (2/12 × 2/12) = (30 + 20 + 4) / 144 = 3/8 = 37.5%.
Then κ = (po − pe) / (1 − pe) = (2/3 − 3/8) / (1 − 3/8) = 7/15 ≈ 0.467. The expected value is a calculation from label marginals, not a measured rate of reviewers guessing or a probability that a particular label is correct.
Keep the matrix and sample size alongside the coefficient. Kappa describes agreement under its calculation; it does not identify the correct annotator or prove that shared labels are right. Both reviewers could make the same mistake. This exercise assigns no universal quality rating to 0.467.
python check_agreement.py annotations.csv adjudication.csv Save all four downloads together. The optional Python 3 checker prints the original matrix, exact fractions and final-label counts. It uses the standard library and reads both files without changing them. It checks label values and ID coverage, but cannot judge the meaning of a message or the validity of an adjudicator's reason.
Show the complete checker
"""Tally fictional original labels separately from worked adjudication labels."""
import argparse
import csv
import json
from collections import Counter
from fractions import Fraction
from pathlib import Path
LABELS = ('action', 'information', 'unclear')
def read_csv(path):
with Path(path).open(encoding='utf-8-sig', newline='') as handle:
return list(csv.DictReader(handle))
def validate_ids(rows):
ids = [row['id'] for row in rows]
if not ids or len(ids) != len(set(ids)) or any(not item for item in ids):
raise ValueError('IDs must be nonempty and unique.')
return set(ids)
def evaluate(annotation_path, adjudication_path):
rows = read_csv(annotation_path)
ids = validate_ids(rows)
final = read_csv(adjudication_path)
if validate_ids(final) != ids:
raise ValueError('Adjudication must contain exactly the original case IDs.')
for row in rows:
if row['annotator_a'] not in LABELS or row['annotator_b'] not in LABELS:
raise ValueError('Every original label must be action, information, or unclear.')
if any(row['final_label'] not in LABELS or not row['reason'].strip() for row in final):
raise ValueError('Each final label needs a valid label and a written reason.')
count = len(rows)
matrix = {a: {b: 0 for b in LABELS} for a in LABELS}
a_counts = Counter(row['annotator_a'] for row in rows)
b_counts = Counter(row['annotator_b'] for row in rows)
for row in rows:
matrix[row['annotator_a']][row['annotator_b']] += 1
agreements = sum(matrix[label][label] for label in LABELS)
observed = Fraction(agreements, count)
expected = sum((Fraction(a_counts[label] * b_counts[label], count * count)
for label in LABELS), Fraction())
kappa = (observed - expected) / (1 - expected) if expected != 1 else None
final_by_id = {row['id']: row['final_label'] for row in final}
final_counts = Counter(final_by_id.values())
return {
'scope': 'Fictional annotation columns, not collected human agreement or accuracy.',
'cases': count,
'label_order': list(LABELS),
'original_matrix_rows_a_columns_b': matrix,
'a_marginals': {label: a_counts[label] for label in LABELS},
'b_marginals': {label: b_counts[label] for label in LABELS},
'original_agreements': agreements,
'original_disagreement_ids': sorted(row['id'] for row in rows if row['annotator_a'] != row['annotator_b']),
'observed_agreement_exact': str(observed),
'observed_agreement_percent': float(observed * 100),
'expected_agreement_exact': str(expected),
'cohen_kappa_exact': None if kappa is None else str(kappa),
'cohen_kappa_decimal': None if kappa is None else float(kappa),
'worked_adjudication': {
'final_counts': {label: final_counts[label] for label in LABELS},
'differs_from_a_ids': sorted(row['id'] for row in rows if final_by_id[row['id']] != row['annotator_a']),
'differs_from_b_ids': sorted(row['id'] for row in rows if final_by_id[row['id']] != row['annotator_b']),
'independent_post_adjudication_agreement': None,
},
}
if __name__ == '__main__':
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('annotations')
parser.add_argument('adjudication')
args = parser.parse_args()
try:
print(json.dumps(evaluate(args.annotations, args.adjudication), indent=2))
except (ValueError, KeyError, OSError) as exc:
parser.exit(2, f'Input error: {exc}\n')
4. Resolve the four disputes with explicit rules
Adjudication here means reviewing the disputed examples and recording a final decision with its reason. These are proposed exercise decisions, not findings from an independent human review. Make your own attempt, then compare it with the worked plan.
Show the worked adjudication
- L05 → action. “Could you send the receipt?” is a conventional polite request with an identifiable task. Clarify that an interrogative form can still request an action.
- L06 → unclear. “Can the room be opened?” could ask about capability or request that someone open it. The missing context prevents choosing confidently. Preserve uncertainty rather than inventing a preceding conversation.
- L10 → information. The current message reports Leo's earlier words. Under this exercise's policy, a reported imperative does not become a new action request unless the current speaker adopts it.
- L11 → unclear. “Room C?” is a fragment. It could confirm a location, propose a booking, or ask something else. The message alone does not establish the intent.
The other eight labels remain as originally agreed. The final counts are 5 action, 4 information and 3 unclear. Relative to A, the worked plan changes L06. Relative to B, it changes L05, L10 and L11. The complete downloadable adjudication records a reason for every final label.
For another task, quoted requests might deliberately count as actions, or extra conversational context might resolve L06. That would change the labeling policy or available evidence. Write the revised rule, version it and apply it consistently to every affected example rather than changing only the disputed row.
5. Evaluate the revised rubric in a new round
Copying the final labels into both annotator columns would manufacture 100% agreement by construction. Keep the original 8/12 and kappa 7/15 as the result of this fictional first round. The checker leaves independent post-adjudication agreement null, because no new independent round exists.
In a real follow-up, use fresh cases covering polite requests, capability questions, quoted instructions and fragments. Have reviewers label them independently using the clarified rubric before discussion. Report disagreements as well as totals, retain the rubric version, and distinguish missing labels from an explicit unclear judgment.
If both columns assign the same single label to every case, observed agreement is 100% and the calculated expected agreement is also 100%; kappa then has a zero denominator. The checker reports null for that undefined coefficient. It does not substitute a perfect kappa score.
To apply a rubric to answer quality, try the retrieved-answer audit. To compare system changes after labels are settled, use the paired prompt comparison. For a smaller source-checking task, start with the office checklist exercise.
Sources and scope
The scikit-learn Cohen's kappa reference gives the coefficient and its expected-agreement calculation from per-annotator label proportions. Checked 25 October 2026. The messages, original labels, task policy, adjudication and code are our editorial exercise. Agreement and adjudication are not substitutes for validating labels against the intended real-world task.