scipy.special.boxcox1p#
- scipy.special.boxcox1p(x, lmbda, out=None) = <ufunc 'boxcox1p'>#
Compute the Box-Cox transformation of \(1 + x\).
The Box-Cox transformation computed by
boxcox1pis\[\begin{split}y = \begin{cases} ((1+x)^\lambda - 1) / \lambda & \text{if } \lambda \neq 0 \\ \log(1+x) & \text{if } \lambda = 0 \end{cases}\end{split}\]Returns
nanif \(x < -1\). Returns-infif \(x = -1\) and \(\lambda \leq 0\).- Parameters:
- xarray_like
Data to be transformed.
- lmbdaarray_like
Power parameter \(\lambda\) of the Box-Cox transform.
- outndarray, optional
Optional output array for the function values.
- Returns:
- yscalar or ndarray
Transformed data.
See also
boxcoxBox-Cox transformation.
inv_boxcox1pInverse of the Box-Cox transformation of
1 + x.
Notes
Added in version 0.14.0.
Array API Standard Support
boxcox1phas experimental support for Python Array API Standard compatible backends in addition to NumPy. Please consider testing these features by setting an environment variableSCIPY_ARRAY_API=1and providing CuPy, PyTorch, JAX, or Dask arrays as array arguments. The following combinations of backend and device (or other capability) are supported.Library
CPU
GPU
NumPy
✅
n/a
CuPy
n/a
✅
PyTorch
✅
⛔
JAX
✅
⛔
Dask
✅
n/a
See Support for the array API standard for more information.
Examples
>>> from scipy.special import boxcox1p >>> boxcox1p(1e-4, [0, 0.5, 1]) array([ 9.99950003e-05, 9.99975001e-05, 1.00000000e-04]) >>> boxcox1p([0.01, 0.1], 0.25) array([ 0.00996272, 0.09645476])