The pinball (quantile) loss for level is if and if , with . Show that the constant minimising is the -quantile of . How do you check it numerically for on ?
Supervised learning, Quantile regression
Level L3 Intermediate. Length Long. Nature Th+Mat Both.
What's being asked
Whether you can derive that the pinball loss elicits quantiles (just as squared loss gives the mean and absolute loss gives the median), by differentiating under the expectation.
Key idea
, where is the cumulative distribution function of . The minimiser is where crosses .
Steps
- Write the expected loss as .
- Differentiate in (the boundary terms vanish because the integrands are zero at ): .
- Simplify using : the derivative is .
- The derivative is negative while and positive once , so the loss is convex in with its minimum at the -quantile. For this is the median, and .
- Numerical check with . At the residuals are . Negative residuals cost and positive ones , so the total is .
- At the residuals are , giving . At the residuals are , giving .
- So is lowest. It is the 0.7-quantile: . Note the slopes: moving from 3 to 4 the loss falls by , moving from 4 to 5 it rises by .
- Use: fit a model with this loss to predict conditional quantiles, for example the 0.9 quantile for demand forecasting, or two quantiles to form a prediction interval.
Common mistakes
- Mixing up the weights, putting on under-predictions. Here multiplies positive residuals , so large penalises under-prediction more and pushes the fit upwards.
- Forgetting that the loss is not differentiable at . The argument works with one-sided derivatives or by integrating, which is why the CDF appears.
- Assuming the minimiser is unique. If exactly on an interval (for example on these five points), every in that interval is optimal.
How long your answer should be
One page; 8 minutes.
Last checked on 4 December 2026.
Read this
Previous in Supervised learning: Locally weighted linear regression predicts at a query by minimising with weights . For the data , bandwidth and query , compute the prediction. How does it compare with the ordinary least-squares prediction at ?
Next in Supervised learning: Gradient boosting for binary classification uses the log loss with as the log-odds. The data are with labels . Start from the best constant, grow a stump that splits between and , and use Newton leaf values with learning rate . What are the new probabilities?