Feature engineering and preprocessing · insight-0121
When you log-transform a skewed target, correct the back-transformed predictions toward the mean
- Evidence type
- documented fact
- Difficulty
- medium
- Roles
- Data scientist, ML engineer
- Industries
- aviation, retail
Summary: situation, action, reason, boundary
Situation
You model log(revenue) or log(demand) and exponentiate predictions to report totals.
Action
Use TransformedTargetRegressor to keep the transform consistent, then apply a bias adjustment or calibrate predictions on validation data when totals matter.
Reason
The exponential of an expected log is below the expected value for a right-skewed variable, so naive back-transformation is biased low.
Boundary
Revenue, demand, price and duration targets modelled on a log or Box-Cox scale.
Symptom or risk
Back-transformed predictions estimate the median, not the mean; summed forecasts fall systematically short of actual totals.
Exceptions
If the decision needs a median (typical case) rather than a total, the unadjusted back-transform is the right quantity.
Trade-offs
Bias adjustment improves totals but can worsen per-row absolute error.
Pitfalls
Comparing a log-scale RMSE with an original-scale RMSE from another model.
Lessons and concepts
Claims and their sources
Back-transformed forecasts from a log or Box-Cox model estimate the median; a bias adjustment is needed for the mean (fpp3, forecasting with transformations).
TransformedTargetRegressor applies a target transform for fitting and its inverse for prediction.