11. How would you evaluate a multilabel classifier?
Each observation may have zero, one, or several true labels from a fixed catalog, and label frequencies are highly uneven. Define the prediction representation and thresholding policy, then compare example-based, label-based, micro, macro, ranking, and subset metrics. Explain how you would inspect calibration, label co-occurrence, rare-label errors, and costs that differ by label.
I would keep one score per label, choose global or per-label thresholds on validation data, and report several complementary metrics: example-based, per-label, micro, macro, ranking, and exact-match. I would also inspect calibration, co-occurrence, rare labels, and label-specific false-positive and false-negative costs before selecting the final operating point.
A multilabel classifier assigns a score to every label because each observation can have zero, one, or several true labels from a fixed catalog. I would first define the score representation and how scores become a predicted label set. Then I would evaluate the model from several complementary views because highly uneven label frequencies can make one aggregate score misleading. I would compare per-instance, per-label, micro, macro, ranking, and exact-match metrics, then inspect calibration, label co-occurrence, rare-label errors, and label-specific decision costs before choosing final thresholds.
- Will downstream users consume ranked scores, binary label sets, or both?
- Can each label have its own threshold, or must all labels share one global threshold?
- Which labels have different false-positive and false-negative costs?
- Does the full predicted set need to match exactly, or is partial correctness useful?
- Are calibrated probabilities required, or is ranking quality sufficient?
For N observations and L labels, represent the model output as a score matrix S in [0,1]^(N x L). The element s_ij is the score for label j on observation i. The true labels can be represented as a binary matrix Y in {0,1}^(N x L), or as a true label set Y_i for each observation. The predicted label set is P_i.
A global threshold tau predicts label j when s_ij >= tau. If labels have different score distributions, prevalence, or error costs, use per-label thresholds tau_j and predict label j when s_ij >= tau_j. A top-k rule is another valid policy when the application explicitly needs a fixed number of highest-scoring labels. Tune tau, tau_j, or k on validation data for the chosen metric or cost. Do not choose the operating point on the final test set.
Example-based metrics evaluate one observation at a time and then average across observations. For observation i, precision measures the fraction of predicted labels that are correct, recall measures the fraction of true labels that were recovered, and example F1 balances those two quantities. Jaccard or IoU is |P_i intersection Y_i| / |P_i union Y_i|. Hamming loss measures the average fraction of individual label decisions that are wrong. These metrics answer, 'How good is the predicted set for a typical observation?'
Treat each label j as a one-versus-rest binary problem. Compute TP_j, FP_j, FN_j, precision_j, recall_j, and F1_j across all observations. This view is essential when frequencies are highly uneven because a strong aggregate result can hide labels with poor recall or precision. I would inspect the distribution of per-label metrics and stratify labels by support.
Micro metrics aggregate TP, FP, and FN across labels before computing the score. For example, micro precision is sum_j TP_j / sum_j(TP_j + FP_j), and micro recall is sum_j TP_j / sum_j(TP_j + FN_j). Frequent labels therefore have more influence.
Macro F1 computes F1_j for each label and then averages equally: Macro-F1 = (1/L) sum_j F1_j. It gives rare labels the same weight as frequent labels. With a long-tailed label distribution, I would normally report both micro and macro results. A support-weighted F1 can be an additional summary, but it should not replace the unweighted macro view when rare labels matter.
Ranking metrics use the ordering of scores and do not require one final binary threshold. For label j, Average Precision is the recall-weighted mean of precision over thresholds: AP_j = sum_n (R_n - R_(n-1)) P_n. Mean Average Precision averages AP across labels.
LRAP is an example-aware ranking metric: for each true label, it checks how many labels ranked at least as high are also true, then averages across observations. Coverage error measures how far down the ranked list we must go to cover all true labels. Label ranking loss measures the fraction of true-versus-false label pairs that are ordered incorrectly. These metrics are useful when downstream systems consume ranked scores.
Subset accuracy, or exact match, gives an observation a score of 1 only when P_i = Y_i; otherwise it gives 0. This is intentionally strict because one missing or extra label makes the whole observation incorrect. Use it when the full predicted label set must match exactly, and report it alongside less strict metrics rather than using it alone.
If scores are intended to behave like probabilities, inspect calibration separately for important labels. A reliability diagram compares mean predicted probability with observed frequency. A per-label Brier score is Brier_j = (1/N) sum_i (s_ij - y_ij)^2, where lower is better. Expected Calibration Error can also summarize reliability-bin deviations. Reliability diagrams show calibration directly; Brier score also reflects discrimination or resolution, so it should not be interpreted as a pure calibration measure by itself.
Build a label co-occurrence matrix, for example using Jaccard similarity or pointwise mutual information. Use it to find labels that frequently appear together, redundant labels, or systematic paired errors. Then inspect whether the model often predicts one label in a common pair while missing the other. Co-occurrence is diagnostic evidence about label structure; it does not by itself prove causality.
Break labels down by support and compare rare, medium, and common labels. Report per-label precision, recall, and F1, and inspect the worst rare labels instead of relying only on global averages. Macro metrics help because each label receives equal weight, while micro metrics can be dominated by frequent labels. For labels with very few positives, I would also report support because their metric estimates can be unstable.
If labels have different error costs, define C_FP,j for a false positive and C_FN,j for a false negative. One empirical cost summary is (1/N) sum_j(C_FP,j * FP_j + C_FN,j * FN_j). Choose each threshold tau_j on validation data to minimize the relevant label-specific expected cost or business loss. A costly-to-miss label may intentionally use a lower threshold to gain recall at the expense of more false positives.
I would not declare a winner from one metric. I would report micro and macro scores, per-label and example-based quality, ranking metrics when scores are consumed as rankings, subset accuracy when exact sets matter, calibration diagnostics when probabilities matter, co-occurrence and rare-label error slices, and the cost-aware operating thresholds. After all thresholds and policies are fixed on validation data, I would evaluate that frozen policy once on the held-out test set.
- Represent model outputs as an N x L score matrix and ground truth as an N x L binary matrix or equivalent per-observation label sets.
- Define the prediction policy: global threshold, per-label thresholds, or top-k when the decision explicitly requires a fixed-size ranked set.
- Tune thresholds or k only on validation data using the target metric or label-specific cost.
- Compute example-based precision, recall, F1, Jaccard, and Hamming loss.
- Compute per-label TP, FP, FN, precision, recall, and F1.
- Report micro metrics for overall decision volume and macro metrics to give every label equal influence.
- Evaluate ranking quality with Average Precision or mAP, LRAP, coverage error, and label ranking loss when ranked scores matter.
- Report subset accuracy when the complete predicted label set must match exactly.
- Inspect per-label reliability diagrams, Brier score, and optionally ECE when calibrated probabilities matter.
- Analyze label co-occurrence using a suitable association matrix such as Jaccard or PMI and inspect paired error patterns.
- Stratify labels by support into rare, medium, and common groups and inspect the worst rare labels individually.
- Compute label-specific false-positive and false-negative costs and choose each tau_j on validation data to minimize the chosen cost or business loss.
- Freeze the full evaluation and thresholding policy and evaluate it once on the held-out test set.
The main tradeoff is not computational complexity but evaluation complexity. With N observations and L labels, many calculations scale roughly with the N x L prediction matrix, and ranking metrics may need additional ordering work. Micro scores are stable for overall volume but can hide rare labels. Macro scores reveal rare-label problems but can be noisy when support is tiny. Exact match is easy to understand but very strict. Per-label thresholds, calibration checks, dependency analysis, and cost-aware evaluation require more validation work, but they better match real decisions when labels have uneven frequencies and different consequences.
This question tests whether the candidate understands that multilabel evaluation cannot be summarized safely by one accuracy number. The interviewer wants to see whether the candidate can define score and prediction representations, distinguish per-instance from per-label evaluation, explain micro versus macro behavior under severe label imbalance, evaluate ranking and exact-set correctness, inspect calibration and label dependencies, diagnose rare-label failures, and align threshold selection with label-specific false-positive and false-negative costs.
Common mistakes are reporting only micro F1 and hiding rare-label failures; treating subset accuracy as the only useful metric; tuning thresholds on the test set; assuming one global threshold is appropriate even when labels have different costs; confusing Average Precision with simple geometric area under a precision-recall curve; treating example F1 as an exact-match metric; ignoring calibration when scores are used as probabilities; assuming label co-occurrence proves causality; and reporting aggregate scores without showing per-label support and the worst rare-label errors.
Use a clear order: scores and thresholds first, then example-based and per-label metrics, then micro versus macro, ranking, and exact match. Finish with calibration, co-occurrence, rare labels, and label-specific costs. State explicitly that no single metric is sufficient.










