braindecode 0.4.85__tar.gz → 0.5__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.
Files changed (169) hide show
  1. Braindecode-0.5/Braindecode.egg-info/PKG-INFO +123 -0
  2. Braindecode-0.5/Braindecode.egg-info/SOURCES.txt +110 -0
  3. {Braindecode-0.4.85 → Braindecode-0.5}/Braindecode.egg-info/requires.txt +3 -3
  4. {Braindecode-0.4.85 → Braindecode-0.5}/LICENSE.txt +1 -1
  5. Braindecode-0.5/PKG-INFO +123 -0
  6. Braindecode-0.5/README.rst +105 -0
  7. Braindecode-0.5/braindecode/__init__.py +4 -0
  8. Braindecode-0.5/braindecode/classifier.py +188 -0
  9. Braindecode-0.5/braindecode/datasets/__init__.py +8 -0
  10. Braindecode-0.5/braindecode/datasets/base.py +140 -0
  11. Braindecode-0.5/braindecode/datasets/mne.py +136 -0
  12. Braindecode-0.5/braindecode/datasets/moabb.py +110 -0
  13. Braindecode-0.5/braindecode/datasets/tuh.py +113 -0
  14. Braindecode-0.5/braindecode/datasets/xy.py +77 -0
  15. Braindecode-0.5/braindecode/datautil/__init__.py +6 -0
  16. Braindecode-0.5/braindecode/datautil/preprocess.py +253 -0
  17. Braindecode-0.5/braindecode/datautil/windowers.py +315 -0
  18. Braindecode-0.5/braindecode/experiments/__init__.py +0 -0
  19. Braindecode-0.5/braindecode/experiments/bcic_iv_2a/__init__.py +0 -0
  20. Braindecode-0.5/braindecode/experiments/bcic_iv_2a/config.py +119 -0
  21. Braindecode-0.5/braindecode/experiments/bcic_iv_2a/run.py +230 -0
  22. Braindecode-0.5/braindecode/models/__init__.py +9 -0
  23. {Braindecode-0.4.85 → Braindecode-0.5}/braindecode/models/deep4.py +70 -62
  24. {Braindecode-0.4.85 → Braindecode-0.5}/braindecode/models/eegnet.py +102 -100
  25. Braindecode-0.5/braindecode/models/eegresnet.py +233 -0
  26. Braindecode-0.5/braindecode/models/functions.py +43 -0
  27. {Braindecode-0.4.85 → Braindecode-0.5}/braindecode/models/hybrid.py +13 -36
  28. {Braindecode-0.4.85/braindecode/torch_ext → Braindecode-0.5/braindecode/models}/modules.py +16 -12
  29. {Braindecode-0.4.85 → Braindecode-0.5}/braindecode/models/shallow_fbcsp.py +55 -53
  30. {Braindecode-0.4.85 → Braindecode-0.5}/braindecode/models/util.py +21 -1
  31. Braindecode-0.5/braindecode/regressor.py +187 -0
  32. Braindecode-0.5/braindecode/training/__init__.py +8 -0
  33. Braindecode-0.5/braindecode/training/callbacks.py +21 -0
  34. Braindecode-0.5/braindecode/training/losses.py +15 -0
  35. Braindecode-0.5/braindecode/training/scoring.py +284 -0
  36. Braindecode-0.5/braindecode/util.py +329 -0
  37. Braindecode-0.5/braindecode/version.py +1 -0
  38. Braindecode-0.5/braindecode/visualization/gradients.py +42 -0
  39. {Braindecode-0.4.85 → Braindecode-0.5}/docs/Makefile +11 -2
  40. Braindecode-0.5/docs/_build/html/_downloads/1224801107d6c3b138edf8ee33de0561/plot_bcic_iv_2a_moabb_cropped.ipynb +275 -0
  41. Braindecode-0.5/docs/_build/html/_downloads/176a7695926ccfe061692c4af12b673d/plot_dataset_example.ipynb +252 -0
  42. Braindecode-0.5/docs/_build/html/_downloads/25408d8d92a873e370d4750ba414b84a/benchmark_lazy_eager_loading.ipynb +194 -0
  43. Braindecode-0.5/docs/_build/html/_downloads/49b1f19a86467aeaf762a1550583a845/plot_custom_dataset_example.ipynb +115 -0
  44. Braindecode-0.5/docs/_build/html/_downloads/748680401b0360239d00624375dd9587/plot_bcic_iv_2a_moabb_trial.ipynb +232 -0
  45. Braindecode-0.5/docs/_build/html/_downloads/9c64c2c15907a661b1fe2d7dd209a434/plot_regression.ipynb +54 -0
  46. Braindecode-0.5/docs/_build/html/_downloads/e42b5bd97033be02521040b0d5ee21c3/plot_mne_dataset_example.ipynb +115 -0
  47. Braindecode-0.5/docs/_templates/autosummary/class.rst +14 -0
  48. Braindecode-0.5/docs/_templates/autosummary/function.rst +12 -0
  49. Braindecode-0.5/docs/api.rst +125 -0
  50. Braindecode-0.5/docs/auto_examples/benchmark_lazy_eager_loading.ipynb +194 -0
  51. Braindecode-0.5/docs/auto_examples/benchmark_lazy_eager_loading.rst +390 -0
  52. Braindecode-0.5/docs/auto_examples/index.rst +178 -0
  53. Braindecode-0.5/docs/auto_examples/plot_bcic_iv_2a_moabb_cropped.ipynb +275 -0
  54. Braindecode-0.5/docs/auto_examples/plot_bcic_iv_2a_moabb_cropped.rst +523 -0
  55. Braindecode-0.5/docs/auto_examples/plot_bcic_iv_2a_moabb_trial.ipynb +232 -0
  56. Braindecode-0.5/docs/auto_examples/plot_bcic_iv_2a_moabb_trial.rst +441 -0
  57. Braindecode-0.5/docs/auto_examples/plot_custom_dataset_example.ipynb +115 -0
  58. Braindecode-0.5/docs/auto_examples/plot_custom_dataset_example.rst +130 -0
  59. Braindecode-0.5/docs/auto_examples/plot_dataset_example.ipynb +252 -0
  60. Braindecode-0.5/docs/auto_examples/plot_dataset_example.rst +411 -0
  61. Braindecode-0.5/docs/auto_examples/plot_mne_dataset_example.ipynb +115 -0
  62. Braindecode-0.5/docs/auto_examples/plot_mne_dataset_example.rst +139 -0
  63. Braindecode-0.5/docs/auto_examples/plot_regression.ipynb +54 -0
  64. Braindecode-0.5/docs/auto_examples/plot_regression.rst +221 -0
  65. Braindecode-0.5/docs/auto_examples/sg_execution_times.rst +24 -0
  66. {Braindecode-0.4.85 → Braindecode-0.5}/docs/conf.py +102 -40
  67. Braindecode-0.5/docs/generated/braindecode.classifier.EEGClassifier.rst +14 -0
  68. Braindecode-0.5/docs/generated/braindecode.datasets.BaseConcatDataset.rst +14 -0
  69. Braindecode-0.5/docs/generated/braindecode.datasets.BaseDataset.rst +14 -0
  70. Braindecode-0.5/docs/generated/braindecode.datasets.MOABBDataset.rst +14 -0
  71. Braindecode-0.5/docs/generated/braindecode.datasets.WindowsDataset.rst +14 -0
  72. Braindecode-0.5/docs/generated/braindecode.datasets.create_from_X_y.rst +12 -0
  73. Braindecode-0.5/docs/generated/braindecode.datasets.create_from_mne_epochs.rst +12 -0
  74. Braindecode-0.5/docs/generated/braindecode.datasets.create_from_mne_raw.rst +12 -0
  75. Braindecode-0.5/docs/generated/braindecode.datautil.create_fixed_length_windows.rst +12 -0
  76. Braindecode-0.5/docs/generated/braindecode.datautil.create_windows_from_events.rst +12 -0
  77. Braindecode-0.5/docs/generated/braindecode.datautil.exponential_moving_demean.rst +12 -0
  78. Braindecode-0.5/docs/generated/braindecode.datautil.exponential_moving_standardize.rst +12 -0
  79. Braindecode-0.5/docs/generated/braindecode.datautil.scale.rst +12 -0
  80. Braindecode-0.5/docs/generated/braindecode.datautil.zscore.rst +12 -0
  81. Braindecode-0.5/docs/generated/braindecode.models.Deep4Net.rst +14 -0
  82. Braindecode-0.5/docs/generated/braindecode.models.EEGNetv1.rst +14 -0
  83. Braindecode-0.5/docs/generated/braindecode.models.EEGNetv4.rst +14 -0
  84. Braindecode-0.5/docs/generated/braindecode.models.EEGResNet.rst +14 -0
  85. Braindecode-0.5/docs/generated/braindecode.models.HybridNet.rst +14 -0
  86. Braindecode-0.5/docs/generated/braindecode.models.ShallowFBCSPNet.rst +14 -0
  87. Braindecode-0.5/docs/generated/braindecode.regressor.EEGRegressor.rst +14 -0
  88. Braindecode-0.5/docs/generated/braindecode.training.CroppedLoss.rst +14 -0
  89. Braindecode-0.5/docs/generated/braindecode.training.CroppedTrialEpochScoring.rst +14 -0
  90. Braindecode-0.5/docs/generated/braindecode.training.PostEpochTrainScoring.rst +14 -0
  91. Braindecode-0.5/docs/generated/braindecode.training.trial_preds_from_window_preds.rst +12 -0
  92. Braindecode-0.5/docs/generated/braindecode.util.set_random_seeds.rst +12 -0
  93. {Braindecode-0.4.85 → Braindecode-0.5}/docs/index.rst +50 -22
  94. Braindecode-0.5/docs/notebooks/Untitled.ipynb +334 -0
  95. Braindecode-0.5/docs/source/braindecode.datasets.rst +51 -0
  96. Braindecode-0.5/docs/source/braindecode.datautil.rst +75 -0
  97. Braindecode-0.5/docs/source/braindecode.experiments.bcic_iv_2a.rst +27 -0
  98. Braindecode-0.5/docs/source/braindecode.experiments.rst +14 -0
  99. Braindecode-0.5/docs/source/braindecode.models.rst +75 -0
  100. Braindecode-0.5/docs/source/braindecode.rst +78 -0
  101. Braindecode-0.5/docs/source/braindecode.visualization.rst +51 -0
  102. Braindecode-0.5/setup.cfg +28 -0
  103. {Braindecode-0.4.85 → Braindecode-0.5}/setup.py +3 -5
  104. Braindecode-0.4.85/Braindecode.egg-info/PKG-INFO +0 -77
  105. Braindecode-0.4.85/Braindecode.egg-info/SOURCES.txt +0 -76
  106. Braindecode-0.4.85/PKG-INFO +0 -77
  107. Braindecode-0.4.85/README.rst +0 -58
  108. Braindecode-0.4.85/braindecode/__init__.py +0 -1
  109. Braindecode-0.4.85/braindecode/datasets/__init__.py +0 -3
  110. Braindecode-0.4.85/braindecode/datasets/bcic_iv_2a.py +0 -89
  111. Braindecode-0.4.85/braindecode/datasets/lazy_dataset.py +0 -48
  112. Braindecode-0.4.85/braindecode/datasets/multiple.py +0 -49
  113. Braindecode-0.4.85/braindecode/datasets/sensor_positions.py +0 -225
  114. Braindecode-0.4.85/braindecode/datautil/__init__.py +0 -3
  115. Braindecode-0.4.85/braindecode/datautil/iterators.py +0 -359
  116. Braindecode-0.4.85/braindecode/datautil/lazy_iterators.py +0 -150
  117. Braindecode-0.4.85/braindecode/datautil/signal_target.py +0 -39
  118. Braindecode-0.4.85/braindecode/datautil/signalproc.py +0 -240
  119. Braindecode-0.4.85/braindecode/datautil/splitters.py +0 -189
  120. Braindecode-0.4.85/braindecode/datautil/trial_segment.py +0 -739
  121. Braindecode-0.4.85/braindecode/experiments/__init__.py +0 -3
  122. Braindecode-0.4.85/braindecode/experiments/experiment.py +0 -552
  123. Braindecode-0.4.85/braindecode/experiments/loggers.py +0 -51
  124. Braindecode-0.4.85/braindecode/experiments/monitors.py +0 -427
  125. Braindecode-0.4.85/braindecode/experiments/stopcriteria.py +0 -144
  126. Braindecode-0.4.85/braindecode/mne_ext/__init__.py +0 -3
  127. Braindecode-0.4.85/braindecode/mne_ext/signalproc.py +0 -110
  128. Braindecode-0.4.85/braindecode/models/__init__.py +0 -3
  129. Braindecode-0.4.85/braindecode/models/base.py +0 -416
  130. Braindecode-0.4.85/braindecode/torch_ext/__init__.py +0 -3
  131. Braindecode-0.4.85/braindecode/torch_ext/constraints.py +0 -31
  132. Braindecode-0.4.85/braindecode/torch_ext/functions.py +0 -14
  133. Braindecode-0.4.85/braindecode/torch_ext/init.py +0 -23
  134. Braindecode-0.4.85/braindecode/torch_ext/losses.py +0 -84
  135. Braindecode-0.4.85/braindecode/torch_ext/optimizers.py +0 -85
  136. Braindecode-0.4.85/braindecode/torch_ext/schedulers.py +0 -71
  137. Braindecode-0.4.85/braindecode/torch_ext/util.py +0 -78
  138. Braindecode-0.4.85/braindecode/util.py +0 -223
  139. Braindecode-0.4.85/braindecode/version.py +0 -1
  140. Braindecode-0.4.85/braindecode/visualization/input_windows.py +0 -220
  141. Braindecode-0.4.85/braindecode/visualization/perturbation.py +0 -334
  142. Braindecode-0.4.85/braindecode/visualization/plot.py +0 -206
  143. Braindecode-0.4.85/braindecode/visualization/sinfit.py +0 -96
  144. Braindecode-0.4.85/docs/notebooks/BBCI_Data.ipynb +0 -841
  145. Braindecode-0.4.85/docs/notebooks/BBCI_Data_Start_Stop.ipynb +0 -899
  146. Braindecode-0.4.85/docs/notebooks/BBCI_Data_Trialwise.ipynb +0 -715
  147. Braindecode-0.4.85/docs/notebooks/Cropped_Decoding.ipynb +0 -1140
  148. Braindecode-0.4.85/docs/notebooks/Cropped_Manual_Training_Loop.ipynb +0 -568
  149. Braindecode-0.4.85/docs/notebooks/Cropped_Trialwise_Explanation_Figures.ipynb +0 -382
  150. Braindecode-0.4.85/docs/notebooks/Trialwise_Decoding.ipynb +0 -1100
  151. Braindecode-0.4.85/docs/notebooks/Trialwise_Manual_Training_Loop.ipynb +0 -651
  152. Braindecode-0.4.85/docs/notebooks/visualization/Perturbation.ipynb +0 -868
  153. Braindecode-0.4.85/docs/source/braindecode.datasets.rst +0 -52
  154. Braindecode-0.4.85/docs/source/braindecode.datautil.rst +0 -68
  155. Braindecode-0.4.85/docs/source/braindecode.experiments.rst +0 -44
  156. Braindecode-0.4.85/docs/source/braindecode.mne_ext.rst +0 -20
  157. Braindecode-0.4.85/docs/source/braindecode.models.rst +0 -60
  158. Braindecode-0.4.85/docs/source/braindecode.rst +0 -41
  159. Braindecode-0.4.85/docs/source/braindecode.torch_ext.rst +0 -76
  160. Braindecode-0.4.85/docs/source/braindecode.visualization.rst +0 -44
  161. Braindecode-0.4.85/setup.cfg +0 -4
  162. {Braindecode-0.4.85 → Braindecode-0.5}/Braindecode.egg-info/dependency_links.txt +0 -0
  163. {Braindecode-0.4.85 → Braindecode-0.5}/Braindecode.egg-info/not-zip-safe +0 -0
  164. {Braindecode-0.4.85 → Braindecode-0.5}/Braindecode.egg-info/top_level.txt +0 -0
  165. {Braindecode-0.4.85 → Braindecode-0.5}/MANIFEST.in +0 -0
  166. {Braindecode-0.4.85 → Braindecode-0.5}/braindecode/datasets/bbci.py +0 -0
  167. {Braindecode-0.4.85 → Braindecode-0.5}/braindecode/datautil/util.py +0 -0
  168. {Braindecode-0.4.85 → Braindecode-0.5}/braindecode/visualization/__init__.py +0 -0
  169. {Braindecode-0.4.85 → Braindecode-0.5}/docs/source/modules.rst +0 -0
