Score a Multi-Label Product Attribute Tagger With Micro and Macro F1
Last updated: November 29, 2026
Quick Overview
A model tags product listings with attributes like waterproof, organic cotton and vegan. Implement micro-averaged and macro-averaged F1 over the label set and explain when each one is the right headline number.
Amazon
November 29, 20260
0
0 solved
A model tags product listings with attributes like waterproof, organic cotton and vegan. Implement micro-averaged and macro-averaged F1 over the label set and explain when each one is the right headline number.
Catalog quality teams at Amazon extract structured attributes from listings so customers can filter search results. This question checks that a candidate can compute multi-label metrics by hand and knows how averaging choices hide or expose rare-label performance.
What the Interviewer Expects
- Computes per-label true positives, false positives and false negatives
- Implements micro F1 by pooling counts and macro F1 by averaging per-label F1
- Handles labels with zero support or zero predictions
- Explains that micro F1 is dominated by frequent labels
- Recommends reporting both plus per-label results for important filters
Key Topics to Cover
How to Approach This
- Understand the bias-variance trade-off. High training accuracy but low test accuracy signals overfitting.
- Choose evaluation metrics carefully based on the problem. Accuracy alone is often insufficient.
- Feature engineering is often more impactful than model selection.
- Know when to use tree-based models (tabular data) vs neural networks (unstructured data).
- Handle class imbalance with SMOTE, class weights, or appropriate loss functions.
Possible Follow-up Questions
- What is weighted F1 and when would you use it?
- How would you pick a separate threshold for each label?
- How would you evaluate if labels in the ground truth are incomplete?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Explore ML Interview PrepSample Answer
Clarify
Ask how many attributes exist, how skewed their frequency is (cotton is common, vegan leather is rare), and which attributes power search filters customers use....
Approach
Count per label. Micro F1 sums TP, FP and FN across all labels, then computes one F1, so it reflects overall tag-level correctness and is dominated by frequent labels. Macro F1 computes F1 per label a...