Skip to content

Metrics d2pinball

github-actions[bot] edited this page Aug 26, 2026 · 24 revisions

Development build. This page describes main, not a released package. The latest published Lodestar.Metrics is 0.3.0 — read its documentation.

D2Pinball

R2's question asked of a quantile prediction: what fraction of the PinballLoss the model explains, against the baseline of predicting one constant — the weighted quantile of the truth at the same alpha.

1 is a perfect prediction, 0 is one no better than that constant, and negative is worse. It is the score to report beside a quantile model, because the raw pinball loss is in the target's units and says nothing about whether the model beat a flat guess.

At alpha = 0.5 it is D2AbsoluteError exactly. That is an invariant no oracle states — the two reach their denominator through different code, a quantile at one half and a median — so the test suite asserts it across every fixture of the frozen corpus rather than trusting it.

A column whose truth never varies scores 0

The constant baseline is already perfect and the denominator is zero. The reference masks that case and returns 0 rather than dividing, and so does this — unlike D2Tweedie, which raises on the same input because its own reference does.

Below two samples the answer is nan, which scikit-learn warns about and returns; zeroDivision offers 0, 1 or a refusal instead, as R2.Score does for the identical case.

Members

Member What it does
D2Pinball.Score The explained fraction, one number for the whole prediction.
D2Pinball.PerOutput The same, one number per output column.

Lodestar

Project

Clone this wiki locally