The interview problem

Practice prompt

Calculate Cohen's kappa for two annotators and explain why it is not a universal label-quality score.

Original practice, not a reported company interview. Scenarios and numbers are illustrative. Interview date: not applicable. Sources retrieved October 1, 2026.

1. Scope and worked approach

Assume the same items are independently labeled by two raters using the same categories. Compute observed agreement and expected agreement from the raters' empirical marginal label frequencies, then kappa=(observed−expected)/(1−expected). This is a specific chance baseline, not a measurement of objective correctness. Inspect the confusion table and prevalence alongside the summary.

2. Trace the design or derivation

Build rater table
  → compute marginals
  → calculate expected agreement
  → compare observed agreement

Report the underlying counts so readers can see which labels drive disagreement. If a rater almost never uses a rare category, an apparently acceptable aggregate can hide systematic failure on that category. Adjudication should investigate disputed cases and the labeling policy rather than assume the majority label is truth.

3. Calculate the example

Both raters label 50 of 100 items positive and agree on 80 items. Expected agreement is 0.5²+0.5²=0.5; kappa=(0.8−0.5)/(1−0.5)=0.6. Neither the 80% agreement nor kappa identifies which rater is correct.

4. Failure cases and trade-offs

Highly imbalanced prevalence can produce surprising kappa values. Shared systematic mistakes yield strong agreement but poor truthfulness. Weighted kappa may fit ordered labels but needs an explicit disagreement-cost scheme. Use adjudicated examples to investigate error patterns rather than ranking annotators by one scalar.

5. Validation, follow-ups and self-review

Construct a table with identical marginal frequencies but different diagonal counts. Follow-up: how would more than two raters change the analysis? Self-review: distinguish reliability, prevalence and validity.

Sources and related practice

Technical reference: scikit-learn.org — Observed versus marginal-chance agreement.

Source publication/update: Not established. Retrieved October 1, 2026. The workflow, calculations and review exercises are original; this reference is not evidence that a company asked this question.

Continue with Resolve inconsistent reviewer labels before retraining; Class imbalance and decision thresholds.

Continue your preparation

Choose a connected learning path or browse more ML fundamentals questions. Read our editorial method and attribution policy.