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.
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.
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
- labeluses · A label is a value or annotation associated with an item that identifies its target category, outcome, or reference answer for learning or evaluation.
- elliptic envelopeuses · An elliptic envelope is a robust covariance-based outlier detector that fits an enclosing ellipse to identify observations outside an estimated central region.
- skewaddresses · Skewness is a measure of the direction and degree of asymmetry in a probability distribution or observed data around its center.
- logarithmuses · A logarithm is the exponent to which a specified positive base other than one must be raised to produce a given positive number.
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.

