Skip to content

[ENH] Implement Baseline forecaster in v2 interface - #2382

Open
Dev10-sys wants to merge 3 commits into
sktime:mainfrom
Dev10-sys:feature/baseline-v2
Open

[ENH] Implement Baseline forecaster in v2 interface#2382
Dev10-sys wants to merge 3 commits into
sktime:mainfrom
Dev10-sys:feature/baseline-v2

Conversation

@Dev10-sys

@Dev10-sys Dev10-sys commented Aug 16, 2026

Copy link
Copy Markdown

Reference Issues/PRs

Partially addresses #1736 and #1992.

What does this implement/fix? Explain your changes.

Adds a v2 implementation of Baseline forecaster as Baseline_v2.

  • Implemented Baseline_v2 inheriting from BaseModel that repeats the last known target value across prediction horizon.
  • Implemented Baseline_pkg_v2 inheriting from Base_pkg.
  • Refactored pytorch_forecasting/models/baseline/ while maintaining backward compatibility for v1 Baseline.
  • Added unit and estimator compliance tests in tests/test_models/test_baseline_v2.py.

What should a reviewer concentrate their feedback on?

  • Value repetition forward pass logic in Baseline_v2.forward
  • Package metadata in Baseline_pkg_v2

Did you add any tests for the change?

  • Added tests/test_models/test_baseline_v2.py with check_estimator compliance.

PR checklist

  • Title starts with [ENH]
  • Added tests (tests/test_models/test_baseline_v2.py)
  • Used pre-commit hooks

@Dev10-sys
Dev10-sys force-pushed the feature/baseline-v2 branch 3 times, most recently from 59dd440 to 1bd2fe7 Compare August 16, 2026 11:19
@codecov

codecov Bot commented Aug 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 49.09091% with 28 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@062aeb4). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...ytorch_forecasting/models/baseline/_baseline_v2.py 40.74% 16 Missing ⚠️
...ch_forecasting/models/baseline/_baseline_pkg_v2.py 45.45% 12 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2382   +/-   ##
=======================================
  Coverage        ?   87.93%           
=======================================
  Files           ?      199           
  Lines           ?    11106           
  Branches        ?        0           
=======================================
  Hits            ?     9766           
  Misses          ?     1340           
  Partials        ?        0           
Flag Coverage Δ
cpu 87.93% <49.09%> (?)
pytest 87.93% <49.09%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

"info:name": "Baseline",
"info:compute": 1,
"info:y_type": ["numeric"],
"authors": ["Dev10-sys", "kalpanagola9897"],

Copy link
Copy Markdown
Member

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 credit the v1 authors

"capability:pred_int": False,
"capability:flexible_history_length": True,
"capability:cold_start": False,
"python_dependencies": [],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

you dont need to add this, as there are no soft-deps here

def get_test_train_params(cls) -> list[dict[str, Any]]:
"""Return testing parameter settings for trainer fixtures."""
params: list[dict[str, Any]] = [
{},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can you add more params? like use different losses etc

Comment thread tests/test_models/test_baseline_v2.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I htink these tests are already handled by the unified test framework. Do we still need these?

@phoeenniixx phoeenniixx left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!
I have added some comments pls see above

@phoeenniixx phoeenniixx added enhancement New feature or request module:models ptf-v2 Related to `pytorch-forecasting` v2 labels Aug 17, 2026
@Dev10-sys
Dev10-sys force-pushed the feature/baseline-v2 branch 2 times, most recently from 7d0da85 to e26ff6a Compare August 18, 2026 07:25
@Dev10-sys

Dev10-sys commented Aug 18, 2026

Copy link
Copy Markdown
Author

Thanks! I have added some comments pls see above

Hey @phoeenniixx , sorted out all the feedback pls checkk..

@Dev10-sys
Dev10-sys force-pushed the feature/baseline-v2 branch 3 times, most recently from a955110 to 05f7225 Compare August 23, 2026 10:15
Migrates the Baseline forecasting model to the PyTorch Forecasting v2 architecture. Implements Baseline_v2 inheriting from BaseModel for point forecasting using the last observed target, along with Baseline_pkg_v2 inheriting from Base_pkg to manage datamodule and trainer setups. Includes fixture parameter configurations integrated into the estimator compliance test suite.
@Dev10-sys
Dev10-sys force-pushed the feature/baseline-v2 branch from 05f7225 to ba02b96 Compare August 23, 2026 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request module:models ptf-v2 Related to `pytorch-forecasting` v2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants