Braindecode 1.7.0.dev182553025__tar.gz → 1.7.0.dev182642410__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {braindecode-1.7.0.dev182553025/braindecode.egg-info → braindecode-1.7.0.dev182642410}/PKG-INFO +1 -1
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/classifier.py +7 -7
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/functional/__init__.py +0 -4
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/functional/functions.py +2 -39
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/__init__.py +0 -2
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/bendr.py +1 -8
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/eegminer.py +62 -38
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/fblightconvnet.py +4 -31
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/reve.py +33 -32
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/summary.csv +0 -1
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/tcn.py +2 -5
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/util.py +0 -22
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/modules/__init__.py +2 -5
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/modules/filter.py +10 -16
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/regressor.py +7 -7
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/training/__init__.py +1 -4
- braindecode-1.7.0.dev182642410/braindecode/training/losses.py +105 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/training/scoring.py +5 -46
- braindecode-1.7.0.dev182642410/braindecode/version.py +1 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410/braindecode.egg-info}/PKG-INFO +1 -1
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode.egg-info/SOURCES.txt +0 -2
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/docs/api.rst +0 -2
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/docs/whats_new.rst +1 -44
- braindecode-1.7.0.dev182553025/braindecode/models/dance.py +0 -368
- braindecode-1.7.0.dev182553025/braindecode/modules/dance_modules.py +0 -333
- braindecode-1.7.0.dev182553025/braindecode/training/losses.py +0 -284
- braindecode-1.7.0.dev182553025/braindecode/version.py +0 -1
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/LICENSE.txt +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/MANIFEST.in +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/NOTICE.txt +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/README.rst +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/__init__.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/augmentation/__init__.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/augmentation/base.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/augmentation/functional.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/augmentation/transforms.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/datasets/__init__.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/datasets/base.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/datasets/bbci.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/datasets/bcicomp.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/datasets/bids/__init__.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/datasets/bids/datasets.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/datasets/bids/format.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/datasets/bids/hub.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/datasets/bids/hub_format.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/datasets/bids/hub_io.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/datasets/bids/hub_validation.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/datasets/bids/iterable.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/datasets/chb_mit.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/datasets/collate.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/datasets/mne.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/datasets/moabb.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/datasets/nmt.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/datasets/registry.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/datasets/siena.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/datasets/sleep_physio_challe_18.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/datasets/sleep_physionet.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/datasets/tuh.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/datasets/utils.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/datasets/xy.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/datautil/__init__.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/datautil/channel_utils.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/datautil/hub_formats.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/datautil/serialization.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/datautil/util.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/eegneuralnet.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/functional/initialization.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/atcnet.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/attentionbasenet.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/attn_sleep.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/base.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/biot.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/brainmodule.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/cbramod.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/codebrain.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/config.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/contrawr.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/ctnet.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/deep4.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/deepsleepnet.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/dgcnn.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/eegconformer.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/eegdino.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/eeginception_erp.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/eeginception_mi.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/eegitnet.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/eegnet.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/eegnex.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/eegpt.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/eegsimpleconv.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/eegsym.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/eegtcnet.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/emg2qwerty.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/fbcnet.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/fbmsnet.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/hybrid.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/ifnet.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/interpolated.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/labram.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/luna.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/medformer.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/meta_neuromotor.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/msvtnet.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/mvpformer.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/patchedtransformer.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/sccnet.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/shallow_fbcsp.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/signal_jepa.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/sinc_shallow.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/sleep_stager_blanco_2020.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/sleep_stager_chambon_2018.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/sparcnet.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/sstdpn.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/steegformer.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/syncnet.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/tcformer.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/tidnet.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/tsinception.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/usleep.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/modules/activation.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/modules/attention.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/modules/blocks.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/modules/convolution.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/modules/interpolation.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/modules/layers.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/modules/linear.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/modules/parametrization.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/modules/stats.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/modules/util.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/modules/wrapper.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/preprocessing/__init__.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/preprocessing/eegprep_preprocess.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/preprocessing/mne_preprocess.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/preprocessing/preprocess.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/preprocessing/util.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/preprocessing/windowers.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/samplers/__init__.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/samplers/base.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/samplers/ssl.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/training/callbacks.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/util.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/visualization/__init__.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/visualization/attribution.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/visualization/confusion_matrices.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/visualization/frequency.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/visualization/metrics.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/visualization/sanity.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/visualization/topology.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode.egg-info/dependency_links.txt +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode.egg-info/requires.txt +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode.egg-info/top_level.txt +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/docs/Makefile +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/docs/_templates/autosummary/class.rst +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/docs/_templates/autosummary/class_in_subdir.rst +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/docs/_templates/autosummary/function.rst +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/docs/_templates/autosummary/function_in_subdir.rst +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/docs/cite.rst +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/docs/conf.py +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/docs/help.rst +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/docs/index.rst +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/docs/install/install.rst +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/docs/install/install_pip.rst +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/docs/install/install_source.rst +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/docs/models/categorization/attention.rst +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/docs/models/categorization/channel.rst +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/docs/models/categorization/convolution.rst +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/docs/models/categorization/filterbank.rst +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/docs/models/categorization/gnn.rst +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/docs/models/categorization/interpretable.rst +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/docs/models/categorization/lbm.rst +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/docs/models/categorization/recurrent.rst +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/docs/models/categorization/spd.rst +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/docs/models/models.rst +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/docs/models/models_categorization.rst +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/docs/models/models_table.rst +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/docs/models/models_visualization.rst +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/docs/sg_execution_times.rst +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/pyproject.toml +0 -0
- {braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/setup.cfg +0 -0
{braindecode-1.7.0.dev182553025/braindecode.egg-info → braindecode-1.7.0.dev182642410}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: braindecode
|
|
3
|
-
Version: 1.7.0.
|
|
3
|
+
Version: 1.7.0.dev182642410
|
|
4
4
|
Summary: Deep learning software to decode EEG, ECG or MEG signals
|
|
5
5
|
Author-email: Robin Tibor Schirrmeister <robintibor@gmail.com>, Bruno Aristimunha Pinto <b.aristimunha@gmail.com>, Alexandre Gramfort <agramfort@meta.com>
|
|
6
6
|
Maintainer-email: Alexandre Gramfort <agramfort@meta.com>, Bruno Aristimunha Pinto <b.aristimunha@gmail.com>, Robin Tibor Schirrmeister <robintibor@gmail.com>
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
# Lukas Gemein <l.gemein@gmail.com>
|
|
4
4
|
# Bruno Aristimunha <b.aristimunha@gmail.com>
|
|
5
5
|
# Pierre Guetschel <pierre.guetschel@gmail.com>
|
|
6
|
-
# Sarthak Tayal <sarthaktayal2@gmail.com>
|
|
7
6
|
#
|
|
8
7
|
# License: BSD (3-clause)
|
|
9
8
|
|
|
@@ -196,7 +195,9 @@ class EEGClassifier(_EEGNeuralNet, NeuralNetClassifier):
|
|
|
196
195
|
return self.predict_proba(X).argmax(1)
|
|
197
196
|
|
|
198
197
|
def predict_trials(self, X, return_targets=True):
|
|
199
|
-
"""Create trialwise predictions
|
|
198
|
+
"""Create trialwise predictions and optionally also return trialwise.
|
|
199
|
+
|
|
200
|
+
labels from cropped dataset.
|
|
200
201
|
|
|
201
202
|
Parameters
|
|
202
203
|
----------
|
|
@@ -211,11 +212,10 @@ class EEGClassifier(_EEGNeuralNet, NeuralNetClassifier):
|
|
|
211
212
|
3-dimensional array (n_trials x n_classes x n_predictions), where
|
|
212
213
|
the number of predictions depend on the chosen window size and the
|
|
213
214
|
receptive field of the network.
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
either a single value, multiple values, or a sequence.
|
|
215
|
+
trial_labels : np.ndarray
|
|
216
|
+
2-dimensional array (n_trials x n_targets) where the number of
|
|
217
|
+
targets depends on the decoding paradigm and can be either a single
|
|
218
|
+
value, multiple values, or a sequence.
|
|
219
219
|
"""
|
|
220
220
|
if not self.cropped:
|
|
221
221
|
warnings.warn(
|
{braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/functional/__init__.py
RENAMED
|
@@ -5,8 +5,6 @@ from .functions import (
|
|
|
5
5
|
dwt_max_level,
|
|
6
6
|
hilbert_freq,
|
|
7
7
|
identity,
|
|
8
|
-
iou_1d,
|
|
9
|
-
pairwise_iou_1d,
|
|
10
8
|
plv_time,
|
|
11
9
|
safe_log,
|
|
12
10
|
sinusoidal_positional_encoding,
|
|
@@ -22,8 +20,6 @@ __all__ = [
|
|
|
22
20
|
"dwt_max_level",
|
|
23
21
|
"hilbert_freq",
|
|
24
22
|
"identity",
|
|
25
|
-
"iou_1d",
|
|
26
|
-
"pairwise_iou_1d",
|
|
27
23
|
"plv_time",
|
|
28
24
|
"safe_log",
|
|
29
25
|
"sinusoidal_positional_encoding",
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# Authors: Robin Schirrmeister <robintibor@gmail.com>
|
|
2
2
|
# Bruno Aristimunha <b.aristimunha@gmail.com>
|
|
3
|
-
# Sarthak Tayal <sarthaktayal2@gmail.com>
|
|
4
3
|
#
|
|
5
4
|
# License: BSD (3-clause)
|
|
6
5
|
|
|
@@ -110,7 +109,7 @@ def _get_gaussian_kernel1d(kernel_size: int, sigma: float) -> torch.Tensor:
|
|
|
110
109
|
return kernel1d
|
|
111
110
|
|
|
112
111
|
|
|
113
|
-
def hilbert_freq(x
|
|
112
|
+
def hilbert_freq(x, forward_fourier=True):
|
|
114
113
|
r"""
|
|
115
114
|
Compute the Hilbert transform using PyTorch, separating the real and
|
|
116
115
|
imaginary parts.
|
|
@@ -179,9 +178,7 @@ def hilbert_freq(x: torch.Tensor, forward_fourier: bool = True) -> torch.Tensor:
|
|
|
179
178
|
return x
|
|
180
179
|
|
|
181
180
|
|
|
182
|
-
def plv_time(
|
|
183
|
-
x: torch.Tensor, forward_fourier: bool = True, epsilon: float = 1e-6
|
|
184
|
-
) -> torch.Tensor:
|
|
181
|
+
def plv_time(x, forward_fourier=True, epsilon: float = 1e-6):
|
|
185
182
|
"""Compute the Phase Locking Value (PLV) metric in the time domain.
|
|
186
183
|
|
|
187
184
|
The Phase Locking Value (PLV) is a measure of the synchronization between
|
|
@@ -260,40 +257,6 @@ def plv_time(
|
|
|
260
257
|
return plv_matrix
|
|
261
258
|
|
|
262
259
|
|
|
263
|
-
# -----------------------------------------------------------------------------
|
|
264
|
-
# DANCE functional helpers
|
|
265
|
-
#
|
|
266
|
-
# Authors: Bruno Aristimunha <b.aristimunha@gmail.com>
|
|
267
|
-
#
|
|
268
|
-
# License: MIT
|
|
269
|
-
#
|
|
270
|
-
# Ported from the DANCE event-detection model (facebookresearch/dance, MIT).
|
|
271
|
-
# -----------------------------------------------------------------------------
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
def iou_1d(s1, e1, s2, e2, eps: float = 1e-7):
|
|
275
|
-
"""ELEMENTWISE 1-D temporal IoU. All four inputs share the same shape S
|
|
276
|
-
(e.g. ``(B, Q)``); returns IoU of shape S. Used by ``DanceLoss`` on the
|
|
277
|
-
matched ``(B, Q)`` spans. For (Q,)x(T,) pairwise IoU use ``pairwise_iou_1d``.
|
|
278
|
-
"""
|
|
279
|
-
inter = (torch.minimum(e1, e2) - torch.maximum(s1, s2)).clamp(min=0)
|
|
280
|
-
union = (e1 - s1) + (e2 - s2) - inter
|
|
281
|
-
return inter / (union + eps)
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
def pairwise_iou_1d(s1, e1, s2, e2, eps: float = 1e-7):
|
|
285
|
-
"""PAIRWISE 1-D temporal IoU. ``s1,e1`` shape ``(Q,)``, ``s2,e2`` shape
|
|
286
|
-
``(T,)``; returns ``(Q, T)`` (broadcast ``[:, None]`` x ``[None, :]``).
|
|
287
|
-
Transcribed from ``dance/matcher.py:33-39`` (``_pairwise_iou``). Used by
|
|
288
|
-
``HungarianMatcher`` to build the ``(Q, n_targets)`` cost matrix.
|
|
289
|
-
"""
|
|
290
|
-
inter_start = torch.maximum(s1[:, None], s2[None, :])
|
|
291
|
-
inter_end = torch.minimum(e1[:, None], e2[None, :])
|
|
292
|
-
inter = (inter_end - inter_start).clamp(min=0)
|
|
293
|
-
union = (e1 - s1)[:, None] + (e2 - s2)[None, :] - inter
|
|
294
|
-
return inter / (union + eps)
|
|
295
|
-
|
|
296
|
-
|
|
297
260
|
def daubechies_filters(n_vanishing: int) -> torch.Tensor:
|
|
298
261
|
r"""Daubechies ``db<n_vanishing>`` wavelet decomposition filters.
|
|
299
262
|
|
{braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/__init__.py
RENAMED
|
@@ -11,7 +11,6 @@ from .cbramod import CBraMod
|
|
|
11
11
|
from .codebrain import CodeBrain
|
|
12
12
|
from .contrawr import ContraWR
|
|
13
13
|
from .ctnet import CTNet
|
|
14
|
-
from .dance import DANCE
|
|
15
14
|
from .deep4 import Deep4Net
|
|
16
15
|
from .deepsleepnet import DeepSleepNet
|
|
17
16
|
from .dgcnn import DGCNN
|
|
@@ -87,7 +86,6 @@ __all__ = [
|
|
|
87
86
|
"CodeBrain",
|
|
88
87
|
"ContraWR",
|
|
89
88
|
"CTNet",
|
|
90
|
-
"DANCE",
|
|
91
89
|
"Deep4Net",
|
|
92
90
|
"DeepSleepNet",
|
|
93
91
|
"BrainModule",
|
{braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/bendr.py
RENAMED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
# Authors: Bruno Aristimunha <b.aristimunha@gmail.com>
|
|
2
|
-
# Sarthak Tayal <sarthaktayal2@gmail.com>
|
|
3
|
-
#
|
|
4
|
-
# License: BSD (3-clause)
|
|
5
|
-
|
|
6
1
|
import copy
|
|
7
2
|
|
|
8
3
|
import numpy as np
|
|
@@ -440,9 +435,7 @@ class _ConvEncoderBENDR(nn.Module):
|
|
|
440
435
|
padding=width
|
|
441
436
|
// 2, # Correct padding for 'same' output length before stride
|
|
442
437
|
),
|
|
443
|
-
#
|
|
444
|
-
# (batch, channels, times) activations
|
|
445
|
-
nn.Dropout1d(dropout),
|
|
438
|
+
nn.Dropout2d(dropout), # 2D dropout (matches paper specification)
|
|
446
439
|
nn.GroupNorm(
|
|
447
440
|
encoder_h // 2, encoder_h
|
|
448
441
|
), # Consider making num_groups configurable or ensure encoder_h is divisible by 2
|
{braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/eegminer.py
RENAMED
|
@@ -5,9 +5,10 @@
|
|
|
5
5
|
* https://www.ipo.gov.uk/p-ipsum/Case/ApplicationNumber/GB2113420.0
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
from functools import partial
|
|
9
9
|
|
|
10
10
|
import torch
|
|
11
|
+
from einops.layers.torch import Rearrange
|
|
11
12
|
from torch import nn
|
|
12
13
|
|
|
13
14
|
import braindecode.functional as F
|
|
@@ -18,36 +19,6 @@ from braindecode.modules import GeneralizedGaussianFilter
|
|
|
18
19
|
_eeg_miner_methods = ["mag", "corr", "plv"]
|
|
19
20
|
|
|
20
21
|
|
|
21
|
-
class _EEGMinerFeatures(nn.Module):
|
|
22
|
-
def __init__(self, method, n_chans, n_filters, n_times):
|
|
23
|
-
super().__init__()
|
|
24
|
-
self.method = method
|
|
25
|
-
self.n_chans = n_chans
|
|
26
|
-
self.n_filters = n_filters
|
|
27
|
-
self.n_times = n_times
|
|
28
|
-
triu = torch.triu_indices(n_chans, n_chans, 1)
|
|
29
|
-
self.register_buffer("triu_row", triu[0], persistent=False)
|
|
30
|
-
self.register_buffer("triu_col", triu[1], persistent=False)
|
|
31
|
-
|
|
32
|
-
def forward(self, x):
|
|
33
|
-
if self.method == "mag":
|
|
34
|
-
return torch.sqrt((x * x).mean(dim=-1))
|
|
35
|
-
if self.method == "corr":
|
|
36
|
-
x = x.reshape(
|
|
37
|
-
x.shape[0], self.n_chans, self.n_filters, self.n_times
|
|
38
|
-
).transpose(-3, -2)
|
|
39
|
-
x = (x - x.mean(dim=-1, keepdim=True)) / torch.sqrt(
|
|
40
|
-
x.var(dim=-1, keepdim=True) + 1e-6
|
|
41
|
-
)
|
|
42
|
-
x = torch.matmul(x, x.transpose(-2, -1)) / x.shape[-1]
|
|
43
|
-
x = x.permute(0, 2, 3, 1).abs()
|
|
44
|
-
else:
|
|
45
|
-
x = x.transpose(-4, -3)
|
|
46
|
-
x = F.plv_time(x, forward_fourier=False)
|
|
47
|
-
x = x.permute(0, 2, 3, 1)
|
|
48
|
-
return x[:, self.triu_row, self.triu_col, :]
|
|
49
|
-
|
|
50
|
-
|
|
51
22
|
class EEGMiner(EEGModuleMixin, nn.Module):
|
|
52
23
|
r"""EEGMiner from Ludwig et al (2024) [eegminer]_.
|
|
53
24
|
|
|
@@ -197,18 +168,24 @@ class EEGMiner(EEGModuleMixin, nn.Module):
|
|
|
197
168
|
)
|
|
198
169
|
|
|
199
170
|
# Forward method
|
|
200
|
-
self.ensure_dim = nn.Identity()
|
|
201
171
|
if self.method == "mag":
|
|
172
|
+
self.method_forward = self._apply_mag_forward
|
|
202
173
|
self.n_features = self.n_chans * self.n_filters
|
|
174
|
+
self.ensure_dim = nn.Identity()
|
|
203
175
|
elif self.method == "corr":
|
|
176
|
+
self.method_forward = partial(
|
|
177
|
+
self._apply_corr_forward,
|
|
178
|
+
n_chans=self.n_chans,
|
|
179
|
+
n_filters=self.n_filters,
|
|
180
|
+
n_times=self.n_times,
|
|
181
|
+
)
|
|
204
182
|
self.n_features = self.n_filters * self.n_chans * (self.n_chans - 1) // 2
|
|
183
|
+
self.ensure_dim = nn.Identity()
|
|
205
184
|
elif self.method == "plv":
|
|
206
|
-
self.
|
|
185
|
+
self.method_forward = partial(self._apply_plv, n_chans=self.n_chans)
|
|
186
|
+
self.ensure_dim = Rearrange("... d -> ... 1 d")
|
|
207
187
|
self.n_features = (self.n_filters * self.n_chans * (self.n_chans - 1)) // 2
|
|
208
188
|
|
|
209
|
-
self.feature_layer = _EEGMinerFeatures(
|
|
210
|
-
self.method, self.n_chans, self.n_filters, self.n_times
|
|
211
|
-
)
|
|
212
189
|
self.flatten_layer = nn.Flatten()
|
|
213
190
|
# Classifier
|
|
214
191
|
self.batch_layer = nn.BatchNorm1d(self.n_features, affine=False)
|
|
@@ -218,17 +195,64 @@ class EEGMiner(EEGModuleMixin, nn.Module):
|
|
|
218
195
|
@_disable_batch_norm_training_if_batch_size_one
|
|
219
196
|
def forward(self, x):
|
|
220
197
|
"""x: (batch, electrodes, time)"""
|
|
198
|
+
batch = x.shape[0]
|
|
221
199
|
x = self.ensure_dim(x)
|
|
222
200
|
# Apply Gaussian filters in frequency domain
|
|
223
201
|
# x -> (batch, electrodes * filters, time)
|
|
224
202
|
x = self.filter(x)
|
|
225
203
|
|
|
226
|
-
x = self.
|
|
204
|
+
x = self.method_forward(x=x, batch=batch)
|
|
227
205
|
# Classifier
|
|
228
206
|
# Note that the order of dimensions before flattening the feature vector is important
|
|
229
207
|
# for attributing feature weights during interpretation.
|
|
230
|
-
x = x.reshape(
|
|
208
|
+
x = x.reshape(batch, self.n_features)
|
|
231
209
|
x = self.batch_layer(x)
|
|
232
210
|
x = self.final_layer(x)
|
|
233
211
|
|
|
234
212
|
return x
|
|
213
|
+
|
|
214
|
+
@staticmethod
|
|
215
|
+
def _apply_mag_forward(x, batch=None):
|
|
216
|
+
# Signal magnitude
|
|
217
|
+
x = x * x
|
|
218
|
+
x = x.mean(dim=-1)
|
|
219
|
+
x = torch.sqrt(x)
|
|
220
|
+
return x
|
|
221
|
+
|
|
222
|
+
@staticmethod
|
|
223
|
+
def _apply_corr_forward(
|
|
224
|
+
x, batch, n_chans, n_filters, n_times, epilson: float = 1e-6
|
|
225
|
+
):
|
|
226
|
+
x = x.reshape(batch, n_chans, n_filters, n_times).transpose(-3, -2)
|
|
227
|
+
x = (x - x.mean(dim=-1, keepdim=True)) / torch.sqrt(
|
|
228
|
+
x.var(dim=-1, keepdim=True) + epilson
|
|
229
|
+
)
|
|
230
|
+
x = torch.matmul(x, x.transpose(-2, -1)) / x.shape[-1]
|
|
231
|
+
# Original tensor shape: [batch, n_filters, chans, chans]
|
|
232
|
+
x = x.permute(0, 2, 3, 1)
|
|
233
|
+
# New tensor shape: [batch, chans, chans, n_filters]
|
|
234
|
+
# move filter channels to the end
|
|
235
|
+
x = x.abs()
|
|
236
|
+
|
|
237
|
+
# Get upper triu of symmetric connectivity matrix
|
|
238
|
+
triu = torch.triu_indices(n_chans, n_chans, 1)
|
|
239
|
+
x = x[:, triu[0], triu[1], :]
|
|
240
|
+
|
|
241
|
+
return x
|
|
242
|
+
|
|
243
|
+
@staticmethod
|
|
244
|
+
def _apply_plv(x, n_chans, batch=None):
|
|
245
|
+
# Compute PLV connectivity
|
|
246
|
+
# x -> (batch, electrodes, electrodes, filters)
|
|
247
|
+
x = x.transpose(-4, -3) # swap electrodes and filters
|
|
248
|
+
# adjusting to compute the plv
|
|
249
|
+
x = F.plv_time(x, forward_fourier=False)
|
|
250
|
+
# batch, number of filters, connectivity matrix
|
|
251
|
+
# [batch, n_filters, chans, chans]
|
|
252
|
+
x = x.permute(0, 2, 3, 1)
|
|
253
|
+
# [batch, chans, chans, n_filters]
|
|
254
|
+
|
|
255
|
+
# Get upper triu of symmetric connectivity matrix
|
|
256
|
+
triu = torch.triu_indices(n_chans, n_chans, 1)
|
|
257
|
+
x = x[:, triu[0], triu[1], :]
|
|
258
|
+
return x
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
# Authors: Sarthak Tayal <sarthaktayal2@gmail.com>
|
|
2
|
-
#
|
|
3
|
-
# License: BSD-3
|
|
4
|
-
|
|
5
1
|
from __future__ import annotations
|
|
6
2
|
|
|
7
3
|
from typing import Optional
|
|
@@ -65,18 +61,15 @@ class FBLightConvNet(EEGModuleMixin, nn.Module):
|
|
|
65
61
|
|
|
66
62
|
Parameters
|
|
67
63
|
----------
|
|
68
|
-
n_bands : int or None or list of tuple of int, default=
|
|
64
|
+
n_bands : int or None or list of tuple of int, default=8
|
|
69
65
|
Number of frequency bands or a list of frequency band tuples. If a list of tuples is provided,
|
|
70
66
|
each tuple defines the lower and upper bounds of a frequency band.
|
|
71
67
|
n_filters_spat : int, default=32
|
|
72
68
|
Number of spatial filters in the depthwise convolutional layer.
|
|
73
69
|
n_dim : int, default=3
|
|
74
70
|
Number of dimensions for the temporal reduction layer.
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
split into before the variance based feature extraction. The number of
|
|
78
|
-
windows passed to the attention module is ``n_times // win_len``, so
|
|
79
|
-
``n_times`` has to be at least ``win_len``.
|
|
71
|
+
stride_factor : int, default=4
|
|
72
|
+
Stride factor used for reshaping the temporal dimension.
|
|
80
73
|
activation : nn.Module, default=nn.ELU
|
|
81
74
|
Activation function class to apply after convolutional layers.
|
|
82
75
|
verbose : bool, default=False
|
|
@@ -89,9 +82,6 @@ class FBLightConvNet(EEGModuleMixin, nn.Module):
|
|
|
89
82
|
If True, applies softmax to the attention weights.
|
|
90
83
|
bias : bool, default=False
|
|
91
84
|
If True, includes a bias term in the convolutional layers.
|
|
92
|
-
stride_factor : int or None, default=None
|
|
93
|
-
Deprecated and ignored, it will be removed in a future release. The
|
|
94
|
-
temporal segmentation of this model is controlled by ``win_len``.
|
|
95
85
|
|
|
96
86
|
References
|
|
97
87
|
----------
|
|
@@ -116,7 +106,7 @@ class FBLightConvNet(EEGModuleMixin, nn.Module):
|
|
|
116
106
|
n_bands=9,
|
|
117
107
|
n_filters_spat: int = 32,
|
|
118
108
|
n_dim: int = 3,
|
|
119
|
-
stride_factor:
|
|
109
|
+
stride_factor: int = 4,
|
|
120
110
|
win_len: int = 250,
|
|
121
111
|
heads: int = 8,
|
|
122
112
|
weight_softmax: bool = True,
|
|
@@ -135,14 +125,6 @@ class FBLightConvNet(EEGModuleMixin, nn.Module):
|
|
|
135
125
|
)
|
|
136
126
|
del n_outputs, n_chans, chs_info, n_times, input_window_seconds, sfreq
|
|
137
127
|
|
|
138
|
-
if stride_factor is not None:
|
|
139
|
-
warn(
|
|
140
|
-
"The parameter `stride_factor` is deprecated and ignored, it "
|
|
141
|
-
"will be removed in a future release. The temporal "
|
|
142
|
-
"segmentation of FBLightConvNet is set by `win_len`.",
|
|
143
|
-
DeprecationWarning,
|
|
144
|
-
)
|
|
145
|
-
|
|
146
128
|
# Parameters
|
|
147
129
|
self.n_bands = n_bands
|
|
148
130
|
self.n_filters_spat = n_filters_spat
|
|
@@ -156,13 +138,6 @@ class FBLightConvNet(EEGModuleMixin, nn.Module):
|
|
|
156
138
|
self.filter_parameters = filter_parameters or {}
|
|
157
139
|
|
|
158
140
|
# Checkers
|
|
159
|
-
if self.n_times < self.win_len:
|
|
160
|
-
raise ValueError(
|
|
161
|
-
f"Time dimension ({self.n_times}) is shorter than win_len "
|
|
162
|
-
f"({self.win_len}), so the model cannot build a single "
|
|
163
|
-
f"temporal window. Pass a longer input or lower `win_len`."
|
|
164
|
-
)
|
|
165
|
-
|
|
166
141
|
self.n_times_truncated = self.n_times
|
|
167
142
|
if self.n_times % self.win_len != 0:
|
|
168
143
|
warn(
|
|
@@ -219,12 +194,10 @@ class FBLightConvNet(EEGModuleMixin, nn.Module):
|
|
|
219
194
|
def forward(self, x: torch.Tensor) -> torch.Tensor:
|
|
220
195
|
"""
|
|
221
196
|
Forward pass of the FBLightConvNet model.
|
|
222
|
-
|
|
223
197
|
Parameters
|
|
224
198
|
----------
|
|
225
199
|
x : torch.Tensor
|
|
226
200
|
Input tensor with shape (batch_size, n_chans, n_times).
|
|
227
|
-
|
|
228
201
|
Returns
|
|
229
202
|
-------
|
|
230
203
|
torch.Tensor
|
{braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/reve.py
RENAMED
|
@@ -8,13 +8,13 @@ import json
|
|
|
8
8
|
import logging
|
|
9
9
|
import math
|
|
10
10
|
import os
|
|
11
|
+
from pathlib import Path
|
|
11
12
|
from typing import Optional, Union
|
|
12
13
|
|
|
13
|
-
import
|
|
14
|
+
import requests
|
|
14
15
|
import torch
|
|
15
16
|
import torch.nn.functional as F
|
|
16
17
|
from einops import rearrange
|
|
17
|
-
from mne.datasets.utils import _get_path
|
|
18
18
|
from torch import nn
|
|
19
19
|
|
|
20
20
|
# Safe import for older PyTorch versions (Support for Intel-based Macs)
|
|
@@ -785,12 +785,9 @@ class FourierEmb4D(nn.Module):
|
|
|
785
785
|
class RevePositionBank(torch.nn.Module):
|
|
786
786
|
"""Position bank for REVE model that maps standard EEG channel names to 3D coordinates.
|
|
787
787
|
|
|
788
|
-
The
|
|
788
|
+
The position bank is cached locally in the library root to avoid repeated downloads.
|
|
789
789
|
|
|
790
|
-
The
|
|
791
|
-
works offline afterwards. On restricted nodes (e.g. HPC compute nodes without
|
|
792
|
-
a proxy), drop a prefetched ``reve_positions.json`` in that directory and no
|
|
793
|
-
download is attempted.
|
|
790
|
+
The coordinates come from the 92 datasets used during REVE pretraining.
|
|
794
791
|
|
|
795
792
|
Parameters
|
|
796
793
|
----------
|
|
@@ -799,9 +796,7 @@ class RevePositionBank(torch.nn.Module):
|
|
|
799
796
|
timeout : int, optional
|
|
800
797
|
Timeout in seconds for the HTTP request. Default is 5 seconds.
|
|
801
798
|
cache_dir : str, optional
|
|
802
|
-
Directory to cache the position bank.
|
|
803
|
-
braindecode datasets via the ``REVE_POSITIONS_PATH`` config key, falling
|
|
804
|
-
back to the MNE data directory (usually ``~/mne_data``).
|
|
799
|
+
Directory to cache the position bank. Default is the models folder within the library.
|
|
805
800
|
"""
|
|
806
801
|
|
|
807
802
|
def __init__(
|
|
@@ -812,32 +807,38 @@ class RevePositionBank(torch.nn.Module):
|
|
|
812
807
|
):
|
|
813
808
|
super().__init__()
|
|
814
809
|
|
|
815
|
-
|
|
816
|
-
|
|
810
|
+
if cache_dir is None:
|
|
811
|
+
# Use the model root directory
|
|
812
|
+
cache_dir = str(Path(__file__).parent)
|
|
817
813
|
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
814
|
+
cache_file = os.path.join(cache_dir, ".cache", "reve_positions.json")
|
|
815
|
+
os.makedirs(os.path.dirname(cache_file), exist_ok=True)
|
|
816
|
+
|
|
817
|
+
config = None
|
|
818
|
+
|
|
819
|
+
# Try to load from cache first
|
|
820
|
+
if os.path.exists(cache_file):
|
|
824
821
|
try:
|
|
825
|
-
|
|
826
|
-
os.remove(cache_file) # corrupt/partial; force a fresh copy
|
|
827
|
-
# pooch ships with mne and writes straight into the cache dir.
|
|
828
|
-
pooch.retrieve(
|
|
829
|
-
url,
|
|
830
|
-
known_hash=None,
|
|
831
|
-
fname="reve_positions.json",
|
|
832
|
-
path=cache_dir,
|
|
833
|
-
downloader=pooch.HTTPDownloader(timeout=timeout),
|
|
834
|
-
)
|
|
835
|
-
with open(cache_file) as f:
|
|
822
|
+
with open(cache_file, "r") as f:
|
|
836
823
|
config = json.load(f)
|
|
837
|
-
|
|
824
|
+
logger.info(f"Loaded position bank from cache: {cache_file}")
|
|
825
|
+
except (json.JSONDecodeError, IOError) as e:
|
|
826
|
+
logger.warning(f"Failed to load cache, downloading: {e}")
|
|
827
|
+
|
|
828
|
+
# Download if cache miss or failed to load
|
|
829
|
+
if config is None:
|
|
830
|
+
try:
|
|
831
|
+
response = requests.get(url, timeout=timeout)
|
|
832
|
+
response.raise_for_status()
|
|
833
|
+
config = json.loads(response.text)
|
|
834
|
+
|
|
835
|
+
# Save to cache
|
|
836
|
+
with open(cache_file, "w") as f:
|
|
837
|
+
json.dump(config, f)
|
|
838
|
+
logger.info(f"Downloaded and cached position bank to: {cache_file}")
|
|
839
|
+
except (requests.RequestException, json.JSONDecodeError) as e:
|
|
838
840
|
raise RuntimeError(
|
|
839
|
-
f"Failed to download the position bank from {url}
|
|
840
|
-
f"offline node, prefetch it to {cache_file} first: {e}"
|
|
841
|
+
f"Failed to download or parse the position bank from {url}: {e}"
|
|
841
842
|
) from e
|
|
842
843
|
|
|
843
844
|
try:
|
{braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/summary.csv
RENAMED
|
@@ -58,6 +58,5 @@ InterpolatedLaBraM,General,"Prediction, Embedding",200,"chs_info, n_outputs, n_t
|
|
|
58
58
|
InterpolatedSignalJEPA,"Motor Imagery, ERP, SSVEP",Embedding,128,"chs_info",3456882,"InterpolatedSignalJEPA(chs_info=<user>)","Convolution,Channel,Foundation Model",EEG
|
|
59
59
|
TCFormer,Motor Imagery,Classification,250,"n_chans, n_outputs, n_times",77820,"TCFormer(n_chans=22, n_outputs=4, n_times=1000)","Convolution,Attention/Transformer",EEG
|
|
60
60
|
EEGDINO,General,Classification,200,"n_chans, n_outputs, n_times",4539698,"EEGDINO(n_chans=19, n_outputs=4, n_times=1000)","Foundation Model,Attention/Transformer",EEG
|
|
61
|
-
DANCE,General,Event Detection,200,"n_chans, n_outputs, n_times, sfreq, chs_info",29813542,"DANCE(n_chans=19, n_outputs=4, n_times=6400, sfreq=200, input_window_seconds=32.0, chs_info=[{'ch_name': f'E{i+1}', 'kind': 'eeg', 'loc': numpy.random.default_rng(2024).random(12)} for i in range(19)])","Convolution,Attention/Transformer,Channel",EEG
|
|
62
61
|
STEEGFormer,General,Classification,250,"n_chans, n_outputs, n_times",25305604,"STEEGFormer(n_chans=22, n_outputs=4, n_times=1000)","Attention/Transformer,Foundation Model",EEG
|
|
63
62
|
MVPFormer,General,"Prediction, Embedding",512,"n_chans, n_outputs, n_times, sfreq",3356978,"MVPFormer(n_chans=22, n_outputs=4, n_times=2000, sfreq=100)","Foundation Model,Attention/Transformer",EEG
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# Authors: Patryk Chrabaszcz
|
|
2
2
|
# Lukas Gemein <l.gemein@gmail.com>
|
|
3
|
-
# Sarthak Tayal <sarthaktayal2@gmail.com>
|
|
4
3
|
#
|
|
5
4
|
# License: BSD-3
|
|
6
5
|
import torch
|
|
@@ -237,9 +236,7 @@ class _TemporalBlock(nn.Module):
|
|
|
237
236
|
)
|
|
238
237
|
self.chomp1 = Chomp1d(padding)
|
|
239
238
|
self.relu1 = activation()
|
|
240
|
-
|
|
241
|
-
# channel-wise there through a deprecated fallback
|
|
242
|
-
self.dropout1 = nn.Dropout1d(drop_prob)
|
|
239
|
+
self.dropout1 = nn.Dropout2d(drop_prob)
|
|
243
240
|
|
|
244
241
|
self.conv2 = weight_norm(
|
|
245
242
|
nn.Conv1d(
|
|
@@ -253,7 +250,7 @@ class _TemporalBlock(nn.Module):
|
|
|
253
250
|
)
|
|
254
251
|
self.chomp2 = Chomp1d(padding)
|
|
255
252
|
self.relu2 = activation()
|
|
256
|
-
self.dropout2 = nn.
|
|
253
|
+
self.dropout2 = nn.Dropout2d(drop_prob)
|
|
257
254
|
|
|
258
255
|
self.downsample = (
|
|
259
256
|
nn.Conv1d(n_inputs, n_outputs, 1) if n_inputs != n_outputs else None
|
{braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/models/util.py
RENAMED
|
@@ -484,25 +484,6 @@ models_mandatory_parameters: list[
|
|
|
484
484
|
),
|
|
485
485
|
("DGCNN", ["n_chans", "n_outputs", "n_times", "chs_info"], None),
|
|
486
486
|
("EEGDINO", ["n_chans", "n_outputs", "n_times"], None),
|
|
487
|
-
(
|
|
488
|
-
"DANCE",
|
|
489
|
-
["n_outputs", "n_chans", "n_times", "sfreq", "chs_info"],
|
|
490
|
-
{
|
|
491
|
-
"n_chans": 19,
|
|
492
|
-
"n_times": 6400, # 32 s @ 200 Hz, above the depth-10 stack minimum
|
|
493
|
-
"sfreq": 200.0,
|
|
494
|
-
"input_window_seconds": 32.0,
|
|
495
|
-
"n_outputs": 4,
|
|
496
|
-
"chs_info": [
|
|
497
|
-
{
|
|
498
|
-
"ch_name": f"E{i + 1}",
|
|
499
|
-
"kind": "eeg",
|
|
500
|
-
"loc": _rng.random(12),
|
|
501
|
-
}
|
|
502
|
-
for i in range(19)
|
|
503
|
-
],
|
|
504
|
-
},
|
|
505
|
-
),
|
|
506
487
|
]
|
|
507
488
|
|
|
508
489
|
################################################################
|
|
@@ -517,9 +498,6 @@ non_classification_models = [
|
|
|
517
498
|
# Emits a (batch, T_out, vocab) sequence for CTC, not class logits.
|
|
518
499
|
"MetaNeuromotorHand",
|
|
519
500
|
"EMG2QwertyNet",
|
|
520
|
-
# forward returns (batch, num_latents, n_outputs) dense per-token logits,
|
|
521
|
-
# not class logits.
|
|
522
|
-
"DANCE",
|
|
523
501
|
]
|
|
524
502
|
|
|
525
503
|
################################################################
|
{braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/modules/__init__.py
RENAMED
|
@@ -23,7 +23,6 @@ from .convolution import (
|
|
|
23
23
|
Conv2dWithConstraint,
|
|
24
24
|
DepthwiseConv2d,
|
|
25
25
|
)
|
|
26
|
-
from .dance_modules import Perceiver, SimpleConv
|
|
27
26
|
from .filter import FilterBankLayer, GeneralizedGaussianFilter
|
|
28
27
|
from .interpolation import ChannelInterpolationLayer
|
|
29
28
|
from .layers import (
|
|
@@ -79,10 +78,6 @@ __all__ = [
|
|
|
79
78
|
"Conv1dWithConstraint",
|
|
80
79
|
"Conv2dWithConstraint",
|
|
81
80
|
"DepthwiseConv2d",
|
|
82
|
-
"ChannelMerger",
|
|
83
|
-
"FourierEmb",
|
|
84
|
-
"Perceiver",
|
|
85
|
-
"SimpleConv",
|
|
86
81
|
"FilterBankLayer",
|
|
87
82
|
"GeneralizedGaussianFilter",
|
|
88
83
|
"Chomp1d",
|
|
@@ -93,6 +88,8 @@ __all__ = [
|
|
|
93
88
|
"TimeDistributed",
|
|
94
89
|
"LinearWithConstraint",
|
|
95
90
|
"MaxNormLinear",
|
|
91
|
+
"ChannelMerger",
|
|
92
|
+
"FourierEmb",
|
|
96
93
|
"MaxNorm",
|
|
97
94
|
"MaxNormParametrize",
|
|
98
95
|
"LogPowerLayer",
|
{braindecode-1.7.0.dev182553025 → braindecode-1.7.0.dev182642410}/braindecode/modules/filter.py
RENAMED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
# Authors: Sarthak Tayal <sarthaktayal2@gmail.com>
|
|
2
|
-
#
|
|
3
|
-
# License: BSD-3
|
|
4
|
-
|
|
5
1
|
from __future__ import annotations
|
|
6
2
|
|
|
7
3
|
from typing import Optional
|
|
@@ -641,22 +637,20 @@ class GeneralizedGaussianFilter(nn.Module):
|
|
|
641
637
|
The constructed filters with shape `(out_channels, freq_bins, 2)`.
|
|
642
638
|
|
|
643
639
|
"""
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
self.
|
|
640
|
+
# Clamp parameters
|
|
641
|
+
self.f_mean.data = torch.clamp(
|
|
642
|
+
self.f_mean.data,
|
|
643
|
+
min=self.clamp_f_mean[0] / (self.sample_rate / 2),
|
|
644
|
+
max=self.clamp_f_mean[1] / (self.sample_rate / 2),
|
|
649
645
|
)
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
self.bandwidth.data = bandwidth
|
|
655
|
-
self.shape.data = shape
|
|
646
|
+
self.bandwidth.data = torch.clamp(
|
|
647
|
+
self.bandwidth.data, min=1.0 / (self.sample_rate / 2), max=1.0
|
|
648
|
+
)
|
|
649
|
+
self.shape.data = torch.clamp(self.shape.data, min=2.0, max=3.0)
|
|
656
650
|
|
|
657
651
|
# Create magnitude response with gain=1 -> (channels, freqs)
|
|
658
652
|
mag_response = self.exponential_power(
|
|
659
|
-
self.n_range, f_mean, bandwidth, shape * 8 - 14
|
|
653
|
+
self.n_range, self.f_mean, self.bandwidth, self.shape * 8 - 14
|
|
660
654
|
)
|
|
661
655
|
mag_response = mag_response / mag_response.max(dim=-1, keepdim=True)[0]
|
|
662
656
|
|