LearnThatStack Ace your next interview
Machine Learning & Data Science
Model Evaluation & Validation.
Change topic Change
Practice · Questions

All questions

Showing of 43
Beginner 20
01

What is the difference between precision and recall, and how do you compute them?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

Precision asks how many of your positive predictions were correct. Recall asks how many of the real positives you actually caught. Both put true positives on top; only the denominator changes.

Precision divides true positives by every case you flagged, so false positives hurt it. Recall divides true positives by every case that was truly positive, so misses hurt it. Neither metric counts true negatives, which is why both survive when negatives vastly outnumber positives.

// flagged 100 items, 80 were right; 200 real positives exist
const precision = 80 / 100; // 0.80
const recall = 80 / 200;    // 0.40

Reading them together stops a common trap. A model that flags one obvious case scores perfect precision and almost no recall. A model that flags everything scores perfect recall and terrible precision. Neither number means much alone, so quote both, plus how many predictions produced them.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

02

What do the four cells of a confusion matrix tell you about a classifier?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

A confusion matrix lays out predictions against actual labels, giving four counts for a binary classifier. Rows usually hold the true labels and columns hold the predictions, but check the axis order before reading someone else's matrix, because libraries differ.

  • True positives: cases that were positive and you called them positive.
  • True negatives: cases that were negative and you called them negative.
  • False positives: negatives you flagged anyway, the false alarms.
  • False negatives: positives you let through, the misses.

The raw counts matter more than any single score. They show which error dominates, and they show how lopsided the classes are. A model can look strong while its false negative cell holds most of the positives. Every headline metric is built from these four numbers, so start here when a result looks odd. A quick sanity check: the four cells must sum to your evaluation set size.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

03

How does the F1 score combine precision and recall, and when does it help?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

F1 is the harmonic mean of precision and recall, computed as two times their product divided by their sum. A plain average would let strong precision cover for weak recall. The harmonic mean will not; it sits close to the smaller of the two numbers.

Precision 1.0 with recall 0.1 gives an F1 near 0.18, not 0.55. That gap is exactly what stops a model from scoring well by flagging one safe case.

F1 helps when you need one number to rank models or pick a cutoff, and the positive class is rare. It refuses to reward a model that games one side.

The cost is what it assumes. It weights precision and recall equally, which rarely matches real error costs, and it ignores true negatives entirely. When one side matters more, use F-beta, which lets you weight recall up or down.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

04

When does precision matter more than recall, and when does recall win?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

Push for precision when acting on a wrong flag causes direct damage. A spam filter that buries a real invoice loses the user money. Auto-removing content or auto-blocking an account has the same shape: the false alarm is visible, immediate and hard to undo.

Recall wins when a miss is the expensive outcome and a false alarm is cheap to check. Disease screening is the classic case; a flagged patient gets a second test, but a missed tumor keeps growing. Security alerting and safety recalls follow the same logic.

The test that decides it is simple. Ask what happens after a positive prediction. If a human or a cheap second stage reviews every flag, push recall and accept noise. If the prediction acts on its own, protect precision, because nobody catches the mistake.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

05

What are sensitivity and specificity, and how do they relate to a ROC curve?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

Sensitivity is recall under another name: of all the real positives, the share your model catches. Specificity is its mirror on the other class: of all the real negatives, the share you correctly leave alone. Medical and diagnostic work usually uses these two names.

A receiver operating characteristic (ROC) curve is built from exactly this pair. The vertical axis is sensitivity. The horizontal axis is one minus specificity, also called the false positive rate. Each point on the curve is one decision cutoff.

Knowing the pair keeps you honest. Raising sensitivity almost always lowers specificity, since catching more positives means flagging more negatives too. Quoting one alone hides that cost, which is how a screening test with 99% sensitivity can still drown a clinic in false alarms.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

06

What is a ROC curve, and how do you read one for a binary classifier?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

The receiver operating characteristic (ROC) curve traces one classifier across every possible decision cutoff. Each point pairs the true positive rate with the false positive rate at that cutoff. Sliding from a strict cutoff to a loose one walks you along the curve.

Read it by corner. The bottom left is flagging nothing, the top right is flagging everything, and both are useless. The diagonal line is guessing at random. A curve that bulges up and to the left is separating the classes well.

The practical use is choosing where to operate. Find the largest false positive rate your team can absorb, read up to the curve, and take the cutoff there. One caution: with very rare positives the curve can look great while most of your flags are still wrong.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

07

What does the ROC AUC score tell you, and what does 0.5 mean?

Part of Pro
08

Which evaluation metrics would you reach for on a classification task versus a regression task?

Part of Pro
09

