#4796·sktime

[BUG] make_reduction doesn't respect a transformer's `truncate="bfill"`.

Author: davidgilbertsonCreated Jun 29, 2023Updated Sep 27, 2026
Labelsbugmodule:forecasting

Describe the bug make_reduction or RecursiveTabularRegressionForecaster, etc will always remove rows from my training data (equal to the number of lags), even if I set window_length=None and pass in a WindowSummarizer with trunctate="bfill".

To Reproduce

I have this code in a pipeline:

python
make_reduction(
    HistGradientBoostingRegressor(),
    transformers=[
        WindowSummarizer(
            lag_feature={"lag": [1, 2]},
            truncate="bfill",
        ),
    ],
    pooling="global",
    window_length=None,
)

If I use that WindowSummarizer outside of make_reduction, it behaves as expected and fills in the NAs resulting from the .shift() operation.

But in a reducer, it chops the DF without checking this truncate setting. The chopping code is here: https://github.com/sktime/sktime/blob/ab9b2fe8325eb20c865bee24b72d75759bffff8c/sktime/forecasting/compose/_reduce.py#L141

Expected behavior It should either look at the transformer setting, or just check for NaNs and only cut if it needs to.

Additional context If this requires significant rework anyway, it would be great to have more flexible nan handling. Some models handle NA so I want to keep them, sometimes I want to use -1, or 0, or something else.

Versions

System: python: 3.10.8 (main, Oct 12 2022, 19:14:26) [GCC 9.4.0] executable: /home/davidg/.virtualenvs/learning/bin/python machine: Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.31 Python dependencies: pip: 23.1.2 sktime: 0.19.1 sklearn: 1.2.2 numpy: 1.24.3 scipy: 1.10.1 pandas: 2.0.1 matplotlib: 3.7.0 joblib: 1.2.0 statsmodels: 0.13.5 numba: None pmdarima: 2.0.3 tsfresh: None tensorflow: None tensorflow_probability: None