In this article
Before you start
This page belongs to the machine learning (ML) coding round guide; the other pages there cover the code you write, and this one covers the model you are asked to judge.
Why interviewers ask this
A model that looks good on one number can still be wrong in ways that cost money, and an interviewer wants to know whether you would catch that before it ships. This prompt shows up in review-style rounds: you get a fitted model, a coefficient table or a scatter plot, and you are asked what is wrong with it. Candidates report it in ML coding and code-review rounds.
A weak answer reads the R² aloud and says "it looks good" or "add more features." A strong answer names what to inspect, in what order, and what each failure would look like. A Staff answer also says what it would do next with each finding, and separates "the model is wrong" from "the model is fine for prediction but its coefficients cannot be interpreted." The same habit is tested in code review interview questions: find the real defect, rank it, and propose a fix.
Critiquing a regression model from first principles
- Variance inflation factor
- A variance inflation factor is a diagnostic value that shows how much the variance of one coefficient is inflated because its input can be predicted from the other inputs, so it flags overlapping inputs that make coefficients unstable.
In plain words
Think of a weather forecaster. You do not judge the forecaster by one average score. You read the track record. Are the misses random? Or does the forecaster always miss on cold mornings? The analogy breaks in one place. A forecaster has no coefficients to interpret. A regression model also claims that each input has its own effect, and that claim needs its own check.
Here is the idea in precise terms. A regression model is acceptable when four things hold. Its residuals look like structureless noise. Its coefficients are stable and interpretable. Its error metric matches the cost of mistakes. Its error holds up on rows it never saw.
Step-by-step description
- Plot residuals before reading any score.
- Check spread, independence and coefficients.
- Match MAE or RMSE to the cost of a miss.
- Compare training error with error on new rows.
- A residual plot shows each residual (actual minus predicted value) against the prediction or against an input.
- Its residuals look like structureless noise.
- A held-out set is used only to estimate how it behaves on new rows.
Step 1: Plot the residuals before reading any score
A residual plot shows each residual (actual minus predicted value) against the prediction or against an input, and a healthy model leaves a flat, even band around zero. The National Institute of Standards and Technology (NIST) handbook says residuals should be roughly normal, roughly independent, with mean zero and constant variance, and that departures usually mean the residuals contain structure the model does not account for. Find the structure, add a term for it, and the model improves.
Why a plot and not a score: Anscombe (1973) built four data sets of eleven points each where the ordinary least squares (OLS) fit is the same line while the scatter plots look strikingly different. All four fit y = 3 + 0.5x with R² near 0.67.1
| Set | Pattern in the plot | Mean y | Fitted line | R² |
|---|---|---|---|---|
| 1 | roughly linear | 7.5 | y = 3 + 0.5x | 0.667 |
| 2 | curved | 7.5 | y = 3 + 0.5x | 0.666 |
| 3 | straight with one outlier | 7.5 | y = 3 + 0.5x | 0.666 |
| 4 | one point sets the slope | 7.5 | y = 3 + 0.5x | 0.667 |
In the chart below, set 2 curves away from the fitted line y = 3 + 0.5x, and set 3 lies on a straight line except one outlier at x = 13.
Text description of the diagram
- Set 2 curves away from the fitted line y = 3 + 0.5x.
- Set 3 lies on a straight line except one outlier at x = 13.
You now know what to look at first. The next step asks what a bad residual plot would mean.
Step 2: Check the assumptions and the coefficients
Each shape in the residual plot names a specific fault. A curve means the model is missing a nonlinear term. A funnel, where the band widens as the prediction grows, is heteroscedasticity: in an NIST example the residuals show increasing variance as the predictor increases, which breaks the constant-variance assumption. A pattern over time means the errors are not independent. In an illustrative simulation of 400 rows, the residual spread was 0.84 in the lower half of the inputs and 1.63 in the upper half.1
Then read the coefficients. Multicollinearity inflates their variance, and the variance inflation factor (VIF) is the factor by which the variance of a coefficient is inflated, equal to 1 / (1 − R²ₖ), where R²ₖ comes from regressing predictor k on the other predictors. Two predictors correlated at 0.95 give a VIF of 10.26.1 VIF cut-offs are conventions, not a standard: Penn State's regression course, lesson 12 uses 4 and 10, and 5 and 10 are also common.
Anscombe sets 3 and 4 add two more checks. An outlier is a row whose target sits far from the pattern of the other rows. Leverage is how far a row's inputs sit from the inputs of the other rows. In set 4 one row at x = 19 has high leverage because every other row has x = 8, so that one row sets the slope.1
Cook's distance is a measure of how much the fitted coefficients move when one row is dropped, so a high value marks an influential row. The NIST Dataplot manual describes Cook's distance as the combined impact of one observation on all of the regression coefficients, and notes that high-leverage rows tend to have small residuals even when they are outliers, so a residual plot alone can miss them; refit without the suspect row and see whether the story changes.
Normality is the softest of these checks: judge it last, because a mild departure matters less than visible structure or changing spread.
Step 3: Choose an error metric that matches the cost of mistakes
R² (the coefficient of determination) is the proportion of the variance of the target that the model explains. It is the score a scikit-learn regressor's score method returns (RegressorMixin.score: "Return coefficient of determination on test data"). R² computed on the training rows never falls when you add a predictor, so it cannot tell a useful input from a useless one. Adjusted R² is R² reduced for each extra predictor.
It penalises each extra predictor but does not remove chance gains. In an illustrative run with 30 rows, adding ten pure-noise predictors lifted R² from 0.764 to 0.877, and adjusted R² still rose, from 0.755 to 0.801.1 Only held-out error settles whether the inputs help. Note also that the scikit-learn metrics page says r2_score calculates unadjusted R² without correcting for bias in sample variance of y.
Pick the error metric by what a miss costs. The mean absolute error (MAE) weighs every miss equally; the root mean squared error (RMSE) punishes large misses more. For ten illustrative errors, nine of size 1 and one of size 10, MAE is 1.9 and RMSE is 3.3.1 If one big miss is far worse than several small ones, RMSE is the honest number; if outliers are noise, MAE is.
Step 4: Test on data the model has not seen
A held-out set is a portion of the data that the model never trained on, used only to estimate how it behaves on new rows. Overfitting is a fit so flexible that it learns the noise in the training rows, so training error looks good and held-out error does not. The check is a comparison: low training error with higher held-out error is overfitting; high error on both is underfitting.
In an illustrative simulation of 30 training rows drawn from a straight line plus noise, a straight-line fit scored RMSE 1.03 on training data and 0.99 on 200 fresh rows. A ninth-degree polynomial scored 0.88 on training data and 1.64 on the fresh rows.1 The flexible model looked better on the data it had seen and was worse on new data. The straight line's test RMSE of 0.99 sits near the simulated noise level of 1, which is about the error no model can avoid.
Text description of the diagram
- A straight line has training RMSE 1.03 and test RMSE 0.99.
- A ninth-degree polynomial has training RMSE 0.88 and test RMSE 1.64.
The same discipline applies when you train a larger model; see gradient descent from scratch and learning-rate schedules and building generative pre-trained transformer (GPT) from scratch, where a rising held-out loss signals the same problem.
What if you are shown the code that trained it?
Read the code for pipeline defects. Look for a scaler or encoder fitted on all rows before the split. Look for target or future values leaking into the inputs, and for a random split on time-ordered data. Check whether the score is computed on the training rows, and whether hyperparameters were tuned on the test set. Each defect makes the reported held-out error look better than the error on new data will be.
Knowing it is half the job. Saying it is the other half.
Interview Clozo is an AI interview copilot for real interview rounds: it hears the question and puts a strong answer on your screen, and you say it in your own words. See the features or how it works.
Start Free Trial →The Staff-level answer
How would you critique this regression model?
I would not start with R². First I plot the residuals against the predictions, because structure there tells me what the model is missing: a curve means a missing term, a funnel means the error depends on the size of the prediction. I also check whether one or two high-influence rows set the slope. Next I check coefficients for correlated inputs with variance inflation factors. Then I pick the error metric from the cost of a miss, and I compare training error with error on held-out data to catch overfitting and leakage. A high score only clears the model if all four checks agree.
What makes this Staff-level: it orders the checks by what can overturn a good score, it names the failure each shape means, and it ends with a decision rule rather than a list of tests.
The rubric
| Dimension | Weak answer | Strong answer | Staff answer |
|---|---|---|---|
| Diagnostics | Quotes R² and says it looks fine | Plots residuals and names curves and funnels | Orders checks by what could overturn the score |
| Coefficients | Reads signs as causes | Checks VIF before interpreting coefficients | Separates prediction use from interpretation use |
| Metric | Uses the library default | Chooses MAE or RMSE with a reason | Ties the metric to the cost of one large miss |
| Generalisation | Reports training error only | Compares train and held-out error | Checks leakage and how the split was made |
| Communication | Lists tests with no order | Gives findings, then fixes | States what would change its mind |
Three variants of this question
What if you are given only the coefficient table and no plot?
Say what the table cannot show: it hides curvature, outliers and changing spread, so ask for the residual plot and the held-out error before any verdict. From the table alone, check standard errors for signs of correlated inputs.
What if the errors grow with the size of the prediction?
Errors that grow with the prediction are heteroscedasticity: the spread of the errors changes with the size of the prediction. Say the line may still predict the average well, but intervals and tests that assume constant spread will be wrong, so model the changing spread, for example by transforming the target or weighting rows.
What if the model scores very well on training data but you cannot get new data?
Hold out part of the data you have, or use cross-validation, and treat any score computed on the training rows as optimistic. Then state the risk of overfitting in your verdict.
Common mistakes
- "The R² is high, so the model is good." (wrong) R² measures explained variance and does not show curvature, outliers or overfitting. (right) "R² is one number; I check the residual plot and held-out error before I trust it."
- "These coefficients show what causes the target." (wrong) Correlated inputs make coefficients unstable, and a fit is not a causal claim. (right) "I check variance inflation before I interpret any single coefficient."
- "I would add more features." (wrong) Extra inputs raise unadjusted R² even when they are noise. (right) "I add a term only when the residuals show structure it would explain."
- "Training error is low, so it generalises." (wrong) Flexible models can fit noise. (right) "I compare against error on rows the model never saw."
Follow-up questions
What does a good residual plot look like?
A flat, even band around zero with no curve, no funnel and no pattern over time. NIST describes the expectation as errors that are random and of constant level, independent of the size of the observation being predicted.
Why is R² not enough to judge a regression model?
R² is one summary of explained variance, and the Anscombe sets show four very different data sets giving the same fit. The unadjusted version also never penalises extra predictors.
Does multicollinearity hurt predictions?
It mainly makes individual coefficients unreliable, so check it when you interpret coefficients, and check held-out error when you predict.
How do you tell overfitting from underfitting?
Compare training and held-out error. A large gap means overfitting; high error on both means the model is too simple or is missing a term.
How do you find influential points in a regression?
Refit the model without each suspect row and see how far the coefficients move; Cook's distance summarises that, and a row far from the others in its inputs has high leverage. For practice on the metrics themselves, see evaluation metrics from scratch and the rest of the ML coding round guide.
- Plot the residuals first; structure in them names what the model is missing.
- Identical R² and fitted lines can hide curvature, outliers and single high-influence points.
- Check variance inflation before interpreting coefficients.
- Choose MAE or RMSE by the cost of one large miss.
- Compare training error with held-out error to catch overfitting and leakage.
Sources
- Assumptions for residuals (NIST/SEMATECH e-Handbook of Statistical Methods, 5.2.4) — NIST Information Technology Laboratory, 26 Oct 2026
- Initial linear fit (NIST/SEMATECH e-Handbook, 4.6.2.3) — NIST Information Technology Laboratory, 26 Oct 2026
- Regression diagnostics (Dataplot reference manual) — NIST Information Technology Laboratory, 26 Oct 2026
- Metrics and scoring: quantifying the quality of predictions — scikit-learn documentation, 26 Oct 2026
- RegressorMixin.score (scikit-learn API reference) — scikit-learn documentation, 26 Oct 2026
- Graphs in Statistical Analysis (Anscombe, The American Statistician 27(1):17-21) — The American Statistician (Anscombe), 1 Feb 1973
- Lesson 12: Multicollinearity and other regression pitfalls (STAT 501) — Penn State Eberly College of Science, 26 Oct 2026
- Statistical Inference lecture notes, section Anscombe's Quartet (arXiv 1603.04929) — arXiv, 15 Mar 2016
- Graphs in phylogenetic comparative analysis: Anscombe's quartet revisited — Methods in Ecology and Evolution (Revell), 1 Jan 2018