Repository navigation
Let get_data return nested trials when recordings differ in channels or samples - #1327
Merged
bruAristimunha merged 4 commits intoOct 24, 2026
Merged
Conversation
np.concatenate at the end of BaseParadigm.get_data was the only thing that stopped datasets with different montages or sampling rates (pooled in a CompoundDataset) from going through a paradigm and an evaluation. Return an object array of per-trial arrays in that case; _get_nchan accepts it; the Epochs path raises a clear error instead of MNE's nchan mismatch.
# Conflicts: # docs/source/whats_new.rst
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.
First of three steps from the review of #1305 (cross-system evaluation): make the existing API handle recordings of different shapes, so no new evaluation class is needed.
Where it broke.
BaseParadigm.get_dataends withnp.concatenate(X)(ormne.concatenate_epochs). Datasets with different montages or sampling rates pooled in aCompoundDatasetfailed there: "all the input array dimensions ... must match exactly".Change (+40 lines of code):
get_datareturns a nested object array of shape(n_trials,)with each trial's(n_channels, n_times)array (logged at WARNING);_get_nchanaccepts nested arrays (largest channel count), the only evaluation code that readX.shape[1];return_epochs=Trueon such recordings raises a clear error pointing to array output (mne.Epochscannot hold them).With it, leave-one-dataset-out runs with what exists:
CrossSubjectEvaluation(datasets=[compound], cv_class=LeaveOneGroupOut, groups=...).Tests: nested output and the regular case (
test_paradigms.py), Epochs error, and a leave-one-system-outCrossSubjectEvaluationon two fake systems with different channels and rates (test_evaluations.py).test_evaluations.pyandtest_paradigms.pypass locally.Next: a PR making the grouping explicit (a
datasetmetadata column forCompoundDataset, sogroups="dataset"), then #1305 becomes a tutorial.