← Back to Pull requests

[ENH] Rename _pkg to _forecaster in v2 model classes #2564

Open
unknown opened this pull request with 204 lines diff across 2 files
View on GitHub
unknown unknown commented on Nov 28, 2026 19:33 UTC
Author

Reference Issues/PRs


Partially addresses #2561.

What does this implement/fix? Explain your changes.


This PR handles the v2 models layer slice of #2561 (leaving v1 _pkg, docs/, extension_templates/v2/ [#2484], and the test harness slice untouched):
  • Adds the forecaster classproperty on v2 BaseModel in pytorch_forecasting/models/base/_base_model_v2.py, falling back to _pkg() when a subclass has not migrated yet and keeping BaseModel.pkg as a compatibility alias until the test utilities finish switching to forecaster.

  • Renames _pkg to _forecaster (and updates package references in docstrings to forecaster) across all 15 v2 model classes (DLinear, FreTS, DecoderMLP_v2, ModernTCN, NHiTS_v2, PatchTST_v2, Samformer, SCINet_v2, SOFTS, TFT, TIDE, TimeXer, TSMixer, UniTS, xLSTMTime) plus the module docstring in SamformerForecaster.
  • What should a reviewer concentrate their feedback on?


  • Whether keeping BaseModel.pkg forwarding to BaseModel.forecaster and falling back to _pkg() in _base_model_v2.py is the right transition approach so existing v2 test utilities and in-flight v2 model PRs keep passing until the test harness slice lands.
  • Did you add any tests for the change?


    Yes, added test_forecaster_linkage_all_v2_models and test_forecaster_legacy_pkg_fallback in tests/test_models/test_base_model_v2.py.

    Any other comments?


    No.

    PR checklist


  • The PR title starts with either [ENH], [MNT], [DOC], or [BUG].

  • Added/modified tests

  • Used pre-commit hooks when committing to ensure that code is compliant with hooks.
  • Diff: 204 lines (+153 / -51) across 2 files Reviewer: phoeenniixx Review duration: 2700m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.36) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.36 · 204 lines diff across 2 files
    0.36
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.318
    Real PR Conversation Timeline
    1 comments
    "Review active on #2564"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 36.3% (MEDIUM) · Higher = larger blast radius
    36.3%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 19.4% · Safe to merge
    19.4%