Repository navigation
Add dataset and device columns to the paradigm metadata (leave-one-device-out with groups="device") - #1328
Merged
bruAristimunha merged 4 commits intoOct 25, 2026
Conversation
Leave-one-dataset-out needed a hand-written subject->dataset lookup: get_data's metadata only had subject/session/run, so CrossDatasetSplitter (which groups by a 'dataset' column) could not run on paradigm output. Paradigms now record each trial's dataset code (for a CompoundDataset, the dataset the subject comes from), so CrossSubjectEvaluation(cv_class= LeaveOneGroupOut, groups='dataset') holds out one dataset at a time.
…ata-column # Conflicts: # docs/source/whats_new.rst # moabb/tests/test_evaluations.py # moabb/tests/test_paradigms.py
Group by recording device, not by dataset: one dataset can use several
devices (Peters2026: DSI-24 or DSI-Flex per visit) and several datasets
share one. canonical_device maps the 107 free-text
METADATA.acquisition.hardware strings to 30 devices ('unknown' when none
is given); BaseDataset._device returns it per session, CompoundDataset
delegates to the source dataset, Peters2026 overrides it per visit.
groups='device' is leave-one-device-out.
bruAristimunha
added a commit
to qbarthelemy/moabb
that referenced
this pull request
Oct 25, 2026
Review of NeuroTechX#1305 (Bruno): no new evaluation. The example now pools the devices in a CompoundDataset and holds out one device at a time with CrossSubjectEvaluation(cv_class=LeaveOneGroupOut, groups='device'), on the nested trials of NeuroTechX#1327 and the device column of NeuroTechX#1328. - remove CrossSystemEvaluation, its tests and extra_fit_params; - _evaluate_fold routes any metadata column of the training trials to the steps requesting it (set_fit_request(device=True)), replacing the cross-system-only 'systems' routing; - FakeDataset takes a device; - the example's ChannelUnion and MDMM read the device of each training trial and infer the held-out device, so every device can be the target; - keep the duplicated-results fix of process() and its test.
bruAristimunha
added a commit
that referenced
this pull request
Oct 26, 2026
…(route metadata columns to pipelines) (#1305) * Add CrossSystemEvaluation * CrossSystemEvaluation: load the systems once, reject unknown targets and epoch pipelines Review follow-ups: the systems were reloaded in full for every target (k^2 loads), a target_datasets entry outside datasets gave an empty result, and pipelines needing mne.Epochs silently received arrays. * Turn CrossSystemEvaluation into a tutorial on the existing API Review of #1305 (Bruno): no new evaluation. The example now pools the devices in a CompoundDataset and holds out one device at a time with CrossSubjectEvaluation(cv_class=LeaveOneGroupOut, groups='device'), on the nested trials of #1327 and the device column of #1328. - remove CrossSystemEvaluation, its tests and extra_fit_params; - _evaluate_fold routes any metadata column of the training trials to the steps requesting it (set_fit_request(device=True)), replacing the cross-system-only 'systems' routing; - FakeDataset takes a device; - the example's ChannelUnion and MDMM read the device of each training trial and infer the held-out device, so every device can be the target; - keep the duplicated-results fix of process() and its test. --------- Co-authored-by: Bru <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Second of three steps from the review of #1305 (first: #1327, merged). Makes the grouping used for transfer evaluation explicit in the metadata, keeping dataset (provenance) and device (recording system) apart: one dataset can use several devices, and several datasets can share one.
Problem.
get_data's metadata carried onlysubject,sessionandrun. Leave-one-dataset-out over aCompoundDatasetneeded a hand-written subject→dataset lookup,CrossDatasetSplitter(which groups by a"dataset"column) could not run on paradigm output, and there was no way to group by device at all:METADATA.acquisition.hardwareis free text (107 distinct strings, e.g. seven spellings of the g.tec g.USBamp; 25 datasets give none).Change
get_datametadata gets two columns:dataset: the dataset code; inside aCompoundDataset, the dataset the subject comes from (BaseDataset._source_code);device: the recording device of the session (BaseDataset._device(subject, session)), by defaultcanonical_device(METADATA.acquisition.hardware).moabb.datasets.metadata.devices.canonical_device: a short ordered pattern table mapping the 107 strings to 30 devices. A manufacturer-only entry becomes"<maker> (model not given)"rather than being merged into a specific model; unmatched text is kept as is; no entry gives"unknown"(curation of the 25 missing entries is left to a separate PR).CompoundDatasetdelegates_deviceto the source dataset;Peters2026overrides it per visit (DSI-24 or DSI-Flex).groupsdocs list the metadata columns.Usage:
Behaviour change: two more default metadata columns; one test pinning the column list is updated.
Tests:
canonical_deviceon real hardware strings;dataset/devicecolumns for plain and compound datasets, including a device change between sessions and a device shared by two datasets; leave-one-dataset-out and leave-one-device-out evaluations (a device spanning two datasets is held out as one group).test_paradigms.py,test_evaluations.py,test_splits.pyandtest_metadata.pypass locally.Not changed:
cv_class=CrossDatasetSplitterpassed directly toCrossSubjectEvaluationis still refused (top-level splitters must hold out one subject per test fold); thegroups=form covers it.