Demonstration 1 of 1
Three target policies under raw-scale RMSE and log-scale RMSLE
When the target is multiplicative and skewed, does fitting log1p(y) help, and does the answer depend on the metric and on how the prediction is brought back to the raw scale?
Squared error on log1p(y) targets a typical value, close to the median, while raw-scale RMSE targets the mean. With log-normal noise the mean exceeds the median by about exp(s squared over 2), so the plain back-transform predicts low on average, and more so as s grows; the fitted model falls a little further short than that factor alone. The smearing correction brings the average prediction most of the way back (above 80% of the target mean here) and wins on RMSE, but it moves the prediction away from the log-scale median and loses on RMSLE. Fitting the raw target needs no inverse, but it chases the extreme values.
Scroll sideways for the whole equation
y is the target, m(x) the model's predicted mean of log1p(y), e_i the cross-fitted residuals on the training rows and s the log-scale noise spread. RMSE is computed on y, RMSLE on log1p(y).
Predict first. At noise spread 0.8, which target policy has the lowest RMSLE, and which has the lowest raw-scale RMSE?
Choose an example
Scroll sideways for the whole figure
Constructed example: seeded synthetic log-normal targets and a boosted regressor, measured by the chapter activity.
Calculated values
- RMSLE, plain log fit
- 0.749
- RMSLE, raw-target fit
- 1.034
- RMSE, plain log fit
- 213.1
- RMSE, smeared log fit
- 203.4
- RMSE, raw-target fit
- 214.3
- Mean prediction, plain log fit
- 39.2
At noise spread 0.8, the plain log fit scores RMSLE 0.749 (raw-target fit 1.034) but its predictions average 39.2 against a target mean of 58.6, so 39.2 / 58.6 = 0.669 of the mean is recovered. The smearing correction lowers RMSE from 213.1 to 203.4 and raises RMSLE from 0.749 to 0.804. The raw-target fit has RMSE 214.3 and the constant 256.7.
Worked steps
- Mean recovered by the plain back-transform: 39.2 / 58.6 = 0.669.
- Gain of smearing on RMSE: 213.1 - 203.4 = +9.7 (positive means smearing is better).
- Cost of smearing on RMSLE: 0.804 - 0.749 = +0.055 (positive means smearing is worse).
- Raw-target fit against the plain log fit on RMSLE: 1.034 - 0.749 = +0.286.
Use the idea
Read the official metric, fit the target on a scale you can justify, choose the inverse policy that suits that metric, and compare against a raw-target fit and a simple predictor on the same assessment rows.
Where the conclusion applies
Constructed data with log-normal noise, one boosting model and 6,000 training rows. Raw-scale RMSE here is dominated by noise no model can remove (the known-mean line), so the raw fit and the plain log fit are within about 3% of each other for s of 0.8 and above, and their order is not stable; no claim is made about which of those two wins on RMSE. A histogram gradient boosting regressor stands in for LightGBM.
Check your understanding: Why does the plain log fit win on RMSLE yet predict an average well below the average target?
Chapter 8 source: section "Stage 4: Target Transforms".