Skip to content
Quantoros

A regressor is trained on log1p(y). How can you ensure predict returns values in the original target units?

Classic MLLevel: IntermediateTarget inverse at prediction

A regressor is trained on log1p(y). How can you ensure predict returns values in the original target units?

Hints
  • Pair the forward and inverse transformations.
  • The inverse of an expected log is not generally an expected level.

Answer

Wrap it in TransformedTargetRegressor with func=log1p and inverse_func=expm1. This handles transformation consistently, but does not automatically correct retransformation bias for a conditional mean.

Source and licence: scikit-learn 1.7.2 — compose · BSD-3-Clause · answer: Quantoros editorial

Related questions