Skip to content

Conversation

@shchur
Copy link
Contributor

@shchur shchur commented Jan 17, 2026

Issue #, if available: #425

Description of changes:

  • Add freq: str | None parameter to predict_df methods. This can only be set in combination with validate_inputs=False. If specified, the user-provided freq will be used instead of the tryin to infer the freq from the data.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@shchur shchur requested a review from abdulfatir January 17, 2026 10:25
Copy link
Contributor

@abdulfatir abdulfatir left a comment

Choose a reason for hiding this comment

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

Thanks @shchur! Left some comments. Let's chat about this when you have time.

)
# Use provided freq if available, otherwise use inferred freq
if freq is None:
freq = inferred_freq
Copy link
Contributor

Choose a reason for hiding this comment

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

If freq is not None, should we verify that inferred_freq matches it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As I understand, the whole point is to skip running the frequency inference when freq is provided. Should we still do it?

prediction_timestamps_flat = pd.DatetimeIndex(future_df[timestamp_column])
for col in future_df.columns.drop([id_column, timestamp_column]):
future_covariates_dict[col] = future_df[col].to_numpy()
if validate_inputs:
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure about removing this. This was nice check for incorrect slicing of future data. I am wondering if we should only allow freq with validate_inputs=False? I feel like freq in intended really for cases where you know what you are doing. For general use, automatic inference is probably the way to go.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense, I've updated the PR to only allow freq: str when validate_inputs=False. The logic should also be much simpler in this case

regular frequency, and item IDs match between past and future data. Setting to False disables these checks.
[ADVANCED] When True (default), validates dataframes before prediction. Setting to False removes the
validation overhead, but may silently lead to wrong predictions if data is misformatted. When False, you
must ensure: (1) all dataframes are sorted by (id_column, timestamp_column); (2) future_df (if provided)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should also say that items must be regularly spaced.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, fixed in all places in the code.

Name of column containing timestamps
validate_inputs
When True, the dataframe(s) will be validated be conversion
[ADVANCED] When True (default), validates dataframes before prediction. Setting to False removes the
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above. Add a comment about regularly-spaced series.

@shchur shchur merged commit 1f099eb into main Jan 19, 2026
9 checks passed
@shchur shchur deleted the allow-freq branch January 19, 2026 12:59
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.

2 participants