All questions
Showing of 43What is the difference between precision and recall, and how do you compute them?
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:
Last attempt -
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.
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 ↓
What do the four cells of a confusion matrix tell you about a classifier?
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:
Last attempt -
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.
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 ↓
How does the F1 score combine precision and recall, and when does it help?
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:
Last attempt -
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.
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 ↓
When does precision matter more than recall, and when does recall win?
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:
Last attempt -
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.
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 ↓
What are sensitivity and specificity, and how do they relate to a ROC curve?
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:
Last attempt -
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.
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 ↓
What is a ROC curve, and how do you read one for a binary classifier?
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:
Last attempt -
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.
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 ↓
What does the ROC AUC score tell you, and what does 0.5 mean?
Which evaluation metrics would you reach for on a classification task versus a regression task?
What are MSE and RMSE, and what does squaring the errors do?
What are MAE and MAPE, and what does each one tell you?
What is R-squared, and how do the residual and total sums of squares define it?
What is the difference between overfitting and underfitting?
How do you tell whether a model is overfitting rather than generalizing?
What is cross-validation for, and how does k-fold cross-validation actually work?
Why is k-fold cross-validation better than a single train/test split?
When would you reach for stratified k-fold cross-validation instead of plain k-fold?
How do you report a final number when your scores come from cross-validation?
What are hyperparameters, and how do they differ from model parameters?
What is hyperparameter tuning, and why does it matter for model quality?
What is GridSearchCV, and how does it combine searching with cross-validation?
Why can accuracy be a misleading metric on an imbalanced dataset?
Which metrics replace accuracy when one class is far rarer than the other?
Why do precision and recall trade off against each other?
In fraud detection, what do precision and recall actually mean for the business?
How do you decide which of two classifiers is better from their ROC curves?
How is AUC computed, and what does it say about a model's ranking?
How do precision, recall and AUC extend to multi-class classification problems?
What does it mean for a model to be well calibrated?
If you keep adding variables, what happens to R-squared, and why use adjusted R-squared?
How does the bias-variance tradeoff show up in training versus validation error?
Your model has high bias and low variance, how do you fix it?
Your model predicts the same class for every input, is that overfitting?
What is the test set really for, and why is 94% often meaningless?
What goes wrong when you set k very high in k-fold cross-validation?
When is leave-one-out cross-validation worth the extra compute, and when is it not?
Why does standard k-fold fail on time-series data, and what do you use instead?
After cross-validation, how do you build the model you actually ship?
What is the difference between grid search and random search for tuning?
How do you tune hyperparameters efficiently when your compute budget is limited?
How do you choose an evaluation metric that matches the business cost of errors?
How do you set the decision threshold when false positives and false negatives differ in cost?
How do you spot data leakage, and when is k-fold cross-validation the wrong tool?
What is nested cross-validation, and when do you actually need it?
This answer is part of Pro.
The full written answer, with the trade-offs and follow-ups an interviewer will probe.
No matches
Try a different filter or search term.
Model Evaluation & Validation cheatsheet
- 30-second mental model01
- Classification metrics02
- Imbalanced data03
- Thresholds and operating points04
- ROC, AUC and curve comparison05
- Calibration06
- Regression metrics07
- Overfitting, underfitting, bias-variance08
- Cross-validation09
- Hyperparameter tuning10
- Data leakage11
- Rules of thumb12
- + 6 more inside
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.
MEAN
MongoDB, Express, Angular, Node.jsMERN
MongoDB, Express, React, Node.jsDjango
Python Full-Stack DevelopmentRuby on Rails
Convention over ConfigurationServerless on AWS
Serverless Architecture on AWSInterviewers also test these - they're common to every stack, whichever one you picked above.
Flutter Mobile
Flutter Cross-Platform Mobile DevelopmentInterviewers also test these - they're common to every stack, whichever one you picked above.
Spring Boot
Enterprise Java Development.NET
Microsoft EcosystemVue
Vue.js, Vite, TypeScript, Tailwind, Node.jsGo Backend
Golang, gRPC, PostgreSQL, Redis, RabbitMQInterviewers also test these - they're common to every stack, whichever one you picked above.
FastAPI
Python, FastAPI, SQLAlchemy, PostgreSQLReact Native
React, TypeScript, Redux, FirebaseiOS Native
Swift, SwiftUI, UIKit, FirebaseAndroid Native
Java, Jetpack Compose, FirebaseDevOps / Platform
Docker, Kubernetes, Terraform, CI/CDInterviewers also test these - they're common to every stack, whichever one you picked above.
AI Engineer
LLMs, RAG, Agents, EvalsAI-Powered Developer
Claude Code, Copilot, Agentic WorkflowsCore SWE Interview Prep
Data structures, algorithms, OS, concurrency, networking, gitInterviewers also test these - they're common to every stack, whichever one you picked above.
Interviewers also test these - they're common to every stack, whichever one you picked above.