Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow function as season_length argument in SeasonalNaivePredictor #3033

Merged
merged 2 commits into from
Oct 31, 2023

Conversation

lostella
Copy link
Contributor

Description of changes: The idea is to allow constructing the predictor with a "season length map" instead of a fixed integer, so that the model can be applied to datasets with different frequencies and expected seasonal patterns. For example, the predictor can be constructed by passing season_length=gluonts.time_feature.seasonality.get_seasonality.

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

Please tag this pr with at least one of these labels to make our release process faster: BREAKING, new feature, bug fix, other change, dev setup

@lostella lostella added the enhancement New feature or request label Oct 30, 2023
@lostella lostella added the models This item concerns models implementations label Oct 30, 2023
if isinstance(self.season_length, int):
season_length = self.season_length
else:
season_length = self.season_length(item["start"].freq)
Copy link
Contributor

Choose a reason for hiding this comment

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

This requires that there is a freq for the time series, which might not be the case in the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess this mechanism is really only useful if you have frequency information attached to the series. If that's not the case, there's no point in using this option, and the model should be configured with an int value.

Also: I believe the assumption that item["start"] is a pd.Period (hence has frequency information) is already baked into this method since it uses forecast_start?

Copy link
Contributor

Choose a reason for hiding this comment

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

At the moment we require that all time series have frequency information attached -- but that's an arbitrary requirement.

@lostella lostella marked this pull request as ready for review October 31, 2023 13:57
@lostella lostella merged commit a05f219 into awslabs:dev Oct 31, 2023
17 of 18 checks passed
@lostella lostella deleted the auto-seasonal-naive branch October 31, 2023 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request models This item concerns models implementations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants