What is log transformation in feature engineering and when should it be used?

Updated May 16, 2026

Short answer

Log transformation reduces skewness and stabilizes variance in highly skewed data.

Deep explanation

Log transformation compresses large values and expands small values, making distributions more normal-like. It is commonly used when data has exponential growth patterns or extreme outliers. Many machine learning models perform better when data is closer to Gaussian distribution.

Real-world example

Used in housing price prediction where prices vary exponentially across cities.

Common mistakes

  • Applying log transformation to zero or negative values without using log1p.

Follow-up questions

  • What is log1p function?
  • When should you avoid log transformation?

More Feature Engineering interview questions

View all →