Derive the Bias-Variance Decomposition for a Shipping Cost Estimator

Last updated: November 29, 2026

Quick Overview

Derive the bias-variance decomposition of expected squared error for a model that estimates the shipping cost of a package, and use it to explain why a very deep regression tree and a constant predictor both perform poorly.

Amazon
Machine Learning
Data Scientist
Amazon
November 29, 2026
Data Scientist
Technical Screen
Machine Learning
Medium

0

0

0 solved


Derive the bias-variance decomposition of expected squared error for a model that estimates the shipping cost of a package, and use it to explain why a very deep regression tree and a constant predictor both perform poorly.

Amazon applied science screens often include a short derivation to test fundamentals. The interviewer checks that you can do the algebra cleanly, interpret each term, and connect the result to model choices such as tree depth and ensembling.

What the Interviewer Expects
  • States the setup with noise and a random training set
  • Derives the three terms with the cross terms vanishing
  • Interprets irreducible noise, bias squared and variance
  • Maps deep trees to high variance and constants to high bias
  • Explains how bagging and regularization move along the trade-off
Key Topics to Cover
bias-variance trade-off
expected prediction error
regression trees
bagging
irreducible error
How to Approach This
  1. Understand the bias-variance trade-off. High training accuracy but low test accuracy signals overfitting.
  2. Choose evaluation metrics carefully based on the problem. Accuracy alone is often insufficient.
  3. Feature engineering is often more impactful than model selection.
  4. Know when to use tree-based models (tabular data) vs neural networks (unstructured data).
  5. Handle class imbalance with SMOTE, class weights, or appropriate loss functions.
Possible Follow-up Questions
  • Why does bagging reduce variance but not bias?
  • Does the decomposition hold for log loss?
  • How would you estimate bias and variance empirically?
  • What happens to the trade-off as training data grows?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Explore ML Interview Prep
Sample Answer
Clarify

Fix a package with features xx. True cost is y=f(x)+ϵy = f(x) + \epsilon with E[ϵ]=0E[\epsilon] = 0 and Var(ϵ)=σ2Var(\epsilon) = \sigma^2 (carrier surcharges and rounding we cannot predict). The model f^D(x)\hat f_D(x) d...

Approach

Write the expected squared error over both DD and ϵ\epsilon, add and subtract the average prediction fˉ(x)=ED[f^D(x)]\bar f(x) = E_D[\hat f_D(x)], and show the cross terms vanish....


Submit Your Answer
Markdown supported