On this page
Pinball loss scores a predicted quantile against the observed numeric outcome. It penalizes misses differently on the two sides of the forecast. For a 90th-percentile forecast, an outcome above the forecast receives nine times the loss of an equally sized outcome below it.
This guide defines the loss explicitly, reproduces an original four-case ledger, and shows why the quantile level and scaling convention must travel with every reported score. The data are fictional; they do not measure Alphascope or a prediction market's performance.
Pinball loss formula and sign convention
Let y be the observed number, q be the predicted quantile value and τ be the quantile level, strictly between zero and one. Use the residual u = y − q:
Lτ(y, q) = τ × (y − q) when y ≥ q
(1 − τ) × (q − y) when y < q
Mean loss = sum of per-case losses / number of cases
Both branches are nonnegative. If the actual is higher than q, the forecast was too low and the weight is τ. If the actual is lower, the forecast was too high and the weight is 1 − τ. At an exact hit, the loss is zero.
This is the undoubled convention used by the scikit-learn model-evaluation formula. Some quantile-score conventions multiply this quantity by two; declare the convention before comparing values.
Why the loss is asymmetric
Take a fictional observed temperature of 30 degrees. At τ = 0.90, a forecast q = 28 has loss 0.90 × 2 = 1.80. A forecast q = 32 has loss 0.10 × 2 = 0.20. The two misses are equally far from the observation, but one crosses the high quantile on the heavily penalized side.
The larger penalty for underprediction encourages a higher target than the median. It does not make increasing every forecast indefinitely a winning strategy: eventually the many overpredictions accumulate loss. The balance of the two sides selects a quantile rather than the mean.
At τ = 0.10, those weights reverse. At τ = 0.50, both are 0.50, so the mean pinball loss is exactly half the mean absolute error for the same records. It is not numerically identical to MAE under this undoubled definition.
An original mean pinball loss example
Suppose four numeric outcomes are observed after forecasts were recorded at a consistent horizon. Treat the listed forecasts as candidate 90th-percentile predictions, with equal weights:
| Case | Actual y | Predicted q | Residual y − q | Loss at τ = 0.90 |
|---|---|---|---|---|
| A | 12 | 20 | −8 | 0.80 |
| B | 18 | 22 | −4 | 0.40 |
| C | 27 | 30 | −3 | 0.30 |
| D | 35 | 32 | 3 | 2.70 |
The losses sum to 4.20, giving a mean of 1.05 units. Case D contributes 2.70 despite a smaller absolute miss than case A. The difference is a consequence of the 90th-percentile target, not a spreadsheet error.
For the same actuals and forecast values, the mean at τ = 0.50 is 2.25 and MAE is 4.50. At τ = 0.10 the mean is 3.45. These three losses answer different target-quantile questions; their different magnitudes are not evidence that changing the label from 10% to 90% improved a fixed model.
Download the four-case CSV and exact-arithmetic Python worksheet to reproduce the table. No dataset download, model training or account access is required.
The preferred forecast changes with the target
Use the same actuals 12, 18, 27 and 35, but compare two constant candidate forecasts: A always predicts 24; B always predicts 32.
| Target | Mean loss, A = 24 | Mean loss, B = 32 | Lower-loss candidate |
|---|---|---|---|
| τ = 0.50 | 4.00 | 5.25 | A |
| τ = 0.90 | 3.60 | 1.65 | B |
At the median target, candidate A is better on this sample. At the 90th-percentile target, B is better. State the target before evaluating candidates. Selecting whichever τ makes a model look best changes the evaluation problem after seeing the results.
The empirical minimizer need not be unique. For two observations, 10 and 20, every constant q between 10 and 20 has the same median pinball loss of 2.50. A finite sample can therefore support an interval of minimizing values rather than a unique optimal number.
Pinball loss in Python and scikit-learn
The downloadable worksheet uses fractions.Fraction from the Python standard library. It implements the two branches, validates matched nonempty records and computes the examples exactly. Run python3 pinball-loss.py.
With scikit-learn installed, the equivalent evaluation call is:
from sklearn.metrics import mean_pinball_loss
y = [12, 18, 27, 35]
q = [20, 22, 30, 32]
score = mean_pinball_loss(y, q, alpha=0.90)
print(score) # approximately 1.05
The metric reference names its quantile parameter alpha. In contrast, QuantileRegressor names the target parameter quantile; that estimator's alpha controls regularization. Do not transfer the same keyword argument between the metric and estimator assuming it has the same meaning.
We checked the worksheet against scikit-learn 1.9.1 on these examples and a separate deterministic comparison grid. That validates the arithmetic convention used here; it does not validate a forecasting model on future observations.
Units, normalization and the factor of two
Pinball loss retains the units of y. If a temperature example changes from degrees to tenths of a degree, both actuals and predicted quantile values scale by ten, and the loss scales by ten. A shared additive shift does not change the residuals or loss.
The scoringutils quantile-score definition uses twice the convention shown here. Our mean 1.05 would be 2.10 under that scaling. At the median, the doubled convention equals MAE, while the undoubled one equals half MAE. Rankings at the same quantile are unchanged by multiplying every score by the same positive constant.
Compare like units, quantile levels, cases, horizons, weights and scaling. If normalizing by a reference loss, specify how the reference was constructed and handle a zero denominator separately. A dimensionless ratio is not automatically comparable across unrelated forecast tasks.
Low loss is not a coverage guarantee
In the four-case ledger, three observations are below their candidate 90th-percentile forecast and one is above. The observed below-forecast fraction is 75%, not 90%. Four records are far too few to infer a stable coverage rate.
Report quantile coverage alongside loss, with a declared convention for ties. If a forecast returns several quantiles, verify that lower quantile levels do not exceed higher ones for the same case. Quantile crossing can create an invalid ordering even though separate per-quantile losses are computable.
For a numerical prediction interval, evaluate the lower and upper endpoints with their own target levels and examine interval coverage and width. A single quantile forecast is not a two-sided interval. See our prediction versus confidence interval guide for the distinction between uncertainty about an outcome and uncertainty about an estimated parameter.
When pinball loss fits prediction-market research
A temperature, economic release or other numeric underlying outcome can be forecast using quantiles. Record the measurement unit, observation source, release vintage, deadline and forecast horizon before evaluation. A later revised release is a different target from the first published value.
A binary Yes probability is a different prediction object. Use Brier score or log loss for recorded event probabilities, and a reliability diagram for their probability-level agreement. Do not put a 70% Yes probability into a numeric quantile-value column and interpret the result as forecast skill.
Keep estimation and evaluation periods separate; the walk-forward guide describes a chronological workflow. A good score on a numeric outcome does not establish an advantage over executable market prices, fees or liquidity.
Sources reviewed December 2, 2026. All datasets, loss comparisons and charts are original synthetic examples. For general point-error summaries, continue with forecast error, MAE and RMSE, or explore Alphascope prediction-market research for event context.
To score a whole numeric forecast distribution, read the continuous ranked probability score guide and inspect the CRPS calculator. A single quantile value and an ensemble distribution are different forecast objects.