Skip to main content

Module transform

Module transform 

Source
Expand description

Per-column forward transform — sklearn QuantileTransformer._transform_col.

Forward map:

  1. Double-interp averaging (handles ties): 0.5 * (interp(x, quantiles, refs) - interp(-x, -quantiles[::-1], -refs[::-1]))
  2. Force boundary values to 0/1. Uniform detects boundaries by exact equality (x == quantiles[0] / x == quantiles[-1]); normal detects them by a ±BOUNDS_THRESHOLD band (x - t < lo / x + t > hi), matching sklearn’s distribution-dependent bound masks.
  3. For normal output: apply ndtri then 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§

OutputDistribution

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).