neuraltrain.models.reve.NtReve¶
- pydantic model neuraltrain.models.reve.NtReve[source][source]¶
Config for the braindecode REVE model with channel-mapping support.
Extends
BaseBrainDecodeModelwith REVE-specific logic:Channel remapping – an explicit
channel_mappingdict maps dataset channel names to REVE position-bank names. Channels whose names already appear in the bank (exact match) need no entry.Pretrained loading – bypasses the base-class restriction on
n_timesfor pretrained models, since REVE needs it to size itsfinal_layer.Encoder-only output – when
n_outputsisNone(downstream wrapper handles the head), the model is wrapped to callforward(return_output=True)and return the final transformer layer output, bypassing REVE’sfinal_layer.
- Parameters:
channel_mapping (dict or None) – Explicit mapping from dataset channel names to REVE position-bank names. Useful for EEG systems whose naming convention is absent from the bank (e.g. Neuromag
"EEG 005"or easycap-M10 numeric"2").- Fields:
- required_fields: ClassVar[list[Literal['ch_names', 'n_times', 'sfreq']]] = ['ch_names', 'n_times'][source]¶
Which data-derived build inputs this braindecode model requires forwarded from the context. Members:
"ch_names"– forwardchs_infofrom the dataset’s channel names (e.g. LaBraM, REVE);"n_times"– forwardn_timeseven on the pretrained path (non-pretrained builds always receive it);"sfreq"– forward the sampling rate (frequency-> braindecodesfreq, e.g. models with a fixed spectral front end).
Empty by default: most models take
sfreqvia configkwargsand need neither channel names nor a pretrained-pathn_times.
- build(n_spatial_locations: int, n_temporal_samples: int, n_outputs: int | None = None, chs_info: list[dict[str, Any]] | None = None, frequency: float | None = None) Module[source][source]¶
Build the braindecode model from context-named shape parameters.
Parameters are named/typed like
BrainModelBuildContextfields/properties, so the basebuild_from_contextinjects them (chs_info/frequencyfrom the matching context properties/fields). Covers every auto-registered braindecode model (EEGNet, Deep4Net, ShallowFBCSPNet, BIOT, …); custom configs (LaBraM, REVE, LUNA, BENDR) override this and reuse_bd_shape_kwargs()for the name mapping.