liveBook · Manning

Log transformation

A log transformation maps numerical values through a logarithmic function, changing their scale and often compressing large values or converting multiplicative relationships to additive ones.

How 2 Manning books explain it

Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI

A log transformation applies a logarithm to values, converting multiplicative relationships into additive ones and changing their scale.

How it is used
Use it to make a right-skewed positive target easier to inspect and to support positive predictions in linear models.
How deep it goes
Explains target transformation through plots and NumPy code, while noting persistent outliers rather than deriving logarithms mathematically.
Examples
Demonstrates np.log1p on listing prices with histograms and boxplots, then reconstructs a SHAP-based prediction by exponentiating and multiplying values.
What you can do after
Apply it via NumPy to transform a positive price target and evaluate the distribution with histograms and boxplots.

Read how Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI explains log transformation →

Ensemble Methods for Machine Learning

A log transformation maps a nonnegative value y to log(1+y), avoiding the undefined logarithm of zero while compressing large values.

How it is used
Diagnoses count-target shape and guides distribution or link-function choices for regression modeling.
How deep it goes
Defines the transformation and its purpose, then stops at distributional interpretation rather than implementation details.
Examples
Uses casual-user counts from the Bike Sharing data and compares their original and transformed histograms.
What you can do after
Evaluate count-label distributions and select plausible Tweedie or log-link modeling assumptions.

Read how Ensemble Methods for Machine Learning explains log transformation →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.