braindecode 1.8.1.dev168536805__tar.gz → 1.8.1.dev168570878__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.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/NOTICE.txt +0 -1
- {braindecode-1.8.1.dev168536805/braindecode.egg-info → braindecode-1.8.1.dev168570878}/PKG-INFO +2 -2
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/augmentation/__init__.py +2 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/augmentation/functional.py +132 -13
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/augmentation/transforms.py +104 -2
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/datasets/chb_mit.py +5 -39
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/datasets/siena.py +5 -39
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/datasets/sleep_physio_challe_18.py +0 -46
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/datasets/utils.py +37 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/functional/__init__.py +14 -1
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/functional/functions.py +101 -0
- braindecode-1.8.1.dev168570878/braindecode/functional/initialization.py +139 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/atcnet.py +17 -8
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/axon.py +6 -1
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/barista.py +22 -22
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/base.py +61 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/bendr.py +20 -12
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/biot.py +4 -2
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/brainbert.py +47 -16
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/brainomni.py +23 -16
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/cbramod.py +12 -11
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/csbrain.py +12 -5
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/ctnet.py +12 -33
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/dance.py +6 -11
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/deep4.py +6 -2
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/diver1.py +11 -8
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/duin.py +17 -12
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/eegconformer.py +3 -15
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/eegdino.py +2 -2
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/eeginception_erp.py +4 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/eegminer.py +4 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/eegnet.py +4 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/eegpt.py +25 -149
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/epint.py +26 -10
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/ifnet.py +20 -24
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/labram.py +17 -32
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/luna.py +29 -73
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/mapa.py +42 -26
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/medformer.py +24 -39
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/mirepnet.py +3 -12
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/mscformer.py +3 -31
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/mvpformer.py +18 -10
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/neuropose.py +18 -18
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/neurorvq.py +9 -27
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/neurorvq_tokenizer.py +32 -6
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/patchedtransformer.py +36 -20
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/popt.py +175 -4
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/sensingdynamics.py +18 -19
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/shallow_fbcsp.py +6 -2
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/signal_jepa.py +13 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/sinc_shallow.py +15 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/sparcnet.py +14 -10
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/steegformer.py +18 -30
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/tcformer.py +26 -33
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/tidnet.py +13 -4
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/tmsanet.py +11 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/util.py +23 -149
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/vemg2pose.py +20 -22
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/zuna.py +77 -26
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/modules/__init__.py +6 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/modules/attention.py +25 -10
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/modules/blocks.py +61 -6
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/modules/layers.py +47 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/regressor.py +6 -1
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/training/scoring.py +4 -1
- braindecode-1.8.1.dev168570878/braindecode/version.py +1 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878/braindecode.egg-info}/PKG-INFO +2 -2
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode.egg-info/SOURCES.txt +0 -2
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode.egg-info/requires.txt +1 -1
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/docs/api.rst +13 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/docs/whats_new.rst +61 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/pyproject.toml +2 -2
- braindecode-1.8.1.dev168536805/braindecode/datasets/bids/format.py +0 -717
- braindecode-1.8.1.dev168536805/braindecode/functional/initialization.py +0 -47
- braindecode-1.8.1.dev168536805/braindecode/modules/popt_modules.py +0 -187
- braindecode-1.8.1.dev168536805/braindecode/version.py +0 -1
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/LICENSE.txt +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/MANIFEST.in +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/README.rst +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/__init__.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/augmentation/base.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/classifier.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/datasets/__init__.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/datasets/_notebook_viewer.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/datasets/base.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/datasets/bbci.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/datasets/bcicomp.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/datasets/bids/__init__.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/datasets/bids/datasets.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/datasets/bids/hub.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/datasets/bids/hub_format.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/datasets/bids/hub_io.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/datasets/bids/hub_validation.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/datasets/bids/iterable.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/datasets/collate.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/datasets/mne.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/datasets/moabb.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/datasets/nmt.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/datasets/registry.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/datasets/sleep_physionet.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/datasets/tuh.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/datasets/xy.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/datautil/__init__.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/datautil/channel_utils.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/datautil/hub_formats.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/datautil/serialization.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/datautil/util.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/eegneuralnet.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/functional/_real_dft.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/__init__.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/attentionbasenet.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/attn_sleep.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/brainmodule.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/brant.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/codebrain.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/config.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/contrawr.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/deepsleepnet.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/dgcnn.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/eeg_clip.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/eeginception_mi.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/eegitnet.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/eegnex.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/eegsimpleconv.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/eegsym.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/eegtcnet.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/emg2qwerty.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/fbcnet.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/fblightconvnet.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/fbmsnet.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/gcnsnet.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/guetschel2026.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/hybrid.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/meta_neuromotor.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/msvtnet.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/reve.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/sccnet.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/seizure_transformer.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/sleep_stager_blanco_2020.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/sleep_stager_chambon_2018.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/sleepfm.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/sstdpn.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/summary.csv +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/syncnet.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/tcn.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/tfm_tokenizer.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/tsinception.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/models/usleep.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/modules/activation.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/modules/channels.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/modules/convolution.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/modules/dance_modules.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/modules/filter.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/modules/linear.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/modules/linear_attention.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/modules/parametrization.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/modules/quantization.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/modules/stats.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/modules/util.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/modules/wrapper.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/preprocessing/__init__.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/preprocessing/eegprep_preprocess.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/preprocessing/mne_preprocess.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/preprocessing/preprocess.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/preprocessing/util.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/preprocessing/windowers.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/samplers/__init__.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/samplers/base.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/samplers/ssl.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/training/__init__.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/training/callbacks.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/training/losses.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/util.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/visualization/__init__.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/visualization/activations.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/visualization/attribution.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/visualization/confusion_matrices.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/visualization/frequency.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/visualization/metrics.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/visualization/sanity.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/visualization/topology.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode.egg-info/dependency_links.txt +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode.egg-info/top_level.txt +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/docs/Makefile +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/docs/_templates/autosummary/class.rst +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/docs/_templates/autosummary/class_in_subdir.rst +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/docs/_templates/autosummary/function.rst +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/docs/_templates/autosummary/function_in_subdir.rst +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/docs/agent_docs.rst +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/docs/cite.rst +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/docs/conf.py +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/docs/help.rst +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/docs/index.rst +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/docs/install/install.rst +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/docs/install/install_pip.rst +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/docs/install/install_source.rst +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/docs/models/categorization/attention.rst +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/docs/models/categorization/channel.rst +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/docs/models/categorization/convolution.rst +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/docs/models/categorization/filterbank.rst +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/docs/models/categorization/gnn.rst +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/docs/models/categorization/interpretable.rst +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/docs/models/categorization/lbm.rst +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/docs/models/categorization/recurrent.rst +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/docs/models/categorization/spd.rst +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/docs/models/models.rst +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/docs/models/models_categorization.rst +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/docs/models/models_table.rst +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/docs/models/models_visualization.rst +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/docs/sg_execution_times.rst +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/docs/user_guide/channel_strategies.rst +0 -0
- {braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/setup.cfg +0 -0
|
@@ -47,7 +47,6 @@ The following components are licensed under the MIT License:
|
|
|
47
47
|
- `braindecode/models/mirepnet.py`
|
|
48
48
|
- `braindecode/models/popt.py`
|
|
49
49
|
- `braindecode/models/tfm_tokenizer.py`
|
|
50
|
-
- `braindecode/modules/popt_modules.py`
|
|
51
50
|
- `braindecode/models/brainomni.py`
|
|
52
51
|
- `braindecode/modules/quantization.py`
|
|
53
52
|
- `braindecode/modules/linear_attention.py`
|
{braindecode-1.8.1.dev168536805/braindecode.egg-info → braindecode-1.8.1.dev168570878}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: braindecode
|
|
3
|
-
Version: 1.8.1.
|
|
3
|
+
Version: 1.8.1.dev168570878
|
|
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>
|
|
@@ -32,8 +32,8 @@ Requires-Dist: joblib
|
|
|
32
32
|
Requires-Dist: torchinfo
|
|
33
33
|
Requires-Dist: pandas
|
|
34
34
|
Requires-Dist: wfdb>=4.3.1
|
|
35
|
-
Requires-Dist: linear_attention_transformer
|
|
36
35
|
Requires-Dist: docstring_inheritance
|
|
36
|
+
Requires-Dist: einops
|
|
37
37
|
Requires-Dist: pydantic>=2.0
|
|
38
38
|
Provides-Extra: moabb
|
|
39
39
|
Requires-Dist: moabb>=1.4.3; extra == "moabb"
|
|
@@ -14,6 +14,7 @@ from .transforms import (
|
|
|
14
14
|
FrequencyShift,
|
|
15
15
|
FTSurrogate,
|
|
16
16
|
GaussianNoise,
|
|
17
|
+
LabelSmoothing,
|
|
17
18
|
MaskEncoding,
|
|
18
19
|
Mixup,
|
|
19
20
|
SegmentationReconstruction,
|
|
@@ -40,6 +41,7 @@ __all__ = [
|
|
|
40
41
|
"CutMix",
|
|
41
42
|
"ChannelsDropout",
|
|
42
43
|
"GaussianNoise",
|
|
44
|
+
"LabelSmoothing",
|
|
43
45
|
"ChannelsSymmetry",
|
|
44
46
|
"SmoothTimeMask",
|
|
45
47
|
"BandstopFilter",
|
|
@@ -19,7 +19,22 @@ from mne.filter import notch_filter
|
|
|
19
19
|
from scipy.interpolate import Rbf
|
|
20
20
|
from sklearn.utils import check_random_state
|
|
21
21
|
from torch.fft import fft, ifft
|
|
22
|
-
from torch.nn.functional import pad
|
|
22
|
+
from torch.nn.functional import one_hot, pad
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _max_float_dtype(device: torch.device | str) -> torch.dtype:
|
|
26
|
+
"""float64, or float32 on Apple MPS, which has no float64."""
|
|
27
|
+
return torch.float32 if torch.device(device).type == "mps" else torch.float64
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def _to_device(t: torch.Tensor, device: torch.device | str) -> torch.Tensor:
|
|
31
|
+
"""Move ``t`` to ``device``, in single precision on MPS (no float64 there)."""
|
|
32
|
+
if torch.device(device).type == "mps":
|
|
33
|
+
if t.dtype == torch.float64:
|
|
34
|
+
return t.float().to(device)
|
|
35
|
+
if t.dtype == torch.complex128:
|
|
36
|
+
return t.to(torch.complex64).to(device)
|
|
37
|
+
return t.to(device)
|
|
23
38
|
|
|
24
39
|
|
|
25
40
|
def identity(X: torch.Tensor, y: torch.Tensor) -> tuple[torch.Tensor, torch.Tensor]:
|
|
@@ -92,10 +107,11 @@ def _new_random_fft_phase_odd(
|
|
|
92
107
|
rng = check_random_state(random_state)
|
|
93
108
|
random_phase = torch.from_numpy(
|
|
94
109
|
2j * np.pi * rng.random((batch_size, c, (n - 1) // 2))
|
|
95
|
-
)
|
|
110
|
+
)
|
|
111
|
+
random_phase = _to_device(random_phase, device)
|
|
96
112
|
return torch.cat(
|
|
97
113
|
[
|
|
98
|
-
torch.zeros((batch_size, c, 1), device=device),
|
|
114
|
+
torch.zeros((batch_size, c, 1), device=device, dtype=random_phase.dtype),
|
|
99
115
|
random_phase,
|
|
100
116
|
-torch.flip(random_phase, [-1]),
|
|
101
117
|
],
|
|
@@ -113,12 +129,13 @@ def _new_random_fft_phase_even(
|
|
|
113
129
|
rng = check_random_state(random_state)
|
|
114
130
|
random_phase = torch.from_numpy(
|
|
115
131
|
2j * np.pi * rng.random((batch_size, c, n // 2 - 1))
|
|
116
|
-
)
|
|
132
|
+
)
|
|
133
|
+
random_phase = _to_device(random_phase, device)
|
|
117
134
|
return torch.cat(
|
|
118
135
|
[
|
|
119
|
-
torch.zeros((batch_size, c, 1), device=device),
|
|
136
|
+
torch.zeros((batch_size, c, 1), device=device, dtype=random_phase.dtype),
|
|
120
137
|
random_phase,
|
|
121
|
-
torch.zeros((batch_size, c, 1), device=device),
|
|
138
|
+
torch.zeros((batch_size, c, 1), device=device, dtype=random_phase.dtype),
|
|
122
139
|
-torch.flip(random_phase, [-1]),
|
|
123
140
|
],
|
|
124
141
|
dim=-1,
|
|
@@ -178,7 +195,7 @@ def ft_surrogate(
|
|
|
178
195
|
and 0 <= phase_noise_magnitude <= 1
|
|
179
196
|
), f"eps must be a float between 0 and 1. Got {phase_noise_magnitude}."
|
|
180
197
|
|
|
181
|
-
f = fft(X.
|
|
198
|
+
f = fft(X.to(_max_float_dtype(X.device)), dim=-1)
|
|
182
199
|
device = X.device
|
|
183
200
|
|
|
184
201
|
n = f.shape[-1]
|
|
@@ -912,7 +929,15 @@ def _rotate_signals(
|
|
|
912
929
|
sensors_positions_matrix: torch.Tensor,
|
|
913
930
|
spherical: bool = True,
|
|
914
931
|
) -> torch.Tensor:
|
|
915
|
-
|
|
932
|
+
if X.device.type == "mps":
|
|
933
|
+
# MPS has no float64: compute the small (n_chans x n_chans) spherical
|
|
934
|
+
# spline matrices on CPU in double precision, only move the result
|
|
935
|
+
# (two separate steps: a combined device + dtype .to() from MPS
|
|
936
|
+
# returns zeros with some torch versions)
|
|
937
|
+
sensors_positions_matrix = sensors_positions_matrix.cpu().double()
|
|
938
|
+
rotations = [rotation.cpu().double() for rotation in rotations]
|
|
939
|
+
else:
|
|
940
|
+
sensors_positions_matrix = sensors_positions_matrix.to(X.device)
|
|
916
941
|
rot_sensors_matrices = [
|
|
917
942
|
rotation.matmul(sensors_positions_matrix) for rotation in rotations
|
|
918
943
|
]
|
|
@@ -922,9 +947,10 @@ def _rotate_signals(
|
|
|
922
947
|
torch.as_tensor(
|
|
923
948
|
_torch_make_interpolation_matrix(
|
|
924
949
|
sensors_positions_matrix.T, rot_sensors_matrix.T
|
|
925
|
-
)
|
|
926
|
-
|
|
927
|
-
|
|
950
|
+
)
|
|
951
|
+
)
|
|
952
|
+
.float()
|
|
953
|
+
.to(X.device)
|
|
928
954
|
for rot_sensors_matrix in rot_sensors_matrices
|
|
929
955
|
]
|
|
930
956
|
)
|
|
@@ -1063,10 +1089,12 @@ def mixup(
|
|
|
1063
1089
|
Online: https://arxiv.org/abs/1710.09412
|
|
1064
1090
|
.. [2] https://github.com/facebookresearch/mixup-cifar10/blob/master/train.py
|
|
1065
1091
|
"""
|
|
1066
|
-
device = X.device
|
|
1067
1092
|
batch_size, n_channels, n_times = X.shape
|
|
1068
1093
|
|
|
1069
|
-
X_mix =
|
|
1094
|
+
X_mix = X.new_zeros(
|
|
1095
|
+
(batch_size, n_channels, n_times),
|
|
1096
|
+
dtype=X.dtype if X.is_floating_point() else torch.get_default_dtype(),
|
|
1097
|
+
)
|
|
1070
1098
|
y_a = y.clone()
|
|
1071
1099
|
y_b = y[idx_perm].clone()
|
|
1072
1100
|
|
|
@@ -1124,6 +1152,97 @@ def cutmix(
|
|
|
1124
1152
|
return X_mix, (y.clone(), y[idx_perm].clone(), lam)
|
|
1125
1153
|
|
|
1126
1154
|
|
|
1155
|
+
def label_smoothing(
|
|
1156
|
+
X: torch.Tensor,
|
|
1157
|
+
y: torch.Tensor,
|
|
1158
|
+
epsilon: float,
|
|
1159
|
+
num_classes: int | None = None,
|
|
1160
|
+
) -> tuple[torch.Tensor, torch.Tensor]:
|
|
1161
|
+
"""Smooth targets toward the uniform distribution over the classes.
|
|
1162
|
+
|
|
1163
|
+
See [1]_ for details.
|
|
1164
|
+
|
|
1165
|
+
Parameters
|
|
1166
|
+
----------
|
|
1167
|
+
X : torch.Tensor
|
|
1168
|
+
EEG data in form ``batch_size, n_channels, n_times``. Returned
|
|
1169
|
+
unchanged.
|
|
1170
|
+
y : torch.Tensor
|
|
1171
|
+
Target of length ``batch_size`` holding class indices (float values
|
|
1172
|
+
are accepted when they are integral), or a floating-point tensor of
|
|
1173
|
+
shape ``batch_size, num_classes`` holding target distributions.
|
|
1174
|
+
epsilon : float
|
|
1175
|
+
Smoothing parameter between 0 and 1: the weight of the uniform
|
|
1176
|
+
distribution mixed into the targets. ``0`` returns the unsmoothed
|
|
1177
|
+
targets.
|
|
1178
|
+
num_classes : int | None, optional
|
|
1179
|
+
Number of classes. Required when ``y`` holds class indices; when
|
|
1180
|
+
``y`` already holds distributions, it must match the size of the
|
|
1181
|
+
last dimension of ``y``. Defaults to None.
|
|
1182
|
+
|
|
1183
|
+
Returns
|
|
1184
|
+
-------
|
|
1185
|
+
tuple
|
|
1186
|
+
``X``, ``y``. Where ``X`` is unchanged and ``y`` is a
|
|
1187
|
+
floating-point tensor of shape ``batch_size, num_classes`` whose
|
|
1188
|
+
rows sum to one.
|
|
1189
|
+
|
|
1190
|
+
References
|
|
1191
|
+
----------
|
|
1192
|
+
.. [1] Christian Szegedy, Vincent Vanhoucke, Jonathon Shlens and
|
|
1193
|
+
Zbigniew Wojna (2016). Rethinking the Inception Architecture for
|
|
1194
|
+
Computer Vision. In 2016 IEEE Conference on Computer Vision and
|
|
1195
|
+
Pattern Recognition (CVPR), pp. 2818-2826.
|
|
1196
|
+
Online: https://arxiv.org/abs/1512.00567
|
|
1197
|
+
"""
|
|
1198
|
+
if not isinstance(epsilon, Real) or not 0.0 <= float(epsilon) <= 1.0:
|
|
1199
|
+
raise ValueError(
|
|
1200
|
+
f"epsilon should be a real number between 0 and 1. Got {epsilon!r}."
|
|
1201
|
+
)
|
|
1202
|
+
if num_classes is not None and (
|
|
1203
|
+
not isinstance(num_classes, int)
|
|
1204
|
+
or isinstance(num_classes, bool)
|
|
1205
|
+
or num_classes < 2
|
|
1206
|
+
):
|
|
1207
|
+
raise ValueError(
|
|
1208
|
+
f"num_classes should be an integer of at least 2. Got {num_classes!r}."
|
|
1209
|
+
)
|
|
1210
|
+
|
|
1211
|
+
if y.dim() == 1:
|
|
1212
|
+
# class-index targets: smooth their one-hot encoding
|
|
1213
|
+
if num_classes is None:
|
|
1214
|
+
raise ValueError("num_classes is required when y holds class indices.")
|
|
1215
|
+
if not torch.all(y == y.floor()):
|
|
1216
|
+
raise ValueError(
|
|
1217
|
+
"y holds non-integral values; class-index targets should be "
|
|
1218
|
+
"integers or integral floats."
|
|
1219
|
+
)
|
|
1220
|
+
if y.numel() > 0 and (y.min() < 0 or y.max() >= num_classes):
|
|
1221
|
+
raise ValueError(f"y holds class indices outside [0, {num_classes}).")
|
|
1222
|
+
one_hot_y = one_hot(y.long(), num_classes).to(dtype=X.dtype)
|
|
1223
|
+
return X, one_hot_y * (1.0 - epsilon) + epsilon / num_classes
|
|
1224
|
+
|
|
1225
|
+
if y.is_floating_point() and y.dim() >= 2:
|
|
1226
|
+
# target distributions: interpolate them toward the uniform one
|
|
1227
|
+
n_classes = y.shape[-1]
|
|
1228
|
+
if num_classes is not None and num_classes != n_classes:
|
|
1229
|
+
raise ValueError(
|
|
1230
|
+
f"num_classes ({num_classes}) does not match the size of the "
|
|
1231
|
+
f"last dimension of y ({n_classes})."
|
|
1232
|
+
)
|
|
1233
|
+
if n_classes < 2:
|
|
1234
|
+
raise ValueError(
|
|
1235
|
+
f"y should hold distributions over at least 2 classes. Got {n_classes}."
|
|
1236
|
+
)
|
|
1237
|
+
return X, y * (1.0 - epsilon) + epsilon / n_classes
|
|
1238
|
+
|
|
1239
|
+
raise ValueError(
|
|
1240
|
+
"y should hold class indices or floating-point target distributions "
|
|
1241
|
+
f"with a class dimension; got dtype {y.dtype} and shape "
|
|
1242
|
+
f"{tuple(y.shape)}."
|
|
1243
|
+
)
|
|
1244
|
+
|
|
1245
|
+
|
|
1127
1246
|
def segmentation_reconstruction(
|
|
1128
1247
|
X: torch.Tensor,
|
|
1129
1248
|
y: torch.Tensor,
|
|
@@ -18,6 +18,7 @@ from braindecode.util import resolve_montage_name
|
|
|
18
18
|
|
|
19
19
|
from .base import Transform
|
|
20
20
|
from .functional import (
|
|
21
|
+
_max_float_dtype,
|
|
21
22
|
amplitude_scale,
|
|
22
23
|
band_rotation,
|
|
23
24
|
bandstop_filter,
|
|
@@ -29,6 +30,7 @@ from .functional import (
|
|
|
29
30
|
frequency_shift,
|
|
30
31
|
ft_surrogate,
|
|
31
32
|
gaussian_noise,
|
|
33
|
+
label_smoothing,
|
|
32
34
|
mask_encoding,
|
|
33
35
|
mixup,
|
|
34
36
|
segmentation_reconstruction,
|
|
@@ -494,6 +496,7 @@ class SmoothTimeMask(Transform):
|
|
|
494
496
|
size=X.shape[0],
|
|
495
497
|
),
|
|
496
498
|
device=X.device,
|
|
499
|
+
dtype=_max_float_dtype(X.device),
|
|
497
500
|
) * (seq_length - mask_len_samples)
|
|
498
501
|
return {
|
|
499
502
|
"mask_start_per_sample": mask_start,
|
|
@@ -675,7 +678,11 @@ class FrequencyShift(Transform):
|
|
|
675
678
|
return super().get_augmentation_params(*batch)
|
|
676
679
|
X = batch[0]
|
|
677
680
|
|
|
678
|
-
u = torch.as_tensor(
|
|
681
|
+
u = torch.as_tensor(
|
|
682
|
+
self.rng.uniform(size=X.shape[0]),
|
|
683
|
+
device=X.device,
|
|
684
|
+
dtype=_max_float_dtype(X.device),
|
|
685
|
+
)
|
|
679
686
|
max_delta_freq = self.max_delta_freq
|
|
680
687
|
if isinstance(max_delta_freq, torch.Tensor):
|
|
681
688
|
max_delta_freq = max_delta_freq.to(X.device)
|
|
@@ -833,7 +840,10 @@ class SensorsRotation(Transform):
|
|
|
833
840
|
if isinstance(max_degrees, torch.Tensor):
|
|
834
841
|
max_degrees = max_degrees.to(X.device)
|
|
835
842
|
random_angles = (
|
|
836
|
-
torch.as_tensor(u, device=X.device)
|
|
843
|
+
torch.as_tensor(u, device=X.device, dtype=_max_float_dtype(X.device))
|
|
844
|
+
* 2
|
|
845
|
+
* max_degrees
|
|
846
|
+
- max_degrees
|
|
837
847
|
)
|
|
838
848
|
return {
|
|
839
849
|
"sensors_positions_matrix": self.sensors_positions_matrix,
|
|
@@ -1146,6 +1156,98 @@ class CutMix(Mixup):
|
|
|
1146
1156
|
return dict(params, cut_t_start=start, cut_t_len=end - start)
|
|
1147
1157
|
|
|
1148
1158
|
|
|
1159
|
+
class LabelSmoothing(Transform):
|
|
1160
|
+
"""Label smoothing from Szegedy et al. (2016) [1]_.
|
|
1161
|
+
|
|
1162
|
+
Replaces each target with its convex combination with the uniform
|
|
1163
|
+
distribution over the classes, penalizing over-confident predictions.
|
|
1164
|
+
The signals are returned unchanged; only the targets change.
|
|
1165
|
+
|
|
1166
|
+
The smoothed targets are floating-point distributions of shape
|
|
1167
|
+
``batch_size, num_classes`` (each row sums to one), so the training
|
|
1168
|
+
loss must accept target distributions, e.g. soft cross-entropy
|
|
1169
|
+
``-(y * torch.log_softmax(logits, dim=-1)).sum(-1).mean()`` or
|
|
1170
|
+
``torch.nn.KLDivLoss``. The transform composes before target-mixing
|
|
1171
|
+
transforms such as :class:`braindecode.augmentation.Mixup`, whose
|
|
1172
|
+
fractional-target path then mixes the smoothed distributions. The
|
|
1173
|
+
fixed-expansion mode (``n_augmentation > 0``) of
|
|
1174
|
+
:class:`braindecode.augmentation.AugmentedDataLoader` is not supported:
|
|
1175
|
+
it cannot concatenate the unsmoothed original targets with the reshaped
|
|
1176
|
+
smoothed copies.
|
|
1177
|
+
|
|
1178
|
+
Parameters
|
|
1179
|
+
----------
|
|
1180
|
+
epsilon : float
|
|
1181
|
+
Smoothing parameter between 0 and 1: the weight of the uniform
|
|
1182
|
+
distribution mixed into the targets. ``0`` disables smoothing.
|
|
1183
|
+
num_classes : int | None, optional
|
|
1184
|
+
Number of classes. Required when the targets are class indices;
|
|
1185
|
+
when the targets are already distributions of shape
|
|
1186
|
+
``batch_size, num_classes``, it must match their last dimension.
|
|
1187
|
+
Defaults to None.
|
|
1188
|
+
random_state : int | numpy.random.Generator, optional
|
|
1189
|
+
Seed to be used to instantiate numpy random number generator
|
|
1190
|
+
instance. The transform is deterministic, so the seed only feeds
|
|
1191
|
+
the application-probability machinery, which is inactive here.
|
|
1192
|
+
Defaults to None.
|
|
1193
|
+
|
|
1194
|
+
References
|
|
1195
|
+
----------
|
|
1196
|
+
.. [1] Christian Szegedy, Vincent Vanhoucke, Jonathon Shlens and
|
|
1197
|
+
Zbigniew Wojna (2016). Rethinking the Inception Architecture for
|
|
1198
|
+
Computer Vision. In 2016 IEEE Conference on Computer Vision and
|
|
1199
|
+
Pattern Recognition (CVPR), pp. 2818-2826.
|
|
1200
|
+
Online: https://arxiv.org/abs/1512.00567
|
|
1201
|
+
"""
|
|
1202
|
+
|
|
1203
|
+
operation = staticmethod(label_smoothing) # type: ignore[assignment]
|
|
1204
|
+
|
|
1205
|
+
def __init__(self, epsilon, num_classes=None, random_state=None):
|
|
1206
|
+
super().__init__(
|
|
1207
|
+
probability=1.0, # LabelSmoothing has to be applied to whole batches
|
|
1208
|
+
random_state=random_state,
|
|
1209
|
+
)
|
|
1210
|
+
if not isinstance(epsilon, Real) or not 0.0 <= float(epsilon) <= 1.0:
|
|
1211
|
+
raise ValueError(
|
|
1212
|
+
f"epsilon should be a real number between 0 and 1. Got {epsilon!r}."
|
|
1213
|
+
)
|
|
1214
|
+
if num_classes is not None and (
|
|
1215
|
+
not isinstance(num_classes, int)
|
|
1216
|
+
or isinstance(num_classes, bool)
|
|
1217
|
+
or num_classes < 2
|
|
1218
|
+
):
|
|
1219
|
+
raise ValueError(
|
|
1220
|
+
f"num_classes should be an integer of at least 2. Got {num_classes!r}."
|
|
1221
|
+
)
|
|
1222
|
+
self.epsilon = epsilon
|
|
1223
|
+
self.num_classes = num_classes
|
|
1224
|
+
|
|
1225
|
+
def get_augmentation_params(self, *batch):
|
|
1226
|
+
"""Return transform parameters.
|
|
1227
|
+
|
|
1228
|
+
Parameters
|
|
1229
|
+
----------
|
|
1230
|
+
X : tensor.Tensor
|
|
1231
|
+
The data.
|
|
1232
|
+
y : tensor.Tensor
|
|
1233
|
+
The labels.
|
|
1234
|
+
|
|
1235
|
+
Returns
|
|
1236
|
+
-------
|
|
1237
|
+
params : dict
|
|
1238
|
+
Contains
|
|
1239
|
+
|
|
1240
|
+
* epsilon : float
|
|
1241
|
+
Smoothing parameter between 0 and 1.
|
|
1242
|
+
* num_classes : int | None
|
|
1243
|
+
The number of classes.
|
|
1244
|
+
"""
|
|
1245
|
+
return {
|
|
1246
|
+
"epsilon": self.epsilon,
|
|
1247
|
+
"num_classes": self.num_classes,
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
|
|
1149
1251
|
class SegmentationReconstruction(Transform):
|
|
1150
1252
|
"""Segmentation Reconstruction from Lotte (2015) [Lotte2015]_.
|
|
1151
1253
|
|
{braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/datasets/chb_mit.py
RENAMED
|
@@ -16,12 +16,7 @@ It reorganizes the file structure to comply with the BIDS specification. To this
|
|
|
16
16
|
# License: BSD (3-clause)
|
|
17
17
|
from __future__ import annotations
|
|
18
18
|
|
|
19
|
-
from
|
|
20
|
-
|
|
21
|
-
from mne.datasets import fetch_dataset
|
|
22
|
-
|
|
23
|
-
from braindecode.datasets import BIDSDataset
|
|
24
|
-
from braindecode.datasets.utils import _correct_dataset_path
|
|
19
|
+
from braindecode.datasets.utils import _ZenodoBIDSDataset
|
|
25
20
|
|
|
26
21
|
CHB_MIT_URL = "https://zenodo.org/records/10259996/files/BIDS_CHB-MIT.zip"
|
|
27
22
|
CHB_MIT_archive_name = "chb_mit_bids.zip"
|
|
@@ -38,7 +33,7 @@ CHB_MIT_dataset_params = {
|
|
|
38
33
|
}
|
|
39
34
|
|
|
40
35
|
|
|
41
|
-
class CHBMIT(
|
|
36
|
+
class CHBMIT(_ZenodoBIDSDataset):
|
|
42
37
|
"""The Children's Hospital Boston EEG Dataset.
|
|
43
38
|
|
|
44
39
|
This database, collected at the Children's Hospital Boston, consists of EEG recordings
|
|
@@ -129,35 +124,6 @@ class CHBMIT(BIDSDataset):
|
|
|
129
124
|
.. footbibliography::
|
|
130
125
|
"""
|
|
131
126
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
path_root = fetch_dataset(
|
|
136
|
-
dataset_params=CHB_MIT_dataset_params,
|
|
137
|
-
path=None,
|
|
138
|
-
processor="unzip",
|
|
139
|
-
force_update=False,
|
|
140
|
-
)
|
|
141
|
-
# First time we fetch the dataset, we need to move the files to the
|
|
142
|
-
# correct directory.
|
|
143
|
-
path_root = _correct_dataset_path(
|
|
144
|
-
path_root, CHB_MIT_archive_name, "BIDS_CHB-MIT"
|
|
145
|
-
)
|
|
146
|
-
else:
|
|
147
|
-
# Validate that the provided root is a valid BIDS dataset
|
|
148
|
-
if not Path(f"{root}/participants.tsv").exists():
|
|
149
|
-
raise ValueError(
|
|
150
|
-
f"The provided root directory {root} does not contain a valid "
|
|
151
|
-
"BIDS dataset (missing participants.tsv). Please ensure the "
|
|
152
|
-
"root points directly to the BIDS dataset directory."
|
|
153
|
-
)
|
|
154
|
-
path_root = root
|
|
155
|
-
|
|
156
|
-
kwargs["root"] = path_root
|
|
157
|
-
|
|
158
|
-
super().__init__(
|
|
159
|
-
*args,
|
|
160
|
-
extensions=".edf",
|
|
161
|
-
check=False,
|
|
162
|
-
**kwargs,
|
|
163
|
-
)
|
|
127
|
+
_dataset_params = CHB_MIT_dataset_params
|
|
128
|
+
_archive_name = CHB_MIT_archive_name
|
|
129
|
+
_unzipped_dir = "BIDS_CHB-MIT"
|
{braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/datasets/siena.py
RENAMED
|
@@ -15,12 +15,7 @@ It reorganizes the file structure to comply with the BIDS specification. To this
|
|
|
15
15
|
# License: BSD (3-clause)
|
|
16
16
|
from __future__ import annotations
|
|
17
17
|
|
|
18
|
-
from
|
|
19
|
-
|
|
20
|
-
from mne.datasets import fetch_dataset
|
|
21
|
-
|
|
22
|
-
from braindecode.datasets import BIDSDataset
|
|
23
|
-
from braindecode.datasets.utils import _correct_dataset_path
|
|
18
|
+
from braindecode.datasets.utils import _ZenodoBIDSDataset
|
|
24
19
|
|
|
25
20
|
SIENA_URL = "https://zenodo.org/records/10640762/files/BIDS_Siena.zip"
|
|
26
21
|
SIENA_archive_name = "SIENA.zip"
|
|
@@ -37,7 +32,7 @@ SIENA_dataset_params = {
|
|
|
37
32
|
}
|
|
38
33
|
|
|
39
34
|
|
|
40
|
-
class SIENA(
|
|
35
|
+
class SIENA(_ZenodoBIDSDataset):
|
|
41
36
|
"""The Siena EEG Dataset.
|
|
42
37
|
|
|
43
38
|
The database consists of EEG recordings of 14 patients acquired at the Unit of Neurology
|
|
@@ -128,35 +123,6 @@ class SIENA(BIDSDataset):
|
|
|
128
123
|
automated seizure detection algorithms. Epilepsia, 66, 14-24.
|
|
129
124
|
"""
|
|
130
125
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
path_root = fetch_dataset(
|
|
135
|
-
dataset_params=SIENA_dataset_params,
|
|
136
|
-
path=None,
|
|
137
|
-
processor="unzip",
|
|
138
|
-
force_update=False,
|
|
139
|
-
)
|
|
140
|
-
# First time we fetch the dataset, we need to move the files to the
|
|
141
|
-
# correct directory.
|
|
142
|
-
path_root = _correct_dataset_path(
|
|
143
|
-
path_root, SIENA_archive_name, "BIDS_Siena"
|
|
144
|
-
)
|
|
145
|
-
else:
|
|
146
|
-
# Validate that the provided root is a valid BIDS dataset
|
|
147
|
-
if not Path(f"{root}/participants.tsv").exists():
|
|
148
|
-
raise ValueError(
|
|
149
|
-
f"The provided root directory {root} does not contain a valid "
|
|
150
|
-
"BIDS dataset (missing participants.tsv). Please ensure the "
|
|
151
|
-
"root points directly to the BIDS dataset directory."
|
|
152
|
-
)
|
|
153
|
-
path_root = root
|
|
154
|
-
|
|
155
|
-
kwargs["root"] = path_root
|
|
156
|
-
|
|
157
|
-
super().__init__(
|
|
158
|
-
*args,
|
|
159
|
-
extensions=".edf",
|
|
160
|
-
check=False,
|
|
161
|
-
**kwargs,
|
|
162
|
-
)
|
|
126
|
+
_dataset_params = SIENA_dataset_params
|
|
127
|
+
_archive_name = SIENA_archive_name
|
|
128
|
+
_unzipped_dir = "BIDS_Siena"
|
|
@@ -57,52 +57,6 @@ def ensure_metafiles_exist():
|
|
|
57
57
|
_download_if_missing(file_path, url)
|
|
58
58
|
|
|
59
59
|
|
|
60
|
-
def _update_pc18_sleep_records(fname=PC18_RECORDS):
|
|
61
|
-
"""Create CSV file with information about available PC18 recordings."""
|
|
62
|
-
# Load and massage the checksums.
|
|
63
|
-
sha_train_df = pd.read_csv(
|
|
64
|
-
PC18_SHA1_TRAINING,
|
|
65
|
-
sep=" ",
|
|
66
|
-
header=None,
|
|
67
|
-
names=["sha", "fname"],
|
|
68
|
-
engine="python",
|
|
69
|
-
)
|
|
70
|
-
sha_test_df = pd.read_csv(
|
|
71
|
-
PC18_SHA1_TEST, sep=" ", header=None, names=["sha", "fname"], engine="python"
|
|
72
|
-
)
|
|
73
|
-
sha_train_df["Split"] = "training"
|
|
74
|
-
sha_test_df["Split"] = "test"
|
|
75
|
-
sha_df = pd.concat([sha_train_df, sha_test_df], axis=0, ignore_index=True)
|
|
76
|
-
select_records = (
|
|
77
|
-
sha_df.fname.str.startswith("tr") | sha_df.fname.str.startswith("te")
|
|
78
|
-
) & ~sha_df.fname.str.endswith("arousal.mat")
|
|
79
|
-
sha_df = sha_df[select_records]
|
|
80
|
-
sha_df["Record"] = sha_df["fname"].str.split("/", expand=True)[0]
|
|
81
|
-
sha_df["fname"] = sha_df[["Split", "fname"]].agg("/".join, axis=1)
|
|
82
|
-
|
|
83
|
-
# Load and massage the data.
|
|
84
|
-
data = pd.read_csv(PC18_INFO)
|
|
85
|
-
|
|
86
|
-
data = data.reset_index().rename({"index": "Subject"}, axis=1)
|
|
87
|
-
data["Sex"] = (
|
|
88
|
-
data["Sex"].map({"F": "female", "M": "male", "m": "male"}).astype("category")
|
|
89
|
-
)
|
|
90
|
-
data = sha_df.merge(data, on="Record")
|
|
91
|
-
|
|
92
|
-
data["Record type"] = (
|
|
93
|
-
data["fname"]
|
|
94
|
-
.str.split(".", expand=True)[1]
|
|
95
|
-
.map({"hea": "Header", "mat": "PSG", "arousal": "Arousal"})
|
|
96
|
-
.astype("category")
|
|
97
|
-
)
|
|
98
|
-
data = data[
|
|
99
|
-
["Subject", "Record", "Record type", "Split", "Age", "Sex", "sha", "fname"]
|
|
100
|
-
].sort_values(by="Subject")
|
|
101
|
-
|
|
102
|
-
# Save the data.
|
|
103
|
-
data.to_csv(fname, index=False)
|
|
104
|
-
|
|
105
|
-
|
|
106
60
|
def _data_path(path=None):
|
|
107
61
|
"""Get path to local copy of PC18 dataset."""
|
|
108
62
|
key = "PC18_DATASET_PATH"
|
{braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/datasets/utils.py
RENAMED
|
@@ -9,6 +9,10 @@ from __future__ import annotations
|
|
|
9
9
|
import os
|
|
10
10
|
from pathlib import Path
|
|
11
11
|
|
|
12
|
+
from mne.datasets import fetch_dataset
|
|
13
|
+
|
|
14
|
+
from .bids import BIDSDataset
|
|
15
|
+
|
|
12
16
|
|
|
13
17
|
def _correct_dataset_path(
|
|
14
18
|
path: str, archive_name: str, subfolder_name: str | None = None
|
|
@@ -65,3 +69,36 @@ def _correct_dataset_path(
|
|
|
65
69
|
path = subfolder_path
|
|
66
70
|
|
|
67
71
|
return path
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
class _ZenodoBIDSDataset(BIDSDataset):
|
|
75
|
+
"""A BIDS dataset in EDF files, downloaded from a Zenodo archive when no
|
|
76
|
+
``root`` is given. Subclasses set the three class attributes below."""
|
|
77
|
+
|
|
78
|
+
_dataset_params: dict
|
|
79
|
+
_archive_name: str # the downloaded archive
|
|
80
|
+
_unzipped_dir: str # the folder the archive extracts to
|
|
81
|
+
|
|
82
|
+
def __init__(self, root=None, *args, **kwargs):
|
|
83
|
+
if root is None:
|
|
84
|
+
path_root = fetch_dataset(
|
|
85
|
+
dataset_params=self._dataset_params,
|
|
86
|
+
path=None,
|
|
87
|
+
processor="unzip",
|
|
88
|
+
force_update=False,
|
|
89
|
+
)
|
|
90
|
+
# The first fetch extracts into a nested folder: point at the data.
|
|
91
|
+
path_root = _correct_dataset_path(
|
|
92
|
+
path_root, self._archive_name, self._unzipped_dir
|
|
93
|
+
)
|
|
94
|
+
elif not Path(f"{root}/participants.tsv").exists():
|
|
95
|
+
raise ValueError(
|
|
96
|
+
f"The provided root directory {root} does not contain a valid "
|
|
97
|
+
"BIDS dataset (missing participants.tsv). Please ensure the "
|
|
98
|
+
"root points directly to the BIDS dataset directory."
|
|
99
|
+
)
|
|
100
|
+
else:
|
|
101
|
+
path_root = root
|
|
102
|
+
super().__init__(
|
|
103
|
+
*args, root=path_root, extensions=".edf", check=False, **kwargs
|
|
104
|
+
)
|
{braindecode-1.8.1.dev168536805 → braindecode-1.8.1.dev168570878}/braindecode/functional/__init__.py
RENAMED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from .functions import (
|
|
2
2
|
_get_gaussian_kernel1d,
|
|
3
|
+
apply_rotary,
|
|
3
4
|
daubechies_filters,
|
|
4
5
|
drop_path,
|
|
5
6
|
dwt_max_level,
|
|
@@ -10,6 +11,9 @@ from .functions import (
|
|
|
10
11
|
pairwise_iou_1d,
|
|
11
12
|
plv_time,
|
|
12
13
|
prefer_fft_conv,
|
|
14
|
+
rotary_angles,
|
|
15
|
+
rotary_frequencies,
|
|
16
|
+
rotate_half,
|
|
13
17
|
rotate_pairs,
|
|
14
18
|
safe_log,
|
|
15
19
|
sinusoidal_positional_encoding,
|
|
@@ -17,10 +21,15 @@ from .functions import (
|
|
|
17
21
|
square,
|
|
18
22
|
wavelet_decomposition,
|
|
19
23
|
)
|
|
20
|
-
from .initialization import
|
|
24
|
+
from .initialization import (
|
|
25
|
+
glorot_weight_zero_bias,
|
|
26
|
+
init_weights_,
|
|
27
|
+
rescale_parameter,
|
|
28
|
+
)
|
|
21
29
|
|
|
22
30
|
__all__ = [
|
|
23
31
|
"_get_gaussian_kernel1d",
|
|
32
|
+
"apply_rotary",
|
|
24
33
|
"daubechies_filters",
|
|
25
34
|
"drop_path",
|
|
26
35
|
"dwt_max_level",
|
|
@@ -31,6 +40,9 @@ __all__ = [
|
|
|
31
40
|
"pairwise_iou_1d",
|
|
32
41
|
"plv_time",
|
|
33
42
|
"prefer_fft_conv",
|
|
43
|
+
"rotary_angles",
|
|
44
|
+
"rotary_frequencies",
|
|
45
|
+
"rotate_half",
|
|
34
46
|
"rotate_pairs",
|
|
35
47
|
"safe_log",
|
|
36
48
|
"sinusoidal_positional_encoding",
|
|
@@ -39,4 +51,5 @@ __all__ = [
|
|
|
39
51
|
"wavelet_decomposition",
|
|
40
52
|
"glorot_weight_zero_bias",
|
|
41
53
|
"rescale_parameter",
|
|
54
|
+
"init_weights_",
|
|
42
55
|
]
|