PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Machine Learning/Microsoft

Compute and plot a precision–recall curve

Last updated: Mar 29, 2026

Quick Overview

This question evaluates understanding of binary classification evaluation metrics—precision, recall, precision–recall curves, and related summaries like Average Precision/AUPRC—within the Machine Learning domain and is relevant for Data Scientist roles.

  • easy
  • Microsoft
  • Machine Learning
  • Data Scientist

Compute and plot a precision–recall curve

Company: Microsoft

Role: Data Scientist

Category: Machine Learning

Difficulty: easy

Interview Round: Technical Screen

## Precision–Recall (PR) curve coding / evaluation You are given a binary classifier’s outputs on a dataset: - `y_true`: array of true labels in \(\{0,1\}\) - `y_score`: array of predicted scores/probabilities (higher means more likely positive) ### Tasks 1. Define **precision** and **recall**. 2. Describe how to compute the **precision–recall curve** by sweeping a decision threshold over `y_score`. 3. Implement (in pseudocode or Python) a function that returns PR curve points: - Output arrays: `thresholds`, `precision`, `recall` 4. Mention at least **two edge cases/pitfalls** (e.g., ties in scores, no predicted positives at a threshold, extreme class imbalance). Optional: Explain how to compute **Average Precision / AUPRC** and what the baseline means.

Quick Answer: This question evaluates understanding of binary classification evaluation metrics—precision, recall, precision–recall curves, and related summaries like Average Precision/AUPRC—within the Machine Learning domain and is relevant for Data Scientist roles.

Related Interview Questions

  • How do you choose a model? - Microsoft (medium)
  • Explain SHAP in an ML System - Microsoft (medium)
  • Explain normalization, regularization, CTR, imbalance handling - Microsoft (medium)
  • Clean OCR data and build an LLM dataset - Microsoft (medium)
  • Explain SHAP and build an ML project - Microsoft (easy)
Microsoft logo
Microsoft
Jan 17, 2026, 12:00 AM
Data Scientist
Technical Screen
Machine Learning
6
0

Precision–Recall (PR) curve coding / evaluation

You are given a binary classifier’s outputs on a dataset:

  • y_true : array of true labels in {0,1}\{0,1\}{0,1}
  • y_score : array of predicted scores/probabilities (higher means more likely positive)

Tasks

  1. Define precision and recall .
  2. Describe how to compute the precision–recall curve by sweeping a decision threshold over y_score .
  3. Implement (in pseudocode or Python) a function that returns PR curve points:
    • Output arrays: thresholds , precision , recall
  4. Mention at least two edge cases/pitfalls (e.g., ties in scores, no predicted positives at a threshold, extreme class imbalance).

Optional: Explain how to compute Average Precision / AUPRC and what the baseline means.

Solution

Show

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Machine Learning•More Microsoft•More Data Scientist•Microsoft Data Scientist•Microsoft Machine Learning•Data Scientist Machine Learning
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.