Conformal splitconformal interval - CyrilB1531/lodestar GitHub Wiki

Development build. This page describes main, not a released package. The latest published Lodestar.Conformal is 0.1.0 โ€” read its documentation.

Home โ€บ Conformal โ€บ Split conformal prediction

SplitConformal.Interval

The prediction interval around a point prediction: [ลท โˆ’ q, ลท + q].

public static (double Lower, double Upper) Interval(double prediction, double quantile)

Parameters โ€” prediction is the model's point prediction for one new sample. quantile is the calibrated quantile from Quantile.

Returns โ€” a (double Lower, double Upper) tuple. Lower is prediction โˆ’ quantile and Upper is prediction + quantile, in the target's own units.

Exceptions โ€” ArgumentOutOfRangeException when quantile is negative or NaN.

Example โ€” a prediction of 11.0 with a calibrated quantile of 0.4.

using Lodestar.Conformal;

(double Lower, double Upper) interval = SplitConformal.Interval(11.0, 0.4);
double lower = interval.Lower;   // => 10.6
double upper = interval.Upper;   // => 11.4

Remarks โ€” the arithmetic is the least interesting part of split conformal prediction, and that is the point: everything that carries the guarantee already happened in Quantile. Calling this with a quantile you computed some other way produces an interval with no guarantee at all and no way to tell from the output.

An infinite quantile yields the whole line, which is the trivial prediction the calibration size forced โ€” see Quantile and decision 0007. A zero quantile yields the point back, which happens when every calibration prediction was exact and is almost always a leaking split rather than a perfect model.

The guarantee assumes exchangeability โ€” see the guide's Exchangeability section.

Applies to โ€” net10.0, netstandard2.0.

See also โ€” SplitConformal.AbsoluteResiduals, SplitConformal.Quantile, the Python equivalence table.