Conformal splitconformal gammascores - CyrilB1531/lodestar GitHub Wiki
Home โบ Conformal โบ Conformal prediction
The gamma calibration scores of a regressor: (y โ ลท) / ลท, for a strictly positive target.
public static double[] GammaScores(ReadOnlySpan<double> yTrue, ReadOnlySpan<double> yPredicted)Parameters โ yTrue are the observed values and yPredicted the model's predictions for
them, all strictly positive.
Returns โ one signed score per point, in the input's order. Hand them to
GammaInterval, or to
CrossConformal.GammaInterval when the predictions are out of
sample.
Exceptions โ ArgumentException when the spans have different lengths;
ArgumentOutOfRangeException when a value or a prediction is zero, negative or NaN.
Example โ a relative error, signed.
using Lodestar.Conformal;
double[] scores = SplitConformal.GammaScores([10.2, 12.6], [10.7, 11.8]);
double under = scores[0]; // => -0.04672897196261683
double over = scores[1]; // => 0.06779661016949143Remarks โ MAPIE's GammaConformityScore: where the error grows with the target โ prices,
durations, counts โ a relative score gives an interval proportional to the prediction, and a
signed one lets the two sides differ. A non-positive value is refused, as MAPIE refuses it, since
the score's support is the positive reals.
Applies to โ net10.0, netstandard2.0.
See also โ SplitConformal.GammaInterval,
SplitConformal.AbsoluteResiduals.