Skip to content

[DOC] Add RecurrentNetwork usage example - #2397

Open
obaidsafi51 wants to merge 2 commits into
sktime:mainfrom
obaidsafi51:doc/rnn-usage-example
Open

[DOC] Add RecurrentNetwork usage example#2397
obaidsafi51 wants to merge 2 commits into
sktime:mainfrom
obaidsafi51:doc/rnn-usage-example

Conversation

@obaidsafi51

@obaidsafi51 obaidsafi51 commented Aug 26, 2026

Copy link
Copy Markdown

Reference Issues/PRs

Regarding #2377

What does this implement/fix? Explain your changes.

Add a doctest-style usage example to the RecurrentNetwork (RNN) model class docstring. The example demonstrates the complete workflow:

  • Loading synthetic data using generate_ar_data
  • Creating TimeSeriesDataSet with target_lags (RNN-specific feature)
  • Building model via RecurrentNetwork.from_dataset()
  • Training with PyTorch Lightning Trainer
  • Making predictions

What should a reviewer concentrate their feedback on?

  • Whether the example is sufficiently concise while showing the complete core workflow
  • Whether the doctest syntax is correct (>>> prompts, ... continuations)
  • Whether the example uses appropriate hyperparameters for a quick demo

Did you add any tests for the change?

Yes - the example itself is an executable doctest. It will be run by the existing doctest suite (pytorch_forecasting/tests/test_doctest.py).

Any other comments?

The example uses generate_ar_data for a self-contained, reproducible example without external dependencies. Training and prediction steps are marked with # doctest: +SKIP since they require GPU/longer runtime.

PR checklist

  • The PR title starts with either [ENH], [MNT], [DOC], or [BUG]. [BUG] - bugfix, [MNT] - CI, test framework, [ENH] - adding or improving code, [DOC] - writing or improving documentation or docstrings.
  • Added/modified tests (doctest example)
  • Used pre-commit hooks when committing to ensure that code is compliant with hooks. Install hooks with pre-commit install. To run hooks independent of commit, execute pre-commit run --all-files

@obaidsafi51

Copy link
Copy Markdown
Author

@phoeenniixx Can you kindly review the PR if there is any issue let me know about it. Thanks.

- Add doctest example showing complete workflow: data -> dataset -> model -> train -> predict
- Uses generate_ar_data for self-contained example
- Includes target_lags demonstration for RNN

Fixes sktime#2377
@obaidsafi51
obaidsafi51 force-pushed the doc/rnn-usage-example branch 2 times, most recently from ab8e2f4 to 70e4873 Compare August 26, 2026 23:25

@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!
The code quality is failing, can you please look into this?
See the coding standards here: https://www.sktime.net/docs/developer-guide/coding-standards/

@phoeenniixx phoeenniixx changed the title [DOC]: Add RecurrentNetwork usage example [DOC] Add RecurrentNetwork usage example Aug 27, 2026
@phoeenniixx phoeenniixx added documentation Improvements or additions to documentation ptf-v1 Related to `pytorch-forecasting` v1 labels Aug 27, 2026
@codecov

codecov Bot commented Aug 27, 2026

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2397   +/-   ##
=======================================
  Coverage        ?   88.12%           
=======================================
  Files           ?      196           
  Lines           ?    11051           
  Branches        ?        0           
=======================================
  Hits            ?     9739           
  Misses          ?     1312           
  Partials        ?        0           
Flag Coverage Δ
cpu 88.12% <ø> (?)
pytest 88.12% <ø> (?)

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!

logging_metrics (nn.ModuleList, optional): Metrics to log during training.
Defaults to nn.ModuleList([SMAPE(), MAE(), RMSE(), MAPE(), MASE()]).

Example:

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.

THis should be like this:

Example
-------------

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

I think the heading is not right, can you please use numpydoc style docstrings

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