![]() |
VOOZH | about |
The Yeo-Johnson Transform is a statistical method used to stabilize variance and make data more closely resemble a normal distribution. It is an extension of the Box-Cox Transform, but unlike Box-Cox, it can handle both positive and negative values. This makes it especially useful in data preprocessing for machine learning models that require normally distributed or symmetrically distributed data, such as linear regression or principal component analysis (PCA).
Traditional transformations like logarithms only work for positive data, but the Yeo-Johnson transform can be applied to a wider range of datasets, improving model performance by reducing the impact of skewed data. Essentially, it helps normalize data for algorithms that perform better when data is more evenly distributed.
The Yeo-Johnson transformation is defined piecewise depending on whether the input value is non-negative or negative, and it is parameterized by a transformation parameter . The transform is given by:
Handles Zero and Negative Values: Unlike the Box-Cox transform, the Yeo-Johnson transform works for all real-valued inputs.
The plot of the transformation for various values of π shows how the curve adjusts data with different distributions. For instance:
Visualizing the transformation helps in understanding the impact on data distribution, particularly the left or right skew.
The optimal value of Ξ» is typically chosen to maximize the log-likelihood of the transformed data under the assumption of normality. This involves solving:
Where:
Scikit-learn, SciPy, and R provide built-in methods to compute this.
The Yeo-Johnson transform is especially useful in preprocessing pipelines in machine learning workflows. It is commonly used for:
It is often applied using scikit-learnβs PowerTransformer class:
Transform | Handles Negatives | Non-linear | Optimal Ξ» | Common Use |
|---|---|---|---|---|
Log Transform | No | Yes | No | Skewed Positives |
Box-Cox | No | Yes | Yes | Normalization |
Yeo-Johnson | Yes | Yes | Yes | Robust Normalization |
The Yeo-Johnson transform can be viewed as a composition of two conditional transformations:
For positive inputs, we essentially apply the Box-Cox transform to π¦ + 1. This ensures that zero is handled safely.
For negative inputs, the function reflects the value (via β π¦ + 1) and applies a different parameter 2 β π, maintaining symmetry in transformation while avoiding the logarithm of negative numbers.
This design maintains differentiability and allows a unified optimization of π.