← Lessons

quiz vs the machine

Gold1400

Machine Learning

Log and Power Transforms

Reshape skewed features toward symmetry with log and power transforms like Box Cox.

5 min read · core · beat Gold to climb

Log and Power Transforms

Many real features are right skewed, with a long tail of large values such as income or city population. Log and power transforms compress that tail toward a more symmetric shape that many models prefer.

Common transforms

  • Log transform replaces a value with its logarithm, sharply compressing large values. Use log of one plus the value to handle zeros.
  • Square root offers a milder compression for moderate skew.
  • Box Cox searches a power parameter that best normalizes strictly positive data.
  • Yeo Johnson extends power transforms to handle zero and negative values.

Why it helps

  • It reduces skew, making distributions closer to normal.
  • It stabilizes variance across the range, helping linear models and regression assumptions.
  • It can linearize multiplicative relationships into additive ones.

Remember that transforming a target changes the units of predictions, so you must invert the transform to report results on the original scale.

Key idea

Log and power transforms compress skewed features toward symmetry and stable variance, with Box Cox and Yeo Johnson choosing the power automatically.

Check yourself

Answer to earn rating on the learn ladder.

1. Why use log of one plus the value instead of plain log?

2. What advantage does Yeo Johnson have over Box Cox?

3. What must you do after transforming the target variable?