Conformal conformalquantilerule - 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.

HomeConformalSplit conformal prediction

ConformalQuantileRule

Which order statistic SplitConformal.Quantile reads from the calibration scores.

public enum ConformalQuantileRule { Ceiling, MapieClassification }

MembersCeiling reads the k-th smallest score, k = ceil((n + 1)(1 − alpha)), which is what MAPIE 1.5.0's SplitConformalRegressor reads, and the default. MapieClassification reads numpy.quantile(scores, (n + 1)(1 − alpha)/n, method="higher"), which is what MAPIE's SplitConformalClassifier reads before predict_set.

Example — nineteen scores at 10 % miscoverage, where the two rules part by one rank.

using Lodestar.Conformal;

double[] scores = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19];

double ceiling = SplitConformal.Quantile(scores, 0.1);                                           // => 18
double mapie = SplitConformal.Quantile(scores, 0.1, ConformalQuantileRule.MapieClassification);   // => 19

Remarks — the two rules agree on most (n, alpha) pairs and part by one rank on the rest, so a prediction set can include or exclude a class differently. Take MapieClassification when the sets must match MAPIE's; Ceiling is kept as the default so an existing call keeps its answer. Decision 0005 has the measurement and why the default did not move.

Ceiling is the zero value, so a default(ConformalQuantileRule) reads the default rule. A value outside the two, a cast from an int most likely, is refused with ArgumentOutOfRangeException.

Applies to — net10.0, netstandard2.0.

See alsoSplitConformal.Quantile, SplitConformal.PredictionSet, the Python equivalence table.