Why does minimizing MAE estimate the conditional median of the target distribution?

Quick Overview

Asks why a regression model trained to minimize mean absolute error ends up estimating the conditional median of the target. Tests the derivative argument behind absolute loss, the step from a constant to a conditional prediction, and how quantile and squared losses compare.

Why does minimizing MAE estimate the conditional median of the target distribution?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Other

Why does minimizing mean absolute error (MAE) estimate the conditional median of the target distribution? Show why the best constant prediction under absolute loss is the median, then extend the argument to a prediction that depends on the input $x$. ```hint Differentiate the loss Compute the derivative of $|y - c|$ with respect to $c$ for a single point, then take its expectation over $Y$. ``` ```hint From one number to a function Ask how the expected loss of a prediction function $f$ splits up over the values of $X$. ``` ### What a Strong Answer Covers - The derivative or subgradient of the expected absolute error and the condition under which it vanishes - Why that condition defines the median, including convexity and the case where the median is not unique - How the result carries over from a constant prediction to the conditional median at each $x$ - How absolute loss compares with squared loss and how it generalizes to other quantiles - The practical consequences for outliers and for training with this loss ### Follow-up Questions - Which loss would you minimize to predict the 90th percentile, and why does it work? - Why can MAE be awkward to optimize with gradient descent, and what is a common fix? - If the business needs the total predicted revenue across customers to be right, is MAE a good training loss? - What value does a gradient-boosted tree trained with absolute loss put in each leaf?

Overview: Asks why a regression model trained to minimize mean absolute error ends up estimating the conditional median of the target. Tests the derivative argument behind absolute loss, the step from a constant to a conditional prediction, and how quantile and squared losses compare.

PracHub logo
General
Nov 25, 2026
mediumMachine Learning EngineerOtherMachine Learning
0
0

Why does minimizing mean absolute error (MAE) estimate the conditional median of the target distribution? Show why the best constant prediction under absolute loss is the median, then extend the argument to a prediction that depends on the input xx.

What a Strong Answer Covers Guidance

  • The derivative or subgradient of the expected absolute error and the condition under which it vanishes
  • Why that condition defines the median, including convexity and the case where the median is not unique
  • How the result carries over from a constant prediction to the conditional median at each xx
  • How absolute loss compares with squared loss and how it generalizes to other quantiles
  • The practical consequences for outliers and for training with this loss

Follow-up Questions Guidance

  • Which loss would you minimize to predict the 90th percentile, and why does it work?
  • Why can MAE be awkward to optimize with gradient descent, and what is a common fix?
  • If the business needs the total predicted revenue across customers to be right, is MAE a good training loss?
  • What value does a gradient-boosted tree trained with absolute loss put in each leaf?