What are MSE and RMSE, and what does squaring the errors do?

Part of Pro
10

What are MAE and MAPE, and what does each one tell you?

Part of Pro
11

What is R-squared, and how do the residual and total sums of squares define it?

Part of Pro
12

What is the difference between overfitting and underfitting?

Part of Pro
13

How do you tell whether a model is overfitting rather than generalizing?

Part of Pro
14

What is cross-validation for, and how does k-fold cross-validation actually work?

Part of Pro
15

Why is k-fold cross-validation better than a single train/test split?

Part of Pro
16

When would you reach for stratified k-fold cross-validation instead of plain k-fold?

Part of Pro
17

How do you report a final number when your scores come from cross-validation?

Part of Pro
18

What are hyperparameters, and how do they differ from model parameters?

Part of Pro
19

What is hyperparameter tuning, and why does it matter for model quality?

Part of Pro
20

What is GridSearchCV, and how does it combine searching with cross-validation?

Part of Pro
Intermediate 19
21

Why can accuracy be a misleading metric on an imbalanced dataset?

Part of Pro
22

Which metrics replace accuracy when one class is far rarer than the other?

Part of Pro
23

Why do precision and recall trade off against each other?

Part of Pro
24

In fraud detection, what do precision and recall actually mean for the business?

Part of Pro
25

How do you decide which of two classifiers is better from their ROC curves?

Part of Pro
26

How is AUC computed, and what does it say about a model's ranking?

Part of Pro
27

How do precision, recall and AUC extend to multi-class classification problems?

Part of Pro
28

What does it mean for a model to be well calibrated?

Part of Pro
29

If you keep adding variables, what happens to R-squared, and why use adjusted R-squared?

Part of Pro
30

How does the bias-variance tradeoff show up in training versus validation error?

Part of Pro
31

Your model has high bias and low variance, how do you fix it?

Part of Pro
32

Your model predicts the same class for every input, is that overfitting?

Part of Pro
33

What is the test set really for, and why is 94% often meaningless?

Part of Pro
34

What goes wrong when you set k very high in k-fold cross-validation?

Part of Pro
35

When is leave-one-out cross-validation worth the extra compute, and when is it not?

Part of Pro
36

Why does standard k-fold fail on time-series data, and what do you use instead?

Part of Pro
37

After cross-validation, how do you build the model you actually ship?

Part of Pro
38

What is the difference between grid search and random search for tuning?

Part of Pro
39

How do you tune hyperparameters efficiently when your compute budget is limited?

Part of Pro
Expert 4
40

How do you choose an evaluation metric that matches the business cost of errors?

Part of Pro
41

How do you set the decision threshold when false positives and false negatives differ in cost?

Part of Pro
42

How do you spot data leakage, and when is k-fold cross-validation the wrong tool?

Part of Pro
43

What is nested cross-validation, and when do you actually need it?

Part of Pro

No matches

Try a different filter or search term.

Know someone prepping for Model Evaluation & Validation? Send them this set.
Pro · $10/mo

37 of 43 Model Evaluation & Validation answers are in Pro.

Full answers, code samples, and AI explanations that go simpler or deeper. Cancel anytime.

  • Full answers + code
  • AI explanations, simpler or deeper
  • 1,000 AI credits / month
  • Cancel anytime

Change topic

Pick a different technology or stack. Your current topic stays put until you choose a new one.

Technologies
No technologies match “”.
Cross-cutting topics
No topics match “”.
By role
Stacks & frameworks

MEAN

MongoDB, Express, Angular, Node.js

MERN

MongoDB, Express, React, Node.js

LAMP

Linux, Apache, MySQL, PHP

Django

Python Full-Stack Development

Ruby on Rails

Convention over Configuration

Serverless on AWS

Serverless Architecture on AWS

Flutter Mobile

Flutter Cross-Platform Mobile Development

Spring Boot

Enterprise Java Development

.NET

Microsoft Ecosystem

Vue

Vue.js, Vite, TypeScript, Tailwind, Node.js

Go Backend

Golang, gRPC, PostgreSQL, Redis, RabbitMQ

FastAPI

Python, FastAPI, SQLAlchemy, PostgreSQL

React Native

React, TypeScript, Redux, Firebase

iOS Native

Swift, SwiftUI, UIKit, Firebase

Android Native

Java, Jetpack Compose, Firebase

DevOps / Platform

Docker, Kubernetes, Terraform, CI/CD

AI Engineer

LLMs, RAG, Agents, Evals

AI-Powered Developer

Claude Code, Copilot, Agentic Workflows

Core SWE Interview Prep

Data structures, algorithms, OS, concurrency, networking, git