[ENH] Add v2 interface support for N-BEATS model - #2322
Open
harshsomankar123-tech wants to merge 2 commits into
Open
[ENH] Add v2 interface support for N-BEATS model#2322harshsomankar123-tech wants to merge 2 commits into
harshsomankar123-tech wants to merge 2 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2322 +/- ##
=======================================
Coverage ? 87.13%
=======================================
Files ? 177
Lines ? 10385
Branches ? 0
=======================================
Hits ? 9049
Misses ? 1336
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:
|
harshsomankar123-tech
marked this pull request as ready for review
June 21, 2026 09:22
harshsomankar123-tech
requested review from
PranavBhatP,
benHeid,
fkiraly,
fnhirwa,
jdb78,
phoeenniixx and
yarnabrina
as code owners
June 21, 2026 09:22
Contributor
Author
|
@phoeenniixx @fkiraly Please take a look |
harshsomankar123-tech
force-pushed
the
add-nbeats-v2
branch
from
July 15, 2026 04:25
1d4dd50 to
a055403
Compare
harshsomankar123-tech
marked this pull request as draft
July 15, 2026 05:05
harshsomankar123-tech
force-pushed
the
add-nbeats-v2
branch
from
July 15, 2026 08:42
a019c8e to
372f20e
Compare
harshsomankar123-tech
marked this pull request as ready for review
July 15, 2026 08:43
phoeenniixx
reviewed
Aug 11, 2026
Member
There was a problem hiding this comment.
why do we have this docker file?
phoeenniixx
reviewed
Aug 11, 2026
|
|
||
| _tags = { | ||
| "info:name": "NBeats", | ||
| "authors": ["jdb78"], |
Member
There was a problem hiding this comment.
please add your name as well.
phoeenniixx
reviewed
Aug 11, 2026
| from pytorch_forecasting.models.base._base_model_v2 import BaseModel | ||
|
|
||
|
|
||
| class NBeats(BaseModel): |
Member
There was a problem hiding this comment.
Maybe name it NBeats_v2 to create a distinction between v1 and v2?
phoeenniixx
requested changes
Aug 11, 2026
phoeenniixx
left a comment
Member
There was a problem hiding this comment.
Please add the docstrings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reference Issues/PRs
Fixes #2034.
What does this implement/fix? Explain your changes.
This PR adds v2 interface support for the N-BEATS model, following the v2 patterns recently established by DLinear, SAMformer, and TFT in the codebase.
Specifically, this implements:
pytorch_forecasting/models/nbeats/_nbeats_v2.py): * ImplementedNBeatsinheriting from the experimentalBaseModelv2.context_length) and horizon (prediction_length).backcast_loss_ratio > 0.plot_interpretation) and scaling transformation (transform_output).pytorch_forecasting/models/nbeats/_nbeats_pkg_v2.py&__init__.py): * Created package containerNBeats_pkg_v2inheriting fromBase_pkgto represent the high-level workflow wrapper.get_test_train_params).What should a reviewer concentrate their feedback on?
BaseModel(v2) andBase_pkgclasses.get_test_train_paramsadequately covers required testing configurations for the package wrapper.Did you add any tests for the change?
Yes. Robust test coverage was added in
tests/test_models/test_nbeats_v2.py.The new tests cover initialization, forward pass configurations, quantile loss output shapes, step functions (training, validation, test), packaging/fitting pipelines, and interpretation plotting (including matplotlib soft-dependency checking).
Verification: All new v2 tests (7 passes, 1 skipped due to matplotlib missing) and legacy v1 tests (2 passes, 1 skipped) execute successfully without regressions.
Any other comments?
N/A
PR checklist
pre-commit install.To run hooks independent of commit, execute
pre-commit run --all-files