The Yeo-Johnson transformation is an extension of the Box-Cox transformation and can be used on variables with zero and negative values, as well as positive values. These transformations can be defined as follows:
- ; if λ is not 0 and X >= zero
- ln(X + 1 ); if λ is zero and X >= zero
- ; if λ is not 2 and X is negative
- -ln(-X + 1); if λ is 2 and X is negative
In this recipe, we will perform the Yeo-Johnson transformation using SciPy, scikit-learn, and Feature-engine.