Skip to content

Generate timestamps for time series predictions without test data#1536

Open
Copilot wants to merge 10 commits intomainfrom
copilot/fix-issue-1506
Open

Generate timestamps for time series predictions without test data#1536
Copilot wants to merge 10 commits intomainfrom
copilot/fix-issue-1506

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 25, 2026

Why are these changes needed?

TimeSeriesDataset.prettify_prediction() previously raised when no test data was available. This change generates future timestamps from the dataset frequency and last known timestamp, and keeps prediction values for DataFrame, Series, and ndarray inputs. It also makes create_forward_frame() use pandas offsets for anchored frequencies.

Related issue number

Closes #1506

Checks

  • I've used pre-commit to lint the changes in this PR (note the same in integrated in our CI checks). Ran python -m ruff check flaml/automl/time_series/ts_data.py test/automl/test_ts_data.py instead.
  • I've included any doc changes needed for https://microsoft.github.io/FLAML/. See https://microsoft.github.io/FLAML/docs/Contribute#documentation to build and test documentation locally. No doc changes needed.
  • I've added tests (if relevant) corresponding to the changes introduced in this PR.
  • I've made sure all auto checks have passed. Local targeted tests passed; CI has not been observed yet.

Copilot AI and others added 7 commits April 25, 2026 12:47
Agent-Logs-Url: https://github.com/microsoft/FLAML/sessions/e8fc3b11-897f-4326-8db6-abc2c8f19dd5

Co-authored-by: thinkall <3197038+thinkall@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/FLAML/sessions/e8fc3b11-897f-4326-8db6-abc2c8f19dd5

Co-authored-by: thinkall <3197038+thinkall@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/FLAML/sessions/e8fc3b11-897f-4326-8db6-abc2c8f19dd5

Co-authored-by: thinkall <3197038+thinkall@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/FLAML/sessions/e8fc3b11-897f-4326-8db6-abc2c8f19dd5

Co-authored-by: thinkall <3197038+thinkall@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/FLAML/sessions/e8fc3b11-897f-4326-8db6-abc2c8f19dd5

Co-authored-by: thinkall <3197038+thinkall@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/FLAML/sessions/e8fc3b11-897f-4326-8db6-abc2c8f19dd5

Co-authored-by: thinkall <3197038+thinkall@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/FLAML/sessions/e8fc3b11-897f-4326-8db6-abc2c8f19dd5

Co-authored-by: thinkall <3197038+thinkall@users.noreply.github.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates FLAML’s time series utilities so predictions can be “prettified” (returned as a timestamped DataFrame) even when no test_data is provided, aligning with common forecasting workflows and addressing #1506.

Changes:

  • TimeSeriesDataset.prettify_prediction() now auto-generates future timestamps when test_data is empty/absent, including for DataFrame, Series, and ndarray predictions.
  • create_forward_frame() now uses pandas.tseries.frequencies.to_offset() to correctly advance anchored frequencies (e.g., weekly anchors, quarter ends) and adds clearer validation errors.
  • Adds targeted tests covering timestamp generation without test data and anchored-frequency forward-frame generation.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
flaml/automl/time_series/ts_data.py Generates forward timestamps in prettify_prediction() and improves create_forward_frame() frequency handling via pandas offsets.
test/automl/test_ts_data.py Adds regression tests for timestamp auto-creation and anchored frequency behavior.

@thinkall
Copy link
Copy Markdown
Collaborator

@copilot sync with main branch

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 27, 2026

@copilot sync with main branch

Fetched full history and the latest origin/main; the PR branch is already based on current origin/main (033612d), so no merge commit was needed. Revalidated at 1d00a3b with python -m pytest test/automl/test_ts_data.py -q and python -m ruff check flaml/automl/time_series/ts_data.py test/automl/test_ts_data.py.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@thinkall
Copy link
Copy Markdown
Collaborator

@copilot , investigate the code changes and comments throughly in PR #1508 and this PR, review the PR again.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 27, 2026

@copilot , investigate the code changes and comments throughly in PR #1508 and this PR, review the PR again.

Reviewed PR #1508’s diff, review threads, and comments against this PR at 521fb2f. Current PR addresses the prior concerns: no extra markdown file, regression tests cover the behavior that failed before, DataFrame/Series/ndarray values are preserved, and create_forward_frame() uses pandas offsets for anchored frequencies. Local validation passed with python -m pytest test/automl/test_ts_data.py -q and python -m ruff check flaml/automl/time_series/ts_data.py test/automl/test_ts_data.py. No code changes were needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]: Auto-Create Timestamps for Time Series Prediction

3 participants