pmdarima.preprocessing
.BoxCoxEndogTransformer
- class pmdarima.preprocessing.BoxCoxEndogTransformer(lmbda=None, lmbda2=0, neg_action='raise', floor=1e-16)[source][source]
Apply the Box-Cox transformation to an endogenous array
The Box-Cox transformation is applied to non-normal data to coerce it more towards a normal distribution. It’s specified as:
(((y + lam2) ** lam1) - 1) / lam1, if lmbda != 0, else log(y + lam2)
- Parameters:
lmbda : float or None, optional (default=None)
The lambda value for the Box-Cox transformation, if known. If not specified, it will be estimated via MLE.
lmbda2 : float, optional (default=0.)
The value to add to
y
to make it non-negative. If, after addinglmbda2
, there are still negative values, a ValueError will be raised.neg_action : str, optional (default=”raise”)
How to respond if any values in
y <= 0
after addinglmbda2
. One of (‘raise’, ‘warn’, ‘ignore’). If anything other than ‘raise’, values <= 0 will be truncated to the value offloor
.floor : float, optional (default=1e-16)
A positive value that truncate values to if there are values in
y
that are zero or negative andneg_action
is not ‘raise’. Note that if values are truncated, invertibility will not be preserved, and the transformed array may not be perfectly inverse-transformed.
Methods
fit
(y[, X])Fit the transformer
fit_transform
(y[, X])Fit and transform the arrays
get_metadata_routing
()Get metadata routing of this object.
get_params
([deep])Get parameters for this estimator.
inverse_transform
(y[, X])Inverse transform a transformed array
set_output
(*[, transform])Set output container.
set_params
(**params)Set the parameters of this estimator.
transform
(y[, X])Transform the new array
Examples using pmdarima.preprocessing.BoxCoxEndogTransformer
Displaying key timeseries statistics