Skip to content

Add time series converter for regression forecasting - #847

Merged
cristian-tamblay merged 2 commits into
developfrom
feat/time-series-window-converter
Sep 1, 2026
Merged

cristian-tamblay merged 2 commits into
developfrom
feat/time-series-window-converter

Conversation

@Irozuku

@Irozuku Irozuku commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

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 the k values that came before target. That is a plain tabular regression problem, so the result is used with the existing RegressionTask and the regressors DashAI already has, rather than needing anything new.

Given a window of 3 and the series 100, 120, 115, 140, 150, 160:

lag_3,lag_2,lag_1,target
100,120,115,140
120,115,140,150
115,140,150,160

Type of Change

Check all that apply like this [x]:

  • Backend change
  • Frontend change
  • CI / Workflow change
  • Build / Packaging change
  • Bug fix
  • Documentation

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 as y. 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 accepts Date only; window_size is 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)

  • Apply the converter to a time series dataset and train a regression task.

Notes (optional)

Two consequences are documented in the component description, since neither is obvious from the UI:

  • Everything outside the scope and the target is discarded, because the windowed rows no longer correspond to the original ones.
  • Consecutive rows overlap by k - 1 values, 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 Date column, 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: RegressionTask has outputs_cardinality = 1, so they would have nowhere to go until a multi output regression task exists.

@Irozuku Irozuku added the back Backend work label Aug 31, 2026
Base automatically changed from feat/date-column-type to develop August 31, 2026 22:27
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
cristian-tamblay force-pushed the feat/time-series-window-converter branch from e74cd8e to 7f5809f Compare August 31, 2026 22:27
@cristian-tamblay
cristian-tamblay merged commit 4daa44f into develop Sep 1, 2026
21 checks passed
@cristian-tamblay
cristian-tamblay deleted the feat/time-series-window-converter branch September 1, 2026 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

back Backend work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants