Add time series converter for regression forecasting - #847
Merged
Merged
Conversation
Reshapes a date column and a target series into lag_k..lag_1 plus target, so a forecasting dataset can be trained with RegressionTask and the regressors that already exist. Supervised, since the series to window is the target rather than something in scope, and row count changing, since the windowed rows no longer correspond to the original ones and the date column cannot come with them.
cristian-tamblay
force-pushed
the
feat/time-series-window-converter
branch
from
August 31, 2026 22:27
e74cd8e to
7f5809f
Compare
cristian-tamblay
approved these changes
Sep 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
TimeSeriesWindowConverter, which reshapes a forecasting dataset into the supervised rows a regression model needs. Second of four branches implementing forecasting.A forecasting dataset is a date column and a value column: one row per point in time, with nothing to regress on. The converter turns it into
lag_k, ..., lag_1, target, where each row carries thekvalues that came beforetarget. That is a plain tabular regression problem, so the result is used with the existingRegressionTaskand the regressors DashAI already has, rather than needing anything new.Given a window of 3 and the series 100, 120, 115, 140, 150, 160:
Type of Change
Check all that apply like this [x]:
Changes (by file)
DashAI/back/converters/simple_converters/time_series_window.py: new converter.SUPERVISED = True, since the series to window is the target rather than something in scope, so it arrives asy.CHANGES_ROW_COUNT = True, since the return value replaces the whole dataset, which is what lets the date column disappear and the lag columns be the entire output. Scope acceptsDateonly;window_sizeis the single parameter.DashAI/back/initial_components.py: register the converter.tests/back/converters/test_time_series_window.py: new. 12 tests, the first being the example above asserted cell for cell.Testing (optional)
Notes (optional)
Two consequences are documented in the component description, since neither is obvious from the UI:
k - 1values, so a shuffling splitter puts near duplicate rows on both sides of a split and reports a score that is too good. Split chronologically.Rows are sorted by date before windowing, so source ordering does not matter. Refused: repeated dates, a missing or non-numeric target, a scope that is not exactly one
Datecolumn, and a window leaving no complete row. Irregular spacing warns rather than blocks, since a lag then covers a different span for different rows, but monthly data with 28, 30 and 31 day steps is legitimate.Multi horizon targets are out of scope:
RegressionTaskhasoutputs_cardinality = 1, so they would have nowhere to go until a multi output regression task exists.