Your demand model's stockouts cost four times what excess inventory does — how do you reflect that in the loss?
answer
- an asymmetric linear cost has a name
- the cost ratio maps to a level
- under-cost over the total of both costs
- four over five gives the level
- when costs curve, split model from decision
basics
~20 sA four-to-one cost ratio is pinball loss with tau = 4/(4+1) = 0.8, so forecast the 80th percentile of demand rather than the mean. Confirm the ratio is real, linear and stable before baking it into training.
solid answer
~50 sIf under-forecasting costs `c_under` per unit and over-forecasting `c_over` per unit, minimising expected cost is exactly minimising pinball loss at `tau = c_under / (c_under + c_over)`. With a four-to-one ratio that is `4 / 5 = 0.8`, so train at `tau = 0.8` and the model forecasts the 80th percentile of demand instead of the mean -- the cost asymmetry is expressed once, in the objective, rather than as a margin someone adds by hand downstream. Before adopting it I would pressure-test the ratio: who owns those two numbers, does the same ratio hold for a perishable SKU as for a durable one, and is the cost really linear in the size of the miss. Where costs are strongly non-linear or vary by item, the better structure is a distributional forecast plus an explicit expected-cost decision on top, keeping the model stable while the economics change.
go deeper
Know that when one direction of error is more expensive, the fix belongs in the training objective rather than in a manual adjustment afterwards, and that an asymmetric loss shifts the whole forecast.
Be able to derive the level from the costs: the under-cost divided by the sum of both costs, giving 0.8 for a four-to-one ratio, and to say that the model then forecasts the 80th percentile rather than the mean.
Show that you would validate the ratio's provenance and stability, expect the symmetric accuracy dashboard to degrade by design, and measure success in realised money rather than error units.
Own the architectural call: bake tau into the loss only while the cost structure is simple and stable, otherwise separate a distributional forecast from an explicit expected-cost decision so economics and modelling can change independently. Name who owns the ratio and how often it is reviewed.
## The mechanical answer Suppose missing a unit of demand costs `c_under` (lost margin, an expedited shipment, a broken promise) and holding a surplus unit for the period costs `c_over` (capital, space, spoilage). Total cost is linear in the size of the miss in each direction, with different slopes. That is precisely the shape of pinball loss, and matching the slopes gives ``` tau = c_under / (c_under + c_over) ``` With `c_under = 4` and `c_over = 1`, `tau = 0.8`. Train the demand model with pinball loss at 0.8 and its output is the conditional 80th percentile of demand. This is the same critical ratio that classical inventory theory derives for the single-period stocking problem, arrived at from the loss side rather than the operations side. Two independent derivations landing on the same number is a good sign you have it right. What changes in practice: forecasts rise, and they rise **unevenly**. Where the model is confident, the 80th percentile sits close to the median; where demand is volatile, it sits far above. That variable padding is the entire benefit over the naive alternative. ## Why the naive alternatives are worse - **A flat safety margin on a mean forecast.** "Add 15 percent" applies identical padding to a stable SKU and an erratic one. It over-stocks the predictable items and still stocks out on the volatile ones, and nobody can say what 15 percent was supposed to buy. - **Row weighting.** Up-weighting historical stockout rows changes which observations the fit listens to, not which functional of the distribution it targets. It moves the forecast in a direction nobody can specify in advance. - **Fixing it in review.** Letting planners manually mark forecasts up hides the policy in a spreadsheet, makes the model's error metrics meaningless, and loses the adjustment the moment that planner leaves. The pinball formulation puts one number -- tau -- in the objective, derived from two business numbers, and everything downstream is explainable from it. ## Where the mechanical answer stops being enough This is the part that separates a principal answer from a competent one. `tau = 0.8` is correct **if** the cost model is correct, and the cost model is a simplification in at least four ways. **Linearity.** The formula assumes each additional unit short costs the same as the last. Often it does not: a small shortfall is absorbed by a substitute item, while a large one loses the customer's whole basket and possibly the customer. Over-stock is frequently worse than linear too -- for a perishable item, surplus beyond the shelf life is written off entirely, so the cost jumps at a threshold rather than accumulating smoothly. Where the curvature is real, a single tau cannot express it. **Heterogeneity.** One ratio for the whole catalogue is almost certainly wrong. A high-margin hero SKU with a fragile customer relationship and a long-tail commodity item do not share a four-to-one ratio. Segment-level taus are legitimate; a single global one is a decision to ignore the variation. **Provenance and stability.** Someone produced "four times", and you should know who and from what. Margins move, holding costs move with capital costs and warehouse utilisation, and a ratio derived in one season may not survive the next. Treat the ratio as a versioned input with an owner and a review cadence, not a constant compiled into a training script. **Measurement optics.** A `tau = 0.8` model deliberately forecasts high, so it will look worse on any symmetric error dashboard than the mean model it replaced. That is by construction, not a regression, and it must be agreed with stakeholders **before** launch. The right scoreboard is realised cost -- stockout incidents and holding cost together -- not a symmetric accuracy number. Teams that skip this conversation get the model reverted by someone reading the old dashboard. ## The more durable structure When costs are non-linear, item-specific, or expected to change often, the cleaner separation is: 1. The model forecasts the **distribution** of demand -- several quantiles, or a parametric spread alongside the central estimate. 2. A separate decision layer picks the order quantity minimising expected cost under the current cost function, whatever shape it has. The model then stops being a hostage to the economics. When finance revises the holding cost, the decision layer changes and no retraining happens. When the demand pattern shifts, the model is retrained and the economics are untouched. Baking tau into the loss couples the two, which is fine when the ratio is stable and simple, and a liability when it is neither. Knowing which situation you are in -- and saying so -- is the actual answer to this question. ## Guardrails to state Whatever you choose, commit to measuring it in money: realised stockout events against realised excess, priced with the same two numbers that set tau. If the realised ratio of the two cost buckets does not resemble the ratio you assumed, the assumption was wrong, and that is a finding rather than a failure.
- Where exactly does tau = 0.8 come from for a four-to-one cost ratio?Pinball loss charges tau per unit of under-prediction and one minus tau per unit of over-prediction, so their ratio is tau over one minus tau. Setting that equal to four gives tau equal to four fifths. Equivalently tau equals the under-cost divided by the sum of both costs, the same critical ratio classical single-period inventory theory produces.
- When is a single tau the wrong instrument for an asymmetric cost?When the cost is not linear in the size of the miss -- a perishable's surplus is written off at a shelf-life threshold rather than accruing smoothly -- or when the ratio varies by item or season. Then forecast the demand distribution and put an explicit expected-cost decision on top, so the economics can change without retraining the model.
- How do you handle the model looking worse on the existing accuracy dashboard after this change?Agree before launch that it will. A model deliberately forecasting the 80th percentile is biased high on purpose, so a symmetric error metric must degrade. Replace the acceptance criterion with realised cost -- stockout incidents and holding cost priced with the same two numbers that set tau -- and keep the old metric only as a drift monitor.
- What would make you challenge the four-to-one number itself before using it?That it has no named owner, that it is applied uniformly across a catalogue with very different margins and shelf lives, or that it was derived once and never revisited while margins and holding costs moved. I would treat it as a versioned, reviewed input with a stated derivation, not a constant embedded in the training code.
Setting tau is choosing how far up the distribution to aim, and the cost ratio does the aiming for you: the more painful running short is, the higher you aim.
saying these in an interview costs you the question
- Sets tau to 0.75 or 4, confusing the ratio with the level
- Adds a flat percentage margin to a mean forecast instead
- Assumes one cost ratio holds across an entire catalogue
- Never questions where the four-to-one figure came from
- Judges the new model on a symmetric error dashboard
- Reweights historical stockout rows and calls it cost-sensitive