Perform cross-subject transfer learning with CrossSubjectEvaluation
developMOABB 1.6 introduces support for cross-subject transfer learning via moabb.evaluations.CrossSubjectEvaluation. This is achieved using an optional target-calibration slice provided by the CrossSubjectSplitter.
Key Parameters
calibration_size: A float in[0, 1]representing the fraction of each held-out subject/session pair set aside for adaptation. Whencalibration_size > 0, each fold is structured as(train, calibration, test).calibration_labeled: A boolean. IfTrue, the calibration set includes bothX_target_labeledandy_target_labeled.cs_mode: An argument using themoabb.evaluations.CrossSubjectModeenum to select predefined modes:TRAIN_ONLY: No adaptation.- Unlabeled target adaptation at 20%, 50%, or 100%.
- Labeled target calibration at 20% or 50%.
TRAIN_TRIALWISE: Scores one target trial at a time (prevents exploiting whole-block statistics).
Data Flow
Calibration trials are trial-disjoint from the training and test sets. Pipeline steps can opt-in to receive calibration data via set_fit_request using keys like X_target_unlabeled, X_target_labeled, y_target_labeled, or the subjects array.
# Example conceptual usage of CrossSubjectEvaluation with calibration
from moabb.evaluations import CrossSubjectEvaluation, CrossSubjectSplitter, CrossSubjectMode
evaluation = CrossSubjectEvaluation(
splitter=CrossSubjectSplitter(calibration_size=0.2, calibration_labeled=True),
cs_mode=CrossSubjectMode.UNLABELED_20_PERCENT
)