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
Machine Learning
Data Scientist
Amazon
November 29, 2026
Data Scientist
Online Assessment
Machine Learning
Easy

0

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
multi-label classification
micro F1
macro F1
class imbalance
per-label thresholds
How to Approach This
  1. Understand the bias-variance trade-off. High training accuracy but low test accuracy signals overfitting.
  2. Choose evaluation metrics carefully based on the problem. Accuracy alone is often insufficient.
  3. Feature engineering is often more impactful than model selection.
  4. Know when to use tree-based models (tabular data) vs neural networks (unstructured data).
  5. 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 Prep
Sample 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...


Submit Your Answer
Markdown supported