Views
No views yet
Architecture-only repository. Documents thebraindecode.models.MEDFormerclass. No pretrained weights are distributed here. Instantiate the model and train it on your own data.
pip install braindecode1from braindecode.models import MEDFormer
2
3model = MEDFormer(
4 n_chans=22,
5 sfreq=250,
6 input_window_seconds=4.0,
7 n_outputs=4,
8)
| Parameter | Type | Description |
|---|---|---|
patch_len_list | list of int, optional | Patch lengths for multi-granularity patching; each entry selects a temporal scale. The default is [14, 44, 45]. |
embed_dim | int, optional | Embedding dimensionality. The default is 128. |
num_heads | int, optional | Number of attention heads, which must divide :attr:d_model. The default is 8. |
drop_prob | float, optional | Dropout probability. The default is 0.1. |
no_inter_attn | bool, optional | If True, disables inter-granularity attention. The default is False. |
num_layers | int, optional | Number of encoder layers. The default is 6. |
dim_feedforward | int, optional | Feedforward dimensionality. The default is 256. |
activation_trans | nn.Module, optional | Activation module used in transformer encoder layers. The default is :class:nn.ReLU. |
single_channel | bool, optional | If True, processes each channel independently, increasing capacity and cost. The default is False. |
output_attention | bool, optional | If True, returns attention weights for interpretability. The default is True. |
activation_class | nn.Module, optional | Activation used in the final classification layer. The default is :class:nn.GELU. |
1@article{aristimunha2025braindecode,
2 title = {Braindecode: a deep learning library for raw electrophysiological data},
3 author = {Aristimunha, Bruno and others},
4 journal = {Zenodo},
5 year = {2025},
6 doi = {10.5281/zenodo.17699192},
7}