[ENH] Integrate Autoformer model into V2 architecture - #2303
[ENH] Integrate Autoformer model into V2 architecture#2303harshsomankar123-tech wants to merge 16 commits into
Conversation
|
@phoeenniixx @PranavBhatP @fkiraly Could you please take a look when you have some time? |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2303 +/- ##
=======================================
Coverage ? 87.50%
=======================================
Files ? 184
Lines ? 10557
Branches ? 0
=======================================
Hits ? 9238
Misses ? 1319
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
phoeenniixx
left a comment
There was a problem hiding this comment.
Thanks!
I have added some suggestions based on a shallow review. Will do a more deeper review shortly
…review feedback - Move AutoCorrelation, AutoCorrelationLayer to layers/_attention/ - Move SeasonalLayerNorm (renamed from my_Layernorm) to layers/_normalization/ - Move AutoformerEncoder/EncoderLayer to layers/_encoders/ - Move AutoformerDecoder/DecoderLayer to layers/_decoders/ (new) - Move Autoformer embeddings to layers/_embeddings/ - Reuse existing SeriesDecomposition and MovingAvg from shared layers - Convert sub_modules.py to thin re-export shim for backward compat - Remove unnecessary _get_test_datamodule_from from Autoformer_pkg_v2
phoeenniixx
left a comment
There was a problem hiding this comment.
Thanks!
Added a few comments, please have a look at them,
I think we should try to de duplicate the tests here and only tests those things which are not being tested by the test framework.
See the tests for the test framework here: https://github.com/sktime/pytorch-forecasting/blob/main/pytorch_forecasting/tests/test_all_v2/test_all_estimators_v2.py
…tag, add loss metrics to test params, remove redundant tests
|
@phoeenniixx @fkiraly Please Take a Look |
Description
This PR integrates the Autoformer model (based on the NeurIPS 2021 paper) into the new PyTorch-Forecasting V2 architecture. Autoformer implements a series-wise decomposition connection to progressively decompose time series into trend and seasonal components, and utilizes an Auto-Correlation mechanism to replace standard point-wise self-attention for long-term forecasting.
Reference Issues/PRs
fix: #2004
What does this implement/fix? Explain your changes.
This PR introduces the Autoformer architecture to the V2 models ecosystem. Specifically, it implements:
Autoformer Layer Submodules (
pytorch_forecasting/models/autoformer/sub_modules.py):AutoCorrelation: Fast Fourier Transforms (FFT) for periodicity discovery and time-delay aggregation.AutoCorrelationLayer: Projection layer wrapper.series_decomp&moving_avg: Custom trend-seasonal time series decomposition.Encoder&Decoder: Progressive series-decomposition architecture.DataEmbedding_wo_pos,TokenEmbedding, and temporal embeddings.my_Layernorm: Specialized LayerNorm for seasonal components.Autoformer V2 Model (
pytorch_forecasting/models/autoformer/_autoformer_v2.py):TslibBaseModelto handle target values and continuous covariates in the V2 input dictionary.QuantileLosspredictions.Wrapper Package & Registry (
pytorch_forecasting/models/autoformer/_autoformer_pkg_v2.py):exogenous,multivariate, andpred_int) and parameter grids for dynamic discovery by the package registry.What should a reviewer concentrate their feedback on?
Reviewers should primarily focus on:
_autoformer_v2.py, verifying the logic used to prevent broadcasting mismatches between targets, covariates, and quantile channels.QuantileLoss.TslibBaseModelhandles the dictionary routing to the encoder/decoder appropriately.Did you add any tests for the change?
Yes, a comprehensive test suite was added in
tests/test_models/test_autoformer_v2.py.Any other comments?
All tests were verified locally using
.venv/bin/pytest tests/test_models/test_autoformer_v2.pyand.venv/bin/pytest -k Autoformer.PR checklist
pre-commit install.To run hooks independent of commit, execute
pre-commit run --all-files