@@ -0,0 +1,123 @@
1
+ Metadata-Version: 1.1
2
+ Name: Braindecode
3
+ Version: 0.5
4
+ Summary: A deep learning toolbox to decode raw time-domain EEG.
5
+ Home-page: https://github.com/braindecode/braindecode
6
+ Author: Robin Tibor Schirrmeister
7
+ Author-email: robintibor@gmail.com
8
+ License: BSD 3-Clause
9
+ Description: Braindecode
10
+ ===========
11
+
12
+ .. image:: https://badges.gitter.im/braindecodechat/community.svg
13
+ :alt: Join the chat at https://gitter.im/braindecodechat/community
14
+ :target: https://gitter.im/braindecodechat/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
15
+
16
+ .. image:: https://travis-ci.org/braindecode/braindecode.svg?branch=master
17
+ :target: https://travis-ci.org/braindecode/braindecode
18
+
19
+ .. image:: https://circleci.com/gh/braindecode/braindecode.svg?style=svg
20
+ :target: https://circleci.com/gh/braindecode/braindecode
21
+ :alt: Doc build on CircleCI
22
+
23
+ .. image:: https://codecov.io/gh/braindecode/braindecode/branch/master/graph/badge.svg
24
+ :target: https://codecov.io/gh/braindecode/braindecode
25
+ :alt: Code Coverage
26
+
27
+ A deep learning toolbox to decode raw time-domain EEG.
28
+
29
+ For EEG researchers who want to work with deep learning and
30
+ deep learning researchers who want to work with EEG data.
31
+ For now focused on convolutional networks.
32
+
33
+
34
+ Installation
35
+ ============
36
+
37
+ 1. Install pytorch from http://pytorch.org/ (you don't need to install torchvision).
38
+
39
+ 2. Install latest release of braindecode via pip:
40
+
41
+ .. code-block:: bash
42
+
43
+ pip install braindecode
44
+
45
+ alternatively, if you use conda, you could create a dedicated environment with the following:
46
+
47
+ .. code-block:: bash
48
+
49
+ curl -O https://raw.githubusercontent.com/braindecode/braindecode/master/environment.yml
50
+ conda env create -f environment.yml
51
+ conda activate braindecode
52
+
53
+ .. note::
54
+ The latest development version of mne-python is currently required for
55
+ improvements to lazy loading performance. (commit 3989f998c5f974ed37e97fa3e6c8ead0f5a1cb2a).
56
+
57
+ Install the latest version of braindecode via pip:
58
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
59
+
60
+ .. code-block:: bash
61
+
62
+ pip install -U https://api.github.com/repos/braindecode/braindecode/zipball/master
63
+
64
+
65
+ Documentation
66
+ =============
67
+
68
+ Documentation is online under https://braindecode.org
69
+
70
+
71
+ Dataset
72
+ =======
73
+ The high-gamma dataset used in our publication (see below), including trained models, is available under:
74
+ https://web.gin.g-node.org/robintibor/high-gamma-dataset/
75
+
76
+
77
+ Citing
78
+ ======
79
+
80
+ If you use this code in a scientific publication, please cite us as:
81
+
82
+ .. code-block:: bibtex
83
+
84
+ @article {HBM:HBM23730,
85
+ author = {Schirrmeister, Robin Tibor and Springenberg, Jost Tobias and Fiederer,
86
+ Lukas Dominique Josef and Glasstetter, Martin and Eggensperger, Katharina and Tangermann, Michael and
87
+ Hutter, Frank and Burgard, Wolfram and Ball, Tonio},
88
+ title = {Deep learning with convolutional neural networks for EEG decoding and visualization},
89
+ journal = {Human Brain Mapping},
90
+ issn = {1097-0193},
91
+ url = {http://dx.doi.org/10.1002/hbm.23730},
92
+ doi = {10.1002/hbm.23730},
93
+ month = {aug},
94
+ year = {2017},
95
+ keywords = {electroencephalography, EEG analysis, machine learning, end-to-end learning, brain–machine interface,
96
+ brain–computer interface, model interpretability, brain mapping},
97
+ }
98
+
99
+ as well as the `MNE-Python <https://mne.tools>`_ software that is used by braindecode:
100
+
101
+ .. code-block:: bibtex
102
+
103
+ @article{10.3389/fnins.2013.00267,
104
+ author={Gramfort, Alexandre and Luessi, Martin and Larson, Eric and Engemann, Denis and Strohmeier, Daniel and Brodbeck, Christian and Goj, Roman and Jas, Mainak and Brooks, Teon and Parkkonen, Lauri and Hämäläinen, Matti},
105
+ title={{MEG and EEG data analysis with MNE-Python}},
106
+ journal={Frontiers in Neuroscience},
107
+ volume={7},
108
+ pages={267},
109
+ year={2013},
110
+ url={https://www.frontiersin.org/article/10.3389/fnins.2013.00267},
111
+ doi={10.3389/fnins.2013.00267},
112
+ issn={1662-453X},
113
+ }
114
+
115
+ Keywords: eeg deep-learning brain-state-decoding
116
+ Platform: UNKNOWN
117
+ Classifier: Development Status :: 3 - Alpha
118
+ Classifier: Intended Audience :: Developers
119
+ Classifier: Intended Audience :: Science/Research
120
+ Classifier: Topic :: Software Development :: Build Tools
121
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
122
+ Classifier: License :: OSI Approved :: BSD License
123
+ Classifier: Programming Language :: Python :: 3.7
@@ -0,0 +1,110 @@
1
+ LICENSE.txt
2
+ MANIFEST.in
3
+ README.rst
4
+ setup.cfg
5
+ setup.py
6
+ Braindecode.egg-info/PKG-INFO
7
+ Braindecode.egg-info/SOURCES.txt
8
+ Braindecode.egg-info/dependency_links.txt
9
+ Braindecode.egg-info/not-zip-safe
10
+ Braindecode.egg-info/requires.txt
11
+ Braindecode.egg-info/top_level.txt
12
+ braindecode/__init__.py
13
+ braindecode/classifier.py
14
+ braindecode/regressor.py
15
+ braindecode/util.py
16
+ braindecode/version.py
17
+ braindecode/datasets/__init__.py
18
+ braindecode/datasets/base.py
19
+ braindecode/datasets/bbci.py
20
+ braindecode/datasets/mne.py
21
+ braindecode/datasets/moabb.py
22
+ braindecode/datasets/tuh.py
23
+ braindecode/datasets/xy.py
24
+ braindecode/datautil/__init__.py
25
+ braindecode/datautil/preprocess.py
26
+ braindecode/datautil/util.py
27
+ braindecode/datautil/windowers.py
28
+ braindecode/experiments/__init__.py
29
+ braindecode/experiments/bcic_iv_2a/__init__.py
30
+ braindecode/experiments/bcic_iv_2a/config.py
31
+ braindecode/experiments/bcic_iv_2a/run.py
32
+ braindecode/models/__init__.py
33
+ braindecode/models/deep4.py
34
+ braindecode/models/eegnet.py
35
+ braindecode/models/eegresnet.py
36
+ braindecode/models/functions.py
37
+ braindecode/models/hybrid.py
38
+ braindecode/models/modules.py
39
+ braindecode/models/shallow_fbcsp.py
40
+ braindecode/models/util.py
41
+ braindecode/training/__init__.py
42
+ braindecode/training/callbacks.py
43
+ braindecode/training/losses.py
44
+ braindecode/training/scoring.py
45
+ braindecode/visualization/__init__.py
46
+ braindecode/visualization/gradients.py
47
+ docs/Makefile
48
+ docs/api.rst
49
+ docs/conf.py
50
+ docs/index.rst
51
+ docs/_build/html/_downloads/1224801107d6c3b138edf8ee33de0561/plot_bcic_iv_2a_moabb_cropped.ipynb
52
+ docs/_build/html/_downloads/176a7695926ccfe061692c4af12b673d/plot_dataset_example.ipynb
53
+ docs/_build/html/_downloads/25408d8d92a873e370d4750ba414b84a/benchmark_lazy_eager_loading.ipynb
54
+ docs/_build/html/_downloads/49b1f19a86467aeaf762a1550583a845/plot_custom_dataset_example.ipynb
55
+ docs/_build/html/_downloads/748680401b0360239d00624375dd9587/plot_bcic_iv_2a_moabb_trial.ipynb
56
+ docs/_build/html/_downloads/9c64c2c15907a661b1fe2d7dd209a434/plot_regression.ipynb
57
+ docs/_build/html/_downloads/e42b5bd97033be02521040b0d5ee21c3/plot_mne_dataset_example.ipynb
58
+ docs/_templates/autosummary/class.rst
59
+ docs/_templates/autosummary/function.rst
60
+ docs/auto_examples/benchmark_lazy_eager_loading.ipynb
61
+ docs/auto_examples/benchmark_lazy_eager_loading.rst
62
+ docs/auto_examples/index.rst
63
+ docs/auto_examples/plot_bcic_iv_2a_moabb_cropped.ipynb
64
+ docs/auto_examples/plot_bcic_iv_2a_moabb_cropped.rst
65
+ docs/auto_examples/plot_bcic_iv_2a_moabb_trial.ipynb
66
+ docs/auto_examples/plot_bcic_iv_2a_moabb_trial.rst
67
+ docs/auto_examples/plot_custom_dataset_example.ipynb
68
+ docs/auto_examples/plot_custom_dataset_example.rst
69
+ docs/auto_examples/plot_dataset_example.ipynb
70
+ docs/auto_examples/plot_dataset_example.rst
71
+ docs/auto_examples/plot_mne_dataset_example.ipynb
72
+ docs/auto_examples/plot_mne_dataset_example.rst
73
+ docs/auto_examples/plot_regression.ipynb
74
+ docs/auto_examples/plot_regression.rst
75
+ docs/auto_examples/sg_execution_times.rst
76
+ docs/generated/braindecode.classifier.EEGClassifier.rst
77
+ docs/generated/braindecode.datasets.BaseConcatDataset.rst
78
+ docs/generated/braindecode.datasets.BaseDataset.rst
79
+ docs/generated/braindecode.datasets.MOABBDataset.rst
80
+ docs/generated/braindecode.datasets.WindowsDataset.rst
81
+ docs/generated/braindecode.datasets.create_from_X_y.rst
82
+ docs/generated/braindecode.datasets.create_from_mne_epochs.rst
83
+ docs/generated/braindecode.datasets.create_from_mne_raw.rst
84
+ docs/generated/braindecode.datautil.create_fixed_length_windows.rst
85
+ docs/generated/braindecode.datautil.create_windows_from_events.rst
86
+ docs/generated/braindecode.datautil.exponential_moving_demean.rst
87
+ docs/generated/braindecode.datautil.exponential_moving_standardize.rst
88
+ docs/generated/braindecode.datautil.scale.rst
89
+ docs/generated/braindecode.datautil.zscore.rst
90
+ docs/generated/braindecode.models.Deep4Net.rst
91
+ docs/generated/braindecode.models.EEGNetv1.rst
92
+ docs/generated/braindecode.models.EEGNetv4.rst
93
+ docs/generated/braindecode.models.EEGResNet.rst
94
+ docs/generated/braindecode.models.HybridNet.rst
95
+ docs/generated/braindecode.models.ShallowFBCSPNet.rst
96
+ docs/generated/braindecode.regressor.EEGRegressor.rst
97
+ docs/generated/braindecode.training.CroppedLoss.rst
98
+ docs/generated/braindecode.training.CroppedTrialEpochScoring.rst
99
+ docs/generated/braindecode.training.PostEpochTrainScoring.rst
100
+ docs/generated/braindecode.training.trial_preds_from_window_preds.rst
101
+ docs/generated/braindecode.util.set_random_seeds.rst
102
+ docs/notebooks/Untitled.ipynb
103
+ docs/source/braindecode.datasets.rst
104
+ docs/source/braindecode.datautil.rst
105
+ docs/source/braindecode.experiments.bcic_iv_2a.rst
106
+ docs/source/braindecode.experiments.rst
107
+ docs/source/braindecode.models.rst
108
+ docs/source/braindecode.rst
109
+ docs/source/braindecode.visualization.rst
110
+ docs/source/modules.rst
@@ -1,7 +1,7 @@
1
+ h5py
2
+ matplotlib
1
3
  mne
2
4
  numpy
3
5
  pandas
4
6
  scipy
5
- resampy
6
- matplotlib
7
- h5py
7
+ skorch
@@ -1,6 +1,6 @@
1
1
  BSD 3-Clause License
2
2
 
3
- Copyright (c) 2017 Robin Tibor Schirrmeister
3
+ Copyright (c) 2017-2020 Braindecode Developers
4
4
  All rights reserved.
5
5
 
6
6
  Redistribution and use in source and binary forms, with or without modification,
@@ -0,0 +1,123 @@
1
+ Metadata-Version: 1.1
2
+ Name: Braindecode
3
+ Version: 0.5
4
+ Summary: A deep learning toolbox to decode raw time-domain EEG.
5
+ Home-page: https://github.com/braindecode/braindecode
6
+ Author: Robin Tibor Schirrmeister
7
+ Author-email: robintibor@gmail.com
8
+ License: BSD 3-Clause
9
+ Description: Braindecode
10
+ ===========
11
+
12
+ .. image:: https://badges.gitter.im/braindecodechat/community.svg
13
+ :alt: Join the chat at https://gitter.im/braindecodechat/community
14
+ :target: https://gitter.im/braindecodechat/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
15
+
16
+ .. image:: https://travis-ci.org/braindecode/braindecode.svg?branch=master
17
+ :target: https://travis-ci.org/braindecode/braindecode
18
+
19
+ .. image:: https://circleci.com/gh/braindecode/braindecode.svg?style=svg
20
+ :target: https://circleci.com/gh/braindecode/braindecode
21
+ :alt: Doc build on CircleCI
22
+
23
+ .. image:: https://codecov.io/gh/braindecode/braindecode/branch/master/graph/badge.svg
24
+ :target: https://codecov.io/gh/braindecode/braindecode
25
+ :alt: Code Coverage
26
+
27
+ A deep learning toolbox to decode raw time-domain EEG.
28
+
29
+ For EEG researchers who want to work with deep learning and
30
+ deep learning researchers who want to work with EEG data.
31
+ For now focused on convolutional networks.
32
+
33
+
34
+ Installation
35
+ ============
36
+
37
+ 1. Install pytorch from http://pytorch.org/ (you don't need to install torchvision).
38
+
39
+ 2. Install latest release of braindecode via pip:
40
+
41
+ .. code-block:: bash
42
+
43
+ pip install braindecode
44
+
45
+ alternatively, if you use conda, you could create a dedicated environment with the following:
46
+
47
+ .. code-block:: bash
48
+
49
+ curl -O https://raw.githubusercontent.com/braindecode/braindecode/master/environment.yml
50
+ conda env create -f environment.yml
51
+ conda activate braindecode
52
+
53
+ .. note::
54
+ The latest development version of mne-python is currently required for
55
+ improvements to lazy loading performance. (commit 3989f998c5f974ed37e97fa3e6c8ead0f5a1cb2a).
56
+
57
+ Install the latest version of braindecode via pip:
58
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
59
+
60
+ .. code-block:: bash
61
+
62
+ pip install -U https://api.github.com/repos/braindecode/braindecode/zipball/master
63
+
64
+
65
+ Documentation
66
+ =============
67
+
68
+ Documentation is online under https://braindecode.org
69
+
70
+
71
+ Dataset
72
+ =======
73
+ The high-gamma dataset used in our publication (see below), including trained models, is available under:
74
+ https://web.gin.g-node.org/robintibor/high-gamma-dataset/
75
+
76
+
77
+ Citing
78
+ ======
79
+
80
+ If you use this code in a scientific publication, please cite us as:
81
+
82
+ .. code-block:: bibtex
83
+
84
+ @article {HBM:HBM23730,
85
+ author = {Schirrmeister, Robin Tibor and Springenberg, Jost Tobias and Fiederer,
86
+ Lukas Dominique Josef and Glasstetter, Martin and Eggensperger, Katharina and Tangermann, Michael and
87
+ Hutter, Frank and Burgard, Wolfram and Ball, Tonio},
88
+ title = {Deep learning with convolutional neural networks for EEG decoding and visualization},
89
+ journal = {Human Brain Mapping},
90
+ issn = {1097-0193},
91
+ url = {http://dx.doi.org/10.1002/hbm.23730},
92
+ doi = {10.1002/hbm.23730},
93
+ month = {aug},
94
+ year = {2017},
95
+ keywords = {electroencephalography, EEG analysis, machine learning, end-to-end learning, brain–machine interface,
96
+ brain–computer interface, model interpretability, brain mapping},
97
+ }
98
+
99
+ as well as the `MNE-Python <https://mne.tools>`_ software that is used by braindecode:
100
+
101
+ .. code-block:: bibtex
102
+
103
+ @article{10.3389/fnins.2013.00267,
104
+ author={Gramfort, Alexandre and Luessi, Martin and Larson, Eric and Engemann, Denis and Strohmeier, Daniel and Brodbeck, Christian and Goj, Roman and Jas, Mainak and Brooks, Teon and Parkkonen, Lauri and Hämäläinen, Matti},
105
+ title={{MEG and EEG data analysis with MNE-Python}},
106
+ journal={Frontiers in Neuroscience},
107
+ volume={7},
108
+ pages={267},
109
+ year={2013},
110
+ url={https://www.frontiersin.org/article/10.3389/fnins.2013.00267},
111
+ doi={10.3389/fnins.2013.00267},
112
+ issn={1662-453X},
113
+ }
114
+
115
+ Keywords: eeg deep-learning brain-state-decoding
116
+ Platform: UNKNOWN
117
+ Classifier: Development Status :: 3 - Alpha
118
+ Classifier: Intended Audience :: Developers
119
+ Classifier: Intended Audience :: Science/Research
120
+ Classifier: Topic :: Software Development :: Build Tools
121
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
122
+ Classifier: License :: OSI Approved :: BSD License
123
+ Classifier: Programming Language :: Python :: 3.7
@@ -0,0 +1,105 @@
1
+ Braindecode
2
+ ===========
3
+
4
+ .. image:: https://badges.gitter.im/braindecodechat/community.svg
5
+ :alt: Join the chat at https://gitter.im/braindecodechat/community
6
+ :target: https://gitter.im/braindecodechat/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
7
+
8
+ .. image:: https://travis-ci.org/braindecode/braindecode.svg?branch=master
9
+ :target: https://travis-ci.org/braindecode/braindecode
10
+
11
+ .. image:: https://circleci.com/gh/braindecode/braindecode.svg?style=svg
12
+ :target: https://circleci.com/gh/braindecode/braindecode
13
+ :alt: Doc build on CircleCI
14
+
15
+ .. image:: https://codecov.io/gh/braindecode/braindecode/branch/master/graph/badge.svg
16
+ :target: https://codecov.io/gh/braindecode/braindecode
17
+ :alt: Code Coverage
18
+
19
+ A deep learning toolbox to decode raw time-domain EEG.
20
+
21
+ For EEG researchers who want to work with deep learning and
22
+ deep learning researchers who want to work with EEG data.
23
+ For now focused on convolutional networks.
24
+
25
+
26
+ Installation
27
+ ============
28
+
29
+ 1. Install pytorch from http://pytorch.org/ (you don't need to install torchvision).
30
+
31
+ 2. Install latest release of braindecode via pip:
32
+
33
+ .. code-block:: bash
34
+
35
+ pip install braindecode
36
+
37
+ alternatively, if you use conda, you could create a dedicated environment with the following:
38
+
39
+ .. code-block:: bash
40
+
41
+ curl -O https://raw.githubusercontent.com/braindecode/braindecode/master/environment.yml
42
+ conda env create -f environment.yml
43
+ conda activate braindecode
44
+
45
+ .. note::
46
+ The latest development version of mne-python is currently required for
47
+ improvements to lazy loading performance. (commit 3989f998c5f974ed37e97fa3e6c8ead0f5a1cb2a).
48
+
49
+ Install the latest version of braindecode via pip:
50
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
51
+
52
+ .. code-block:: bash
53
+
54
+ pip install -U https://api.github.com/repos/braindecode/braindecode/zipball/master
55
+
56
+
57
+ Documentation
58
+ =============
59
+
60
+ Documentation is online under https://braindecode.org
61
+
62
+
63
+ Dataset
64
+ =======
65
+ The high-gamma dataset used in our publication (see below), including trained models, is available under:
66
+ https://web.gin.g-node.org/robintibor/high-gamma-dataset/
67
+
68
+
69
+ Citing
70
+ ======
71
+
72
+ If you use this code in a scientific publication, please cite us as:
73
+
74
+ .. code-block:: bibtex
75
+
76
+ @article {HBM:HBM23730,
77
+ author = {Schirrmeister, Robin Tibor and Springenberg, Jost Tobias and Fiederer,
78
+ Lukas Dominique Josef and Glasstetter, Martin and Eggensperger, Katharina and Tangermann, Michael and
79
+ Hutter, Frank and Burgard, Wolfram and Ball, Tonio},
80
+ title = {Deep learning with convolutional neural networks for EEG decoding and visualization},
81
+ journal = {Human Brain Mapping},
82
+ issn = {1097-0193},
83
+ url = {http://dx.doi.org/10.1002/hbm.23730},
84
+ doi = {10.1002/hbm.23730},
85
+ month = {aug},
86
+ year = {2017},
87
+ keywords = {electroencephalography, EEG analysis, machine learning, end-to-end learning, brain–machine interface,
88
+ brain–computer interface, model interpretability, brain mapping},
89
+ }
90
+
91
+ as well as the `MNE-Python <https://mne.tools>`_ software that is used by braindecode:
92
+
93
+ .. code-block:: bibtex
94
+
95
+ @article{10.3389/fnins.2013.00267,
96
+ author={Gramfort, Alexandre and Luessi, Martin and Larson, Eric and Engemann, Denis and Strohmeier, Daniel and Brodbeck, Christian and Goj, Roman and Jas, Mainak and Brooks, Teon and Parkkonen, Lauri and Hämäläinen, Matti},
97
+ title={{MEG and EEG data analysis with MNE-Python}},
98
+ journal={Frontiers in Neuroscience},
99
+ volume={7},
100
+ pages={267},
101
+ year={2013},
102
+ url={https://www.frontiersin.org/article/10.3389/fnins.2013.00267},
103
+ doi={10.3389/fnins.2013.00267},
104
+ issn={1662-453X},
105
+ }
@@ -0,0 +1,4 @@
1
+ from .version import __version__
2
+
3
+ from .classifier import EEGClassifier
4
+ from .regressor import EEGRegressor
@@ -0,0 +1,188 @@
1
+ import numpy as np
2
+ from sklearn.metrics import get_scorer
3
+ from skorch.callbacks import EpochTimer, BatchScoring, PrintLog, EpochScoring
4
+ from skorch.classifier import NeuralNet
5
+ from skorch.classifier import NeuralNetClassifier
6
+ from skorch.utils import train_loss_score, valid_loss_score, noop
7
+
8
+ from .training.scoring import PostEpochTrainScoring, CroppedTrialEpochScoring
9
+ from .util import ThrowAwayIndexLoader, update_estimator_docstring
10
+
11
+
12
+ class EEGClassifier(NeuralNetClassifier):
13
+ doc = """Classifier that does not assume softmax activation.
14
+ Calls loss function directly without applying log or anything.
15
+
16
+ Parameters
17
+ ----------
18
+ cropped: bool (default=False)
19
+ Defines whether torch model passed to this class is cropped or not.
20
+ Currently used for callbacks definition.
21
+
22
+ callbacks: None or list of strings or list of Callback instances (default=None)
23
+ More callbacks, in addition to those returned by
24
+ ``get_default_callbacks``. Each callback should inherit from
25
+ :class:`skorch.callbacks.Callback`. If not ``None``, callbacks can be a
26
+ list of strings specifying `sklearn` scoring functions (for scoring
27
+ functions names see: https://scikit-learn.org/stable/modules/model_evaluation.html#scoring-parameter)
28
+ or a list of callbacks where the callback names are inferred from the
29
+ class name. Name conflicts are resolved by appending a count suffix
30
+ starting with 1, e.g. ``EpochScoring_1``. Alternatively,
31
+ a tuple ``(name, callback)`` can be passed, where ``name``
32
+ should be unique. Callbacks may or may not be instantiated.
33
+ The callback name can be used to set parameters on specific
34
+ callbacks (e.g., for the callback with name ``'print_log'``, use
35
+ ``net.set_params(callbacks__print_log__keys_ignored=['epoch',
36
+ 'train_loss'])``).
37
+
38
+ iterator_train__shuffle: bool (default=True)
39
+ Defines whether train dataset will be shuffled. As skorch does not
40
+ shuffle the train dataset by default this one overwrites this option.
41
+
42
+ """
43
+ __doc__ = update_estimator_docstring(NeuralNetClassifier, doc)
44
+
45
+ def __init__(self, *args, cropped=False, callbacks=None,
46
+ iterator_train__shuffle=True, **kwargs):
47
+ self.cropped = cropped
48
+ callbacks = self._parse_callbacks(callbacks)
49
+
50
+ super().__init__(*args,
51
+ callbacks=callbacks,
52
+ iterator_train__shuffle=iterator_train__shuffle,
53
+ **kwargs)
54
+
55
+ def _parse_callbacks(self, callbacks):
56
+ callbacks_list = []
57
+ if callbacks is not None:
58
+ for callback in callbacks:
59
+ if isinstance(callback, tuple):
60
+ callbacks_list.append(callback)
61
+ else:
62
+ assert isinstance(callback, str)
63
+ scoring = get_scorer(callback)
64
+ scoring_name = scoring._score_func.__name__
65
+ assert scoring_name.endswith(
66
+ ('_score', '_error', '_deviance', '_loss'))
67
+ if (scoring_name.endswith('_score') or
68
+ callback.startswith('neg_')):
69
+ lower_is_better = False
70
+ else:
71
+ lower_is_better = True
72
+ train_name = f'train_{callback}'
73
+ valid_name = f'valid_{callback}'
74
+ if self.cropped:
75
+ # In case of cropped decoding we are using braindecode
76
+ # specific scoring created for cropped decoding
77
+ train_scoring = CroppedTrialEpochScoring(
78
+ callback, lower_is_better, on_train=True, name=train_name
79
+ )
80
+ valid_scoring = CroppedTrialEpochScoring(
81
+ callback, lower_is_better, on_train=False, name=valid_name
82
+ )
83
+ else:
84
+ train_scoring = PostEpochTrainScoring(
85
+ callback, lower_is_better, name=train_name
86
+ )
87
+ valid_scoring = EpochScoring(
88
+ callback, lower_is_better, on_train=False, name=valid_name
89
+ )
90
+ callbacks_list.extend([
91
+ (train_name, train_scoring),
92
+ (valid_name, valid_scoring)
93
+ ])
94
+
95
+ return callbacks_list
96
+
97
+ # pylint: disable=arguments-differ
98
+ def get_loss(self, y_pred, y_true, *args, **kwargs):
99
+ """Return the loss for this batch by calling NeuralNet get_loss.
100
+ Parameters
101
+ ----------
102
+ y_pred : torch tensor
103
+ Predicted target values
104
+ y_true : torch tensor
105
+ True target values.
106
+ X : input data, compatible with skorch.dataset.Dataset
107
+ By default, you should be able to pass:
108
+ * numpy arrays
109
+ * torch tensors
110
+ * pandas DataFrame or Series
111
+ * scipy sparse CSR matrices
112
+ * a dictionary of the former three
113
+ * a list/tuple of the former three
114
+ * a Dataset
115
+ If this doesn't work with your data, you have to pass a
116
+ ``Dataset`` that can deal with the data.
117
+ training : bool (default=False)
118
+ Whether train mode should be used or not.
119
+
120
+ """
121
+ return NeuralNet.get_loss(self, y_pred, y_true, *args, **kwargs)
122
+
123
+ def get_iterator(self, dataset, training=False, drop_index=True):
124
+ iterator = super().get_iterator(dataset, training=training)
125
+ if drop_index:
126
+ return ThrowAwayIndexLoader(self, iterator, is_regression=False)
127
+ else:
128
+ return iterator
129
+
130
+ def on_batch_end(self, net, X, y, training=False, **kwargs):
131
+ # If training is false, assume that our loader has indices for this
132
+ # batch
133
+ if not training:
134
+ cbs = self._default_callbacks + self.callbacks
135
+ epoch_cbs = []
136
+ for name, cb in cbs:
137
+ if (cb.__class__.__name__ == 'CroppedTrialEpochScoring') and (
138
+ hasattr(cb, 'window_inds_')) and (cb.on_train == False):
139
+ epoch_cbs.append(cb)
140
+ # for trialwise decoding stuffs it might also be we don't have
141
+ # cropped loader, so no indices there
142
+ if len(epoch_cbs) > 0:
143
+ assert hasattr(self, '_last_window_inds')
144
+ for cb in epoch_cbs:
145
+ cb.window_inds_.append(self._last_window_inds)
146
+ del self._last_window_inds
147
+
148
+ def predict_with_window_inds_and_ys(self, dataset):
149
+ preds = []
150
+ i_window_in_trials = []
151
+ i_window_stops = []
152
+ window_ys = []
153
+ for X, y, i in self.get_iterator(dataset, drop_index=False):
154
+ i_window_in_trials.append(i[0].cpu().numpy())
155
+ i_window_stops.append(i[2].cpu().numpy())
156
+ preds.append(self.predict_proba(X))
157
+ window_ys.append(y.cpu().numpy())
158
+ preds = np.concatenate(preds)
159
+ i_window_in_trials = np.concatenate(i_window_in_trials)
160
+ i_window_stops = np.concatenate(i_window_stops)
161
+ window_ys = np.concatenate(window_ys)
162
+ return dict(
163
+ preds=preds, i_window_in_trials=i_window_in_trials,
164
+ i_window_stops=i_window_stops, window_ys=window_ys)
165
+
166
+ # Removes default EpochScoring callback computing 'accuracy' to work properly
167
+ # with cropped decoding.
168
+ @property
169
+ def _default_callbacks(self):
170
+ return [
171
+ ("epoch_timer", EpochTimer()),
172
+ (
173
+ "train_loss",
174
+ BatchScoring(
175
+ train_loss_score,
176
+ name="train_loss",
177
+ on_train=True,
178
+ target_extractor=noop,
179
+ ),
180
+ ),
181
+ (
182
+ "valid_loss",
183
+ BatchScoring(
184
+ valid_loss_score, name="valid_loss", target_extractor=noop,
185
+ ),
186
+ ),
187
+ ("print_log", PrintLog()),
188
+ ]