Skip to content

[DOC] Add DeepAR and NBeats usage examples - #2378

Open
tomatotomata wants to merge 2 commits into
sktime:mainfrom
tomatotomata:codex/add-model-doc-examples-2377
Open

[DOC] Add DeepAR and NBeats usage examples#2378
tomatotomata wants to merge 2 commits into
sktime:mainfrom
tomatotomata:codex/add-model-doc-examples-2377

Conversation

@tomatotomata

Copy link
Copy Markdown

Summary

This adds focused doctest-style usage examples for the v1 DeepAR and NBeats models and their package containers.

The model examples show the supported from_dataset entry point and link to the complete tutorials or example script. The package examples document the container-to-model resolution used by the estimator suite.

This is intentionally limited to two v1 models, as requested in issue #2377. The remaining models can follow in separate small pull requests.

Validation

  • python -m ruff check pytorch_forecasting/models/deepar/_deepar.py pytorch_forecasting/models/deepar/_deepar_pkg.py pytorch_forecasting/models/nbeats/_nbeats.py pytorch_forecasting/models/nbeats/_nbeats_pkg.py passed.
  • python -m compileall -q passed for the four changed files.
  • Doctest syntax parsing passed for all four new examples.
  • git diff --check passed.
  • Full import and doctest execution was not available in this Windows checkout because the lightning dependency is not installed.

Closes #2377 for the DeepAR and NBeats slice.

@codecov

codecov Bot commented Aug 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@7bcf66c). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2378   +/-   ##
=======================================
  Coverage        ?   87.46%           
=======================================
  Files           ?      175           
  Lines           ?    10165           
  Branches        ?        0           
=======================================
  Hits            ?     8891           
  Misses          ?     1274           
  Partials        ?        0           
Flag Coverage Δ
cpu 87.46% <ø> (?)
pytest 87.46% <ø> (?)

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.

@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!
Can you please use dataset and show the complete flow of the model training and prediction in the example?

@phoeenniixx phoeenniixx added documentation Improvements or additions to documentation ptf-v1 Related to `pytorch-forecasting` v1 labels Aug 10, 2026
@tomatotomata

Copy link
Copy Markdown
Author

I expanded both model docstrings into runnable end-to-end examples using the built-in autoregressive dataset. Each now creates a TimeSeriesDataSet, derives a validation set, builds the model with from_dataset, trains for one epoch, and calls predict on the validation loader.

The examples are in commit 7a1ab5f. python -m compileall passes for both changed modules. I could not execute the flow here because this checkout does not have the lightning dependency installed. Let me know what you think.

@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.

The code quality is still failing. Also, in place of adding a complete code block, can you add it command-wise? Using >>>? The doctests check >>> and not the code block

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation ptf-v1 Related to `pytorch-forecasting` v1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DOC] Add usage examples to all models in v1 and v2

2 participants