Compute the percentile of the data along the specified axis, ignoring NaN values.
JAX implementation of numpy.nanpercentile()
.
a (ArrayLike) – N-dimensional array input.
q (ArrayLike) – scalar or 1-dimensional array specifying the desired quantiles. q
should contain integer or floating point values between 0
and 100
.
axis (int | tuple[int, ...] | None) – optional axis or tuple of axes along which to compute the quantile
out (None) – not implemented by JAX; will error if not None
overwrite_input (bool) – not implemented by JAX; will error if not False
method (str) – specify the interpolation method to use. Options are one of ["linear", "lower", "higher", "midpoint", "nearest"]
. default is linear
.
keepdims (bool) – if True, then the returned array will have the same number of dimensions as the input. Default is False.
interpolation (str | DeprecatedArg) – deprecated alias of the method
argument. Will result in a DeprecationWarning
if used.
An array containing the specified percentiles along the specified axes.
Examples
Computing the median and quartiles of a 1D array:
>>> x = jnp.array([0, 1, 2, jnp.nan, 3, 4, 5, 6]) >>> q = jnp.array([25, 50, 75])
Because of the NaN value, jax.numpy.percentile()
returns all NaNs, while nanpercentile()
ignores them:
>>> jnp.percentile(x, q) Array([nan, nan, nan], dtype=float32) >>> jnp.nanpercentile(x, q) Array([1.5, 3. , 4.5], dtype=float32)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.3