mlforecast/global-target-without-inverse
| Pack | Severity | Fix | Versions |
|---|---|---|---|
| MLForecast | error | none, edit by hand | All versions |
GlobalSklearnTransformer calls inverse_transform on predictions at forecast time. When wrapping FunctionTransformer(func) without inverse_func, inverse_transform returns predictions unchanged in transformed units without raising an error.
tfm = GlobalSklearnTransformer(FunctionTransformer(np.log1p))tfm = GlobalSklearnTransformer(FunctionTransformer(np.log1p, inverse_func=np.expm1))What the rule reports
Section titled “What the rule reports”Calls to mlforecast.target_transforms.GlobalSklearnTransformer wrapping a FunctionTransformer with a forward func and no inverse_func (or inverse_func=None).
How to fix it
Section titled “How to fix it”Supply the matching inverse_func on FunctionTransformer, or use a reversible transformer such as PowerTransformer, QuantileTransformer, or RobustScaler.
Diagnostic message
Section titled “Diagnostic message”GlobalSklearnTransformer wraps a FunctionTransformer with no inverse_func, so MLForecast.predict returns transformed target units without error. Pass inverse_func= to FunctionTransformer or use a reversible scaler.See all rules in the MLForecast pack.