Skip to content

docs: demonstrate dataset target switching and selection - #1596

Merged
bruAristimunha merged 3 commits into
braindecode:masterfrom
viranovskaya:docs/dataset-targets-897-2026-11-18
Nov 18, 2026
Merged

bruAristimunha merged 3 commits into
braindecode:masterfrom
viranovskaya:docs/dataset-targets-897-2026-11-18

Conversation

@viranovskaya

Copy link
Copy Markdown
Contributor

Summary

Related to #897. Extend the existing TUH multi-target tutorial to show how to change prediction targets and select a recording subset, without changing the dataset API or adding another tutorial.

Changes

  • Reuse set_target to switch from multiple targets to a numeric class label and then age regression, including clearing the earlier array transform.
  • Explain recording-level description, window-level get_metadata(), target lookup priority and why editing the merged metadata report alone does not change returned targets.
  • Select a recording subset using description and split, and explain shared underlying datasets. Use the existing four-recording mock corpus so this genuinely selects 4 of 16 windows.
  • Add the required changelog and author entry. No models, library implementation or CI configuration change.

Testing

  • Executed examples/datasets_io/plot_tuh_discrete_multitarget.py on the existing mock corpus: class target 0, regression target 37.0, subset 4/16 windows.
  • Executed the added example statements on an independent three-recording synthetic fixture: class labels switch to floating-point ages, subset 3/9, signals and description preserved, shared-object behavior verified. Network connections were forbidden during the example check.
  • python -m pytest test/unit_tests/datasets/test_xy.py test/unit_tests/datasets/test_tuh.py test/unit_tests/datasets/test_dataset.py::test_set_target_syncs_windows_metadata test/unit_tests/datasets/test_dataset.py::test_set_target_rejects_targets_from_channels -q: 23 passed, 5 existing warnings.
  • ruff format --check examples/datasets_io/plot_tuh_discrete_multitarget.py and the project's Ruff lint rules passed.
  • Isolated Sphinx-Gallery HTML build with -W --keep-going: the changed example executed, zero warnings. This is not a full project documentation build.

No model training, actual TUH corpus, network dataset downloads or GPU/MPS checks were run. The full test suite includes training and was not run for this documentation-only change.

  • New or changed behavior is covered by relevant regression tests (or N/A with reason): no library behavior changes; the executable example and existing dataset tests are checked above.
  • Style checks recorded, e.g. pre-commit run --files <changed files>: Ruff checks recorded above; the complete pre-commit suite was not claimed.
  • docs/whats_new.rst updated (required by the changelog CI check)

Notes for reviewers

The example still uses the pre-existing private _TUHMock; no new mock or helper is introduced. The selected corpus version is explicit so the filtering demonstration has both retained and excluded recordings. For real TUH data, the corpus version and path must match the actual data.

Model/checkpoint, shared model components, train/eval and API compatibility checks are N/A: none of those components change. A subset shares the underlying recording datasets; it is not an independent deep copy.

OpenAI Codex helped prepare and check this patch. A separate agent reviewed the complete diff and the target/subset semantics. This is not human review or maintainer approval. This PR is a draft for my review.

@codecov

codecov Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.19%. Comparing base (54c7a8f) to head (bfe7a9c).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1596   +/-   ##
=======================================
  Coverage   92.19%   92.19%           
=======================================
  Files         185      185           
  Lines       24299    24299           
=======================================
  Hits        22403    22403           
  Misses       1896     1896           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bruAristimunha
bruAristimunha marked this pull request as ready for review November 18, 2026 22:10
# Conflicts:
#	docs/whats_new.rst
@bruAristimunha
bruAristimunha merged commit b64fe3d into braindecode:master Nov 18, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants