Katkat

Choose Precision, Recall, or F1 for Agent Evaluation

ByteDanceSoftware Engineer · Technical Screen

Last updated

This question tests the ability to map business objectives and error costs to appropriate classification metrics in a real-world system context.

The Scenario

You are evaluating three different automated content moderation agents designed to flag policy-violating images. You have a labeled dataset of 10,000 images, where 100 are actual policy violations (positive class) and 9,990 are benign (negative class).

Your team provides the following context for each agent:

  1. Agent A: Used for a 'Pre-filter' step. If an image is flagged, it is sent for human review. Missing a violation (False Negative) is catastrophic, but human review is cheap.
  2. Agent B: Used for an 'Auto-block' step. If an image is flagged, the user's account is immediately suspended. A False Positive results in a PR disaster and user churn.
  3. Agent C: Used for 'General Analytics'. The team wants a single balanced score to track the overall health of the model version, knowing that neither False Positives nor False Negatives are significantly more expensive than the other.

The Task

  1. For each agent (A, B, and C), determine whether Precision, Recall, or the F1-score is the most appropriate primary evaluation metric.
  2. Explain the trade-offs involved if you were to optimize Agent B for higher Recall instead of Precision.
  3. Given the class imbalance (100 positives vs 9,990 negatives), describe how an increase in the decision threshold affects the Precision-Recall curve.

Hints

Hint 1

Consider the cost of a Type I error (False Positive) versus a Type II error (False Negative) for each agent's specific function.

Hint 2

Recall is prioritized when the cost of missing a positive case is higher than the cost of a false alarm.

Hint 3

Precision is prioritized when the cost of a false alarm is significantly higher than missing a positive case.

Follow-up questions

  • How would your metric choice change if the number of policy violations in the dataset increased from 1% to 20%?
  • If Agent A achieves 99% Recall but 5% Precision, how would you justify this performance to stakeholders?
  • What is the AUROC (Area Under the Receiver Operating Characteristic) and why might it be misleading in this specific highly-imbalanced dataset?