pub struct BoxCox { /* private fields */ }Expand description
A transformer that applies the Box-Cox transformation to each item.
The Box-Cox transformation is defined as:
- if lambda == 0: x.ln()
- otherwise: (x^lambda - 1) / lambda
By default the optimal lambda parameter is found from the data in
transform using maximum likelihood estimation. If you want to use a
specific lambda value, you can use the with_lambda method.
Note that unlike the scikit-learn implementation, this transform does not
standardize the data after applying the transformation. This can be done
by using the StandardScaler transformer inside a Pipeline.
Implementations§
Source§impl BoxCox
impl BoxCox
Sourcepub fn with_lambda(self, lambda: f64) -> Result<Self, Error>
pub fn with_lambda(self, lambda: f64) -> Result<Self, Error>
Set the lambda parameter for the Box-Cox transformation.
§Errors
This function returns an error if the lambda parameter is NaN.
Sourcepub fn ignore_nans(self, ignore_nans: bool) -> Self
pub fn ignore_nans(self, ignore_nans: bool) -> Self
Set whether to ignore NaN values when calculating the transform.
If true, NaN values will be ignored when calculating the optimal
lambda and simply passed through the transform.
Defaults to false.