Skip to content

[DOC] Add DecoderMLP usage example - #2379

Open
ZhangStudyLife wants to merge 1 commit into
sktime:mainfrom
ZhangStudyLife:docs/decodermlp-usage-example-2377
Open

[DOC] Add DecoderMLP usage example#2379
ZhangStudyLife wants to merge 1 commit into
sktime:mainfrom
ZhangStudyLife:docs/decodermlp-usage-example-2377

Conversation

@ZhangStudyLife

Copy link
Copy Markdown

Reference Issues/PRs

Partially addresses #2377.

This is intentionally limited to the v1 DecoderMLP model. #2378 covers DeepAR and NBeats.

What does this implement/fix?

This PR adds a focused, runnable usage example to the v1 DecoderMLP docstring. The example demonstrates:

  • deterministic synthetic time-series data preparation;
  • TimeSeriesDataSet construction;
  • DecoderMLP.from_dataset();
  • one-batch CPU training with fast_dev_run=True;
  • prediction with a stable output-shape check.

It also adds a minimal package-container linkage example, following the documentation structure used for the other v1 models.

The example does not download external data, require a GPU, or change model behavior.

What should a reviewer concentrate their feedback on?

  • Whether the example is sufficiently concise while still showing the complete core workflow.
  • Whether the package-container linkage example matches the intended v1 documentation pattern.

Did you add any tests for the change?

The examples are executable doctests. Local validation completed on Windows, Python 3.12, and CPU:

  • direct doctests: 16 examples passed;
  • tests/test_models/test_mlp.py: 7 passed;
  • DecoderMLP estimator suite: 32 passed;
  • applicable pre-commit hooks, Ruff, and Ruff formatting passed;
  • full Sphinx HTML build passed with no DecoderMLP-specific warnings.

Any other comments?

The change is limited to two DecoderMLP documentation files. No model weights, datasets, generated files, or unrelated formatting changes are included.

Thank you for taking the time to review this contribution.

PR checklist

  • The PR title starts with either [ENH], [MNT], [DOC], or [BUG].
  • Added/modified tests (the usage examples are executable doctests).
  • Used pre-commit hooks to ensure that the changed files comply with the configured hooks.

@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    #2379   +/-   ##
=======================================
  Coverage        ?   87.45%           
=======================================
  Files           ?      175           
  Lines           ?    10165           
  Branches        ?        0           
=======================================
  Hits            ?     8890           
  Misses          ?     1275           
  Partials        ?        0           
Flag Coverage Δ
cpu 87.45% <ø> (?)
pytest 87.45% <ø> (?)

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.

>>> from lightning.pytorch import Trainer
>>> from pytorch_forecasting import DecoderMLP, TimeSeriesDataSet
>>> _ = torch.manual_seed(0)
>>> data = pd.DataFrame(

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 can also use stallion dataset here?

>>> import torch
>>> from lightning.pytorch import Trainer
>>> from pytorch_forecasting import DecoderMLP, TimeSeriesDataSet
>>> _ = torch.manual_seed(0)

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.

is there a specific reason for setting a seed here? I mean it is just an example, it doesnt need to be reproducible :)

@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 a lot and welcome to pytorch-forecasting! I think this is ready to merge, just a few doubts (see above)

@phoeenniixx phoeenniixx added documentation Improvements or additions to documentation ptf-v1 Related to `pytorch-forecasting` v1 labels Aug 10, 2026
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.

2 participants