Skip to main content

Module ndtri

Module ndtri 

Source
Expand description

Inverse normal CDF via a Cephes ndtri port.

scipy.special.ndtri is the Cephes ndtri (Moshier). QuantileTransformer uses stats.norm.ppf (= ndtri) for the normal output distribution, then clips to [ndtri(BOUNDS_THRESHOLD - eps), ndtri(1 - (BOUNDS_THRESHOLD - eps))] where BOUNDS_THRESHOLD = 1e-7 and eps = np.spacing(1).

The central |y-0.5| ≤ 3/8 branch and the two z = sqrt(-2 ln y) tail branches match scipy bit-for-bit on the same architecture. Cross-arch (arm vs x86) the last bits of the transcendental can differ by ≤1 ULP; compat tests use ≤1e-12 relative tolerance for normal output.

Constants§

CLIP_MAX
stats.norm.ppf(1 - (BOUNDS_THRESHOLD - np.spacing(1))) — the clip ceiling.
CLIP_MIN
stats.norm.ppf(BOUNDS_THRESHOLD - np.spacing(1)) — the clip floor for normal output. Pre-computed constant; cross-arch ndtri of this input is bit-identical because the argument is deep in a tail, fully polynomial.

Functions§

ndtri
Inverse standard normal CDF: the x for which Φ(x) = y. Cephes ndtri.