Expand description
Per-column forward transform — sklearn QuantileTransformer._transform_col.
Forward map:
- Double-interp averaging (handles ties):
0.5 * (interp(x, quantiles, refs) - interp(-x, -quantiles[::-1], -refs[::-1])) - Force boundary values to 0/1. Uniform detects boundaries by exact equality
(
x == quantiles[0]/x == quantiles[-1]); normal detects them by a±BOUNDS_THRESHOLDband (x - t < lo/x + t > hi), matching sklearn’s distribution-dependent bound masks. - For normal output: apply
ndtrithen clip to[CLIP_MIN, CLIP_MAX].
Uniform output is purely linear interpolation → BIT-EXACT vs sklearn (0 ULP).
Normal output adds the Cephes ndtri transcendental; cross-arch last bits can
differ ≤1 ULP, so compat tolerance is ≤1e-12 relative.
Enums§
Functions§
- transform_
col - Transform a single column in place, matching
_transform_col(inverse=False). - transform_
matrix - Transform every column of the matrix (row-major
data,n_rows × n_cols).