Skip to content

Preprocessing quantiletransformer inversetransform

github-actions[bot] edited this page Sep 24, 2026 · 3 revisions

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

HomePreprocessingFeature transforming

QuantileTransformer.InverseTransform

Maps back onto the fitted values.

public double[] InverseTransform(ReadOnlySpan<double> samples)

Parameterssamples is a matrix this transformer produced, row-major, FeatureCount values per row.

Returns — a new matrix of the same shape, each value read back through the fitted quantiles.

ExceptionsArgumentException when samples holds a partial row or a non-finite value.

Example — the middle of the distribution, in the units it came from.

using Lodestar.Preprocessing;

double[] skew = [1.0, 1.0, 2.0, 3.0, 5.0, 8.0, 13.0, 21.0, 34.0, 100.0];

QuantileTransformer transformer = QuantileTransformer.Fit(skew, 1);

double median = transformer.InverseTransform([0.5])[0];   // => 6.5

Remarks — the round trip is not exact, and the loss is in the forward direction. Transforming and inverting a fitted value returns it, because it is one of the knots; transforming and inverting anything else returns the point the piecewise-linear map lands on, which is only as close as the quantile count allows. Two distinct values that shared a rank come back as the same number.

Under QuantileOutput.Normal the input is read as a normal quantile first, with the same 1e-7 threshold pinning the two ends, so an inverse of ±5.2 or beyond returns the fitted extreme rather than running off the end of the knots.

Applies to — net10.0, netstandard2.0.

See alsoQuantileTransformer.Transform, QuantileTransformer.

Clone this wiki locally