Skip to content

Clarify period parameter and automatic label lagging in time series forecasting#1495

Merged
thinkall merged 9 commits into
mainfrom
copilot/fix-lag-label-training
Jan 21, 2026
Merged

Clarify period parameter and automatic label lagging in time series forecasting#1495
thinkall merged 9 commits into
mainfrom
copilot/fix-lag-label-training

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 20, 2026

Documentation Improvement for Time Series Forecasting - COMPLETE ✅

Problem Statement

User confusion about:

  1. ✅ The meaning of the period parameter in time series forecasting
  2. ✅ Whether they need to manually lag the label before training
  3. ✅ How FLAML handles label lagging internally for sklearn-based models
  4. ✅ Relationship between period and prediction output length

Changes Made

Latest Update - Formatting fixes:

  • ✅ Ran pre-commit hooks to fix formatting issues
  • ✅ Fixed trailing whitespace in sklearn.py
  • ✅ Fixed markdown formatting (missing blank lines)

Previous Updates:

  • ✅ Refined terminology per code review
  • ✅ Added distinction between training and prediction stages per @thinkall feedback
  • ✅ Enhanced documentation in AutoML-Time series forecast.md
  • ✅ Updated docstring in automl.py for period parameter
  • ✅ Added inline documentation in sklearn.py

Summary of Documentation

1. Website Documentation (AutoML-Time series forecast.md)

  • period parameter (horizon) = forecast horizon (# of future time steps model is trained to predict)
  • Prediction output length = length of X_test (can be any length)
  • Automatic feature engineering for sklearn vs. native models
  • Users do NOT need to manually lag features

2. API Documentation (automl.py)

  • Enhanced period parameter with prediction stage clarification
  • Documented automatic lagging behavior differences

3. Internal Code Documentation (sklearn.py)

  • Improved function and class documentation

Key Points Now Documented

  • period = forecast horizon used during model training
  • ✅ During prediction: output length = length of X_test
  • ✅ Automatic lagging for sklearn-based models
  • ✅ Native forecasting for time series models
  • ✅ Users do NOT need to manually lag features
  • ✅ All formatting issues fixed
Original prompt

This section details on the original issue you should resolve

<issue_title>HOW TO FORECAST FEATURE? meaning of period parameter</issue_title>
<issue_description>Dear all,
in a multivariate time series forecast the flaml website example show how to run automl and then predict set test data for scoring; well. this is a regression approach, i think. in order to forecast in the feature the label is necessary to lag the label before training or not?
sorry for my ignorance but this is a very important question
</issue_description>

Comments on the Issue (you are @copilot in this section)

@int-chaos If you are referring to sklearn regressor models, we do lag the label before training. See https://github.com/microsoft/FLAML/blob/9901156deec8eb2a603e2fbf74ca01ceac5e9b5c/flaml/model.py#L2050. We use hcrystalball's `_transform_data_to_tsmodel_input_format` function to do this.

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits January 20, 2026 04:11
…bel lagging

Co-authored-by: thinkall <3197038+thinkall@users.noreply.github.com>
Co-authored-by: thinkall <3197038+thinkall@users.noreply.github.com>
Copilot AI changed the title [WIP] Clarify use of period parameter in forecast feature Clarify period parameter and automatic label lagging in time series forecasting Jan 20, 2026
Copilot AI requested a review from thinkall January 20, 2026 04:17
Copy link
Copy Markdown
Collaborator

@thinkall thinkall left a comment

Choose a reason for hiding this comment

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

@copilot , add something like "horizon (period in the code) means the future prediction window length during training. In prediction stage, the output lenght is equal to the length of X_test." in proper docs to avoid confusion.

@thinkall thinkall marked this pull request as ready for review January 20, 2026 14:56
Co-authored-by: thinkall <3197038+thinkall@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jan 20, 2026

@copilot , add something like "horizon (period in the code) means the future prediction window length during training. In prediction stage, the output lenght is equal to the length of X_test." in prop...

Added clarification in commit 72a0895. Updated both the website documentation and API docstrings to specify that period (horizon) represents the prediction window length during training, and that during prediction the output length equals the length of X_test.

Co-authored-by: thinkall <3197038+thinkall@users.noreply.github.com>
Copilot AI requested a review from thinkall January 20, 2026 15:03
@thinkall
Copy link
Copy Markdown
Collaborator

@copilot , run pre-commit run --all-files to fix the format issue

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

Copilot AI commented Jan 21, 2026

@copilot , run pre-commit run --all-files to fix the format issue

Formatting fixed in commit 232e859. The pre-commit hooks corrected trailing whitespace and markdown formatting issues.

@thinkall thinkall merged commit 7ec1414 into main Jan 21, 2026
16 checks passed
@thinkall thinkall deleted the copilot/fix-lag-label-training branch January 21, 2026 06:19
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.

HOW TO FORECAST FEATURE? meaning of period parameter

3 participants