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

[timeseries] Update to GluonTS v0.13.0 + add DLinear and PatchTST models #3230

Merged
merged 6 commits into from
May 25, 2023

Conversation

shchur
Copy link
Collaborator

@shchur shchur commented May 22, 2023

Description of changes:

  • Bump GluonTS dependency to v0.13.0.

  • Add two new models: DLinear and PatchTST (not yet added to the presets).

  • Clean up the logic for setting the default context_length for GluonTS models.

  • Speed up the methods for converting DistributionForecast to QuantileForecast by vectorizing the code over all quantile_levels. Comparison of prediction time in seconds on M4 Quarterly (24000 time series) for SimpleFeedForward model that produces a DistributionForecast.

    Version Prediction time (s)
    Old 241
    New (this PR) 64

    The overall prediction time is still rather slow and probably could be further improved, but that would require digging into the GluonTS internals.

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

@github-actions
Copy link

Job PR-3230-436b645 is done.
Docs are uploaded to http://autogluon-staging.s3-website-us-west-2.amazonaws.com/PR-3230/436b645/index.html

@shchur shchur requested a review from tonyhoo May 22, 2023 21:08
@@ -13,6 +13,8 @@

__all__ = [
"DeepARModel",
"DLinearModel",
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am curious if there is a particular reason or quantitative analysis supporting the inclusion of these two models

Copy link
Collaborator Author

@shchur shchur May 23, 2023

Choose a reason for hiding this comment

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

The main reason is supporting our commitment to provide an easy-to-use API for GluonTS models via TimeSeriesPredictor. This is the same reason why we still keep the MXNet models around, even though they are not used in any presets.

The second reason is that the papers introducing these two models demonstrated SoTA results on some forecasting tasks. Though, we need to do proper benchmarking before including these models to the presets.

forecast_arrays.append(forecast.quantile(q))
forecast_keys.append(str(q))
# Compute all quantiles in parallel instead of a for-loop
quantiles = torch.tensor(quantile_levels, device=forecast.distribution.mean.device).reshape(-1, 1)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Any reason why we need to get the device from forecast distribution?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If we don't do that, the quantiles tensor might reside on CPU while the forecast.distribution object is on GPU, which would lead to a device mismatch exception by PyTorch.

The code here is nearly identical to the code in DistributionForecast.quantile, except that we compute all the quantiles simultaneously in parallel, instead of doing a for loop.

@github-actions
Copy link

Job PR-3230-e51756a is done.
Docs are uploaded to http://autogluon-staging.s3-website-us-west-2.amazonaws.com/PR-3230/e51756a/index.html

@github-actions
Copy link

Job PR-3230-5ca57aa is done.
Docs are uploaded to http://autogluon-staging.s3-website-us-west-2.amazonaws.com/PR-3230/5ca57aa/index.html

@github-actions
Copy link

Job PR-3230-c7d464f is done.
Docs are uploaded to http://autogluon-staging.s3-website-us-west-2.amazonaws.com/PR-3230/c7d464f/index.html

@shchur shchur merged commit 457582b into autogluon:master May 25, 2023
28 checks passed
@shchur shchur deleted the gluonts-13 branch May 25, 2023 09:09
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.

None yet

2 participants