Braindecode 1.3.0.dev171418921__tar.gz → 1.3.0.dev171478045__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 (188) hide show
  1. braindecode-1.3.0.dev171478045/PKG-INFO +194 -0
  2. braindecode-1.3.0.dev171478045/README.rst +122 -0
  3. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/augmentation/__init__.py +3 -5
  4. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/augmentation/base.py +6 -9
  5. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/augmentation/functional.py +18 -122
  6. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/augmentation/transforms.py +34 -117
  7. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/classifier.py +16 -11
  8. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/datasets/__init__.py +7 -17
  9. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/datasets/base.py +162 -145
  10. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/datasets/bbci.py +14 -13
  11. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/datasets/bcicomp.py +9 -8
  12. braindecode-1.3.0.dev171418921/braindecode/datasets/bids/datasets.py → braindecode-1.3.0.dev171478045/braindecode/datasets/bids.py +20 -14
  13. braindecode-1.3.0.dev171418921/braindecode/datasets/bids/iterable.py → braindecode-1.3.0.dev171478045/braindecode/datasets/experimental.py +6 -8
  14. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/datasets/mne.py +24 -22
  15. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/datasets/moabb.py +17 -27
  16. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/datasets/nmt.py +58 -60
  17. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/datasets/sleep_physio_challe_18.py +7 -5
  18. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/datasets/sleep_physionet.py +7 -7
  19. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/datasets/tuh.py +20 -23
  20. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/datasets/xy.py +11 -12
  21. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/datautil/__init__.py +4 -14
  22. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/datautil/serialization.py +24 -25
  23. braindecode-1.3.0.dev171478045/braindecode/datautil/util.py +41 -0
  24. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/eegneuralnet.py +52 -22
  25. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/functional/functions.py +12 -13
  26. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/functional/initialization.py +5 -5
  27. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/__init__.py +4 -17
  28. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/atcnet.py +64 -67
  29. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/attentionbasenet.py +72 -73
  30. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/attn_sleep.py +23 -27
  31. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/base.py +8 -8
  32. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/bendr.py +26 -50
  33. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/biot.py +30 -61
  34. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/contrawr.py +5 -7
  35. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/ctnet.py +37 -42
  36. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/deep4.py +5 -5
  37. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/deepsleepnet.py +26 -35
  38. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/eegconformer.py +28 -33
  39. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/eeginception_erp.py +27 -33
  40. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/eeginception_mi.py +6 -6
  41. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/eegitnet.py +5 -7
  42. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/eegminer.py +1 -3
  43. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/eegnet.py +4 -4
  44. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/eegnex.py +2 -2
  45. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/eegsimpleconv.py +2 -2
  46. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/eegtcnet.py +6 -8
  47. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/fbcnet.py +3 -7
  48. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/fblightconvnet.py +3 -5
  49. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/fbmsnet.py +9 -23
  50. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/hybrid.py +2 -2
  51. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/ifnet.py +5 -7
  52. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/labram.py +72 -101
  53. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/msvtnet.py +14 -16
  54. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/patchedtransformer.py +55 -55
  55. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/sccnet.py +2 -2
  56. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/shallow_fbcsp.py +3 -5
  57. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/signal_jepa.py +11 -40
  58. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/sinc_shallow.py +13 -15
  59. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/sleep_stager_blanco_2020.py +2 -2
  60. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/sleep_stager_chambon_2018.py +2 -2
  61. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/sparcnet.py +8 -8
  62. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/sstdpn.py +869 -869
  63. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/summary.csv +15 -20
  64. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/syncnet.py +2 -4
  65. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/tcn.py +5 -7
  66. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/tidnet.py +3 -3
  67. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/tsinception.py +3 -3
  68. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/models/usleep.py +28 -33
  69. braindecode-1.3.0.dev171478045/braindecode/models/util.py +132 -0
  70. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/modules/__init__.py +1 -9
  71. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/modules/activation.py +3 -29
  72. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/modules/attention.py +10 -133
  73. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/modules/blocks.py +4 -56
  74. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/modules/convolution.py +0 -53
  75. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/modules/filter.py +9 -33
  76. braindecode-1.3.0.dev171478045/braindecode/modules/layers.py +131 -0
  77. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/modules/linear.py +1 -22
  78. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/modules/stats.py +0 -10
  79. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/modules/util.py +0 -9
  80. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/modules/wrapper.py +0 -17
  81. braindecode-1.3.0.dev171478045/braindecode/preprocessing/__init__.py +37 -0
  82. braindecode-1.3.0.dev171478045/braindecode/preprocessing/mne_preprocess.py +77 -0
  83. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/preprocessing/preprocess.py +51 -149
  84. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/preprocessing/windowers.py +20 -26
  85. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/regressor.py +18 -15
  86. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/samplers/base.py +8 -8
  87. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/samplers/ssl.py +1 -1
  88. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/util.py +28 -38
  89. braindecode-1.3.0.dev171478045/braindecode/version.py +1 -0
  90. braindecode-1.3.0.dev171478045/braindecode.egg-info/PKG-INFO +194 -0
  91. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode.egg-info/SOURCES.txt +2 -24
  92. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode.egg-info/requires.txt +15 -28
  93. braindecode-1.3.0.dev171478045/docs/api.rst +570 -0
  94. braindecode-1.3.0.dev171478045/docs/cite.rst +65 -0
  95. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/docs/conf.py +15 -73
  96. braindecode-1.3.0.dev171478045/docs/help.rst +62 -0
  97. braindecode-1.3.0.dev171478045/docs/index.rst +50 -0
  98. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/docs/install/install.rst +6 -5
  99. braindecode-1.3.0.dev171478045/docs/install/install_pip.rst +31 -0
  100. braindecode-1.3.0.dev171478045/docs/install/install_source.rst +71 -0
  101. braindecode-1.3.0.dev171478045/docs/models/categorization/attention.rst +31 -0
  102. braindecode-1.3.0.dev171478045/docs/models/categorization/channel.rst +31 -0
  103. braindecode-1.3.0.dev171478045/docs/models/categorization/convolution.rst +33 -0
  104. braindecode-1.3.0.dev171478045/docs/models/categorization/filterbank.rst +31 -0
  105. braindecode-1.3.0.dev171478045/docs/models/categorization/gnn.rst +27 -0
  106. braindecode-1.3.0.dev171478045/docs/models/categorization/interpretable.rst +31 -0
  107. braindecode-1.3.0.dev171478045/docs/models/categorization/lbm.rst +31 -0
  108. braindecode-1.3.0.dev171478045/docs/models/categorization/recurrent.rst +31 -0
  109. braindecode-1.3.0.dev171478045/docs/models/categorization/spd.rst +31 -0
  110. braindecode-1.3.0.dev171478045/docs/models/models.rst +78 -0
  111. braindecode-1.3.0.dev171478045/docs/models/models_categorization.rst +201 -0
  112. braindecode-1.3.0.dev171478045/docs/models/models_table.rst +191 -0
  113. braindecode-1.3.0.dev171478045/docs/models/models_visualization.rst +31 -0
  114. braindecode-1.3.0.dev171478045/docs/sg_execution_times.rst +112 -0
  115. braindecode-1.3.0.dev171478045/docs/whats_new.rst +412 -0
  116. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/pyproject.toml +21 -38
  117. braindecode-1.3.0.dev171418921/PKG-INFO +0 -230
  118. braindecode-1.3.0.dev171418921/README.rst +0 -146
  119. braindecode-1.3.0.dev171418921/braindecode/datasets/bids/__init__.py +0 -54
  120. braindecode-1.3.0.dev171418921/braindecode/datasets/bids/format.py +0 -717
  121. braindecode-1.3.0.dev171418921/braindecode/datasets/bids/hub.py +0 -987
  122. braindecode-1.3.0.dev171418921/braindecode/datasets/bids/hub_format.py +0 -810
  123. braindecode-1.3.0.dev171418921/braindecode/datasets/bids/hub_io.py +0 -197
  124. braindecode-1.3.0.dev171418921/braindecode/datasets/bids/hub_validation.py +0 -114
  125. braindecode-1.3.0.dev171418921/braindecode/datasets/chb_mit.py +0 -163
  126. braindecode-1.3.0.dev171418921/braindecode/datasets/registry.py +0 -120
  127. braindecode-1.3.0.dev171418921/braindecode/datasets/siena.py +0 -162
  128. braindecode-1.3.0.dev171418921/braindecode/datasets/utils.py +0 -67
  129. braindecode-1.3.0.dev171418921/braindecode/datautil/channel_utils.py +0 -114
  130. braindecode-1.3.0.dev171418921/braindecode/datautil/hub_formats.py +0 -180
  131. braindecode-1.3.0.dev171418921/braindecode/datautil/util.py +0 -154
  132. braindecode-1.3.0.dev171418921/braindecode/models/brainmodule.py +0 -845
  133. braindecode-1.3.0.dev171418921/braindecode/models/config.py +0 -233
  134. braindecode-1.3.0.dev171418921/braindecode/models/eegsym.py +0 -917
  135. braindecode-1.3.0.dev171418921/braindecode/models/luna.py +0 -891
  136. braindecode-1.3.0.dev171418921/braindecode/models/medformer.py +0 -760
  137. braindecode-1.3.0.dev171418921/braindecode/models/reve.py +0 -843
  138. braindecode-1.3.0.dev171418921/braindecode/models/util.py +0 -369
  139. braindecode-1.3.0.dev171418921/braindecode/modules/layers.py +0 -216
  140. braindecode-1.3.0.dev171418921/braindecode/preprocessing/__init__.py +0 -271
  141. braindecode-1.3.0.dev171418921/braindecode/preprocessing/eegprep_preprocess.py +0 -1317
  142. braindecode-1.3.0.dev171418921/braindecode/preprocessing/mne_preprocess.py +0 -240
  143. braindecode-1.3.0.dev171418921/braindecode/preprocessing/util.py +0 -177
  144. braindecode-1.3.0.dev171418921/braindecode/version.py +0 -1
  145. braindecode-1.3.0.dev171418921/braindecode.egg-info/PKG-INFO +0 -230
  146. braindecode-1.3.0.dev171418921/docs/_templates/autosummary/class_in_subdir.rst +0 -37
  147. braindecode-1.3.0.dev171418921/docs/_templates/autosummary/function_in_subdir.rst +0 -12
  148. braindecode-1.3.0.dev171418921/docs/api.rst +0 -798
  149. braindecode-1.3.0.dev171418921/docs/cite.rst +0 -72
  150. braindecode-1.3.0.dev171418921/docs/help.rst +0 -62
  151. braindecode-1.3.0.dev171418921/docs/index.rst +0 -48
  152. braindecode-1.3.0.dev171418921/docs/install/install_pip.rst +0 -43
  153. braindecode-1.3.0.dev171418921/docs/install/install_source.rst +0 -78
  154. braindecode-1.3.0.dev171418921/docs/models/categorization/attention.rst +0 -35
  155. braindecode-1.3.0.dev171418921/docs/models/categorization/channel.rst +0 -36
  156. braindecode-1.3.0.dev171418921/docs/models/categorization/convolution.rst +0 -42
  157. braindecode-1.3.0.dev171418921/docs/models/categorization/filterbank.rst +0 -35
  158. braindecode-1.3.0.dev171418921/docs/models/categorization/gnn.rst +0 -27
  159. braindecode-1.3.0.dev171418921/docs/models/categorization/interpretable.rst +0 -35
  160. braindecode-1.3.0.dev171418921/docs/models/categorization/lbm.rst +0 -35
  161. braindecode-1.3.0.dev171418921/docs/models/categorization/recurrent.rst +0 -35
  162. braindecode-1.3.0.dev171418921/docs/models/categorization/spd.rst +0 -35
  163. braindecode-1.3.0.dev171418921/docs/models/models.rst +0 -89
  164. braindecode-1.3.0.dev171418921/docs/models/models_categorization.rst +0 -244
  165. braindecode-1.3.0.dev171418921/docs/models/models_table.rst +0 -209
  166. braindecode-1.3.0.dev171418921/docs/models/models_visualization.rst +0 -33
  167. braindecode-1.3.0.dev171418921/docs/sg_execution_times.rst +0 -110
  168. braindecode-1.3.0.dev171418921/docs/whats_new.rst +0 -788
  169. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/LICENSE.txt +0 -0
  170. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/MANIFEST.in +0 -0
  171. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/NOTICE.txt +0 -0
  172. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/__init__.py +0 -0
  173. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/functional/__init__.py +0 -0
  174. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/modules/parametrization.py +0 -0
  175. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/samplers/__init__.py +0 -0
  176. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/training/__init__.py +0 -0
  177. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/training/callbacks.py +0 -0
  178. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/training/losses.py +0 -0
  179. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/training/scoring.py +0 -0
  180. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/visualization/__init__.py +0 -0
  181. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/visualization/confusion_matrices.py +0 -0
  182. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode/visualization/gradients.py +0 -0
  183. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode.egg-info/dependency_links.txt +0 -0
  184. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/braindecode.egg-info/top_level.txt +0 -0
  185. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/docs/Makefile +0 -0
  186. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/docs/_templates/autosummary/class.rst +0 -0
  187. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/docs/_templates/autosummary/function.rst +0 -0
  188. {braindecode-1.3.0.dev171418921 → braindecode-1.3.0.dev171478045}/setup.cfg +0 -0
@@ -0,0 +1,194 @@
1
+ Metadata-Version: 2.4
2
+ Name: braindecode
3
+ Version: 1.3.0.dev171478045
4
+ Summary: Deep learning software to decode EEG, ECG or MEG signals
5
+ Author-email: Robin Tibor Schirrmeister <robintibor@gmail.com>
6
+ Maintainer-email: Alexandre Gramfort <agramfort@meta.com>, Bruno Aristimunha Pinto <b.aristimunha@gmail.com>, Robin Tibor Schirrmeister <robintibor@gmail.com>
7
+ License: BSD-3-Clause
8
+ Project-URL: homepage, https://braindecode.org
9
+ Project-URL: repository, https://github.com/braindecode/braindecode
10
+ Project-URL: documentation, https://braindecode.org/stable/index.html
11
+ Keywords: python,deep-learning,neuroscience,pytorch,meg,eeg,neuroimaging,electroencephalography,magnetoencephalography,electrocorticography,ecog,electroencephalogram
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Topic :: Software Development :: Build Tools
16
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Requires-Python: >=3.10
21
+ Description-Content-Type: text/x-rst
22
+ License-File: LICENSE.txt
23
+ License-File: NOTICE.txt
24
+ Requires-Dist: mne>=1.10.0
25
+ Requires-Dist: mne_bids>=0.16
26
+ Requires-Dist: numpy
27
+ Requires-Dist: pandas
28
+ Requires-Dist: scipy
29
+ Requires-Dist: matplotlib
30
+ Requires-Dist: h5py
31
+ Requires-Dist: skorch>=1.2.0
32
+ Requires-Dist: torch<3.0,>=2.0
33
+ Requires-Dist: torchaudio<3.0,>=2.0
34
+ Requires-Dist: einops
35
+ Requires-Dist: joblib
36
+ Requires-Dist: torchinfo~=1.8
37
+ Requires-Dist: wfdb
38
+ Requires-Dist: h5py
39
+ Requires-Dist: linear_attention_transformer
40
+ Requires-Dist: docstring_inheritance
41
+ Provides-Extra: moabb
42
+ Requires-Dist: moabb>=1.2.0; extra == "moabb"
43
+ Provides-Extra: hug
44
+ Requires-Dist: huggingface_hub[torch]>=0.20.0; extra == "hug"
45
+ Provides-Extra: tests
46
+ Requires-Dist: pytest; extra == "tests"
47
+ Requires-Dist: pytest-cov; extra == "tests"
48
+ Requires-Dist: codecov; extra == "tests"
49
+ Requires-Dist: pytest_cases; extra == "tests"
50
+ Requires-Dist: mypy; extra == "tests"
51
+ Provides-Extra: docs
52
+ Requires-Dist: sphinx_gallery; extra == "docs"
53
+ Requires-Dist: sphinx_rtd_theme; extra == "docs"
54
+ Requires-Dist: sphinx-autodoc-typehints; extra == "docs"
55
+ Requires-Dist: sphinx-autobuild; extra == "docs"
56
+ Requires-Dist: sphinxcontrib-bibtex; extra == "docs"
57
+ Requires-Dist: sphinx_sitemap; extra == "docs"
58
+ Requires-Dist: pydata_sphinx_theme; extra == "docs"
59
+ Requires-Dist: numpydoc; extra == "docs"
60
+ Requires-Dist: memory_profiler; extra == "docs"
61
+ Requires-Dist: pillow; extra == "docs"
62
+ Requires-Dist: ipython; extra == "docs"
63
+ Requires-Dist: sphinx_design; extra == "docs"
64
+ Requires-Dist: lightning; extra == "docs"
65
+ Requires-Dist: seaborn; extra == "docs"
66
+ Requires-Dist: pre-commit; extra == "docs"
67
+ Requires-Dist: openneuro-py; extra == "docs"
68
+ Requires-Dist: plotly; extra == "docs"
69
+ Provides-Extra: all
70
+ Requires-Dist: braindecode[docs,hug,moabb,tests]; extra == "all"
71
+ Dynamic: license-file
72
+
73
+ .. image:: https://badges.gitter.im/braindecodechat/community.svg
74
+ :alt: Join the chat at https://gitter.im/braindecodechat/community
75
+ :target: https://gitter.im/braindecodechat/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
76
+
77
+ .. image:: https://github.com/braindecode/braindecode/workflows/docs/badge.svg
78
+ :target: https://github.com/braindecode/braindecode/actions
79
+
80
+ .. image:: https://circleci.com/gh/braindecode/braindecode.svg?style=svg
81
+ :target: https://circleci.com/gh/braindecode/braindecode
82
+ :alt: Doc build on CircleCI
83
+
84
+ .. image:: https://codecov.io/gh/braindecode/braindecode/branch/master/graph/badge.svg
85
+ :target: https://codecov.io/gh/braindecode/braindecode
86
+ :alt: Code Coverage
87
+
88
+ .. |Braindecode| image:: https://user-images.githubusercontent.com/42702466/177958779-b00628aa-9155-4c51-96d1-d8c345aff575.svg
89
+ .. _braindecode: braindecode.org/
90
+
91
+ Braindecode
92
+ ===========
93
+
94
+ Braindecode is an open-source Python toolbox for decoding raw electrophysiological brain
95
+ data with deep learning models. It includes dataset fetchers, data preprocessing and
96
+ visualization tools, as well as implementations of several deep learning
97
+ architectures and data augmentations for analysis of EEG, ECoG and MEG.
98
+
99
+ For neuroscientists who want to work with deep learning and
100
+ deep learning researchers who want to work with neurophysiological data.
101
+
102
+
103
+ Installation Braindecode
104
+ ========================
105
+
106
+ 1. Install pytorch from http://pytorch.org/ (you don't need to install torchvision).
107
+
108
+ 2. If you want to download EEG datasets from `MOABB <https://github.com/NeuroTechX/moabb>`_, install it:
109
+
110
+ .. code-block:: bash
111
+
112
+ pip install moabb
113
+
114
+ 3. Install latest release of braindecode via pip:
115
+
116
+ .. code-block:: bash
117
+
118
+ pip install braindecode
119
+
120
+ If you want to install the latest development version of braindecode, please refer to `contributing page <https://github.com/braindecode/braindecode/blob/master/CONTRIBUTING.md>`__
121
+
122
+
123
+ Documentation
124
+ =============
125
+
126
+ Documentation is online under https://braindecode.org, both in the stable and dev versions.
127
+
128
+
129
+ Contributing to Braindecode
130
+ ===========================
131
+
132
+ Guidelines for contributing to the library can be found on the braindecode github:
133
+
134
+ https://github.com/braindecode/braindecode/blob/master/CONTRIBUTING.md
135
+
136
+ Braindecode chat
137
+ ================
138
+
139
+ https://gitter.im/braindecodechat/community
140
+
141
+ Citing
142
+ ======
143
+
144
+ If you use this code in a scientific publication, please cite us as:
145
+
146
+ .. code-block:: bibtex
147
+
148
+ @article {HBM:HBM23730,
149
+ author = {Schirrmeister, Robin Tibor and Springenberg, Jost Tobias and Fiederer,
150
+ Lukas Dominique Josef and Glasstetter, Martin and Eggensperger, Katharina and Tangermann, Michael and
151
+ Hutter, Frank and Burgard, Wolfram and Ball, Tonio},
152
+ title = {Deep learning with convolutional neural networks for EEG decoding and visualization},
153
+ journal = {Human Brain Mapping},
154
+ issn = {1097-0193},
155
+ url = {http://dx.doi.org/10.1002/hbm.23730},
156
+ doi = {10.1002/hbm.23730},
157
+ month = {aug},
158
+ year = {2017},
159
+ keywords = {electroencephalography, EEG analysis, machine learning, end-to-end learning, brain–machine interface,
160
+ brain–computer interface, model interpretability, brain mapping},
161
+ }
162
+
163
+ as well as the `MNE-Python <https://mne.tools>`_ software that is used by braindecode:
164
+
165
+ .. code-block:: bibtex
166
+
167
+ @article{10.3389/fnins.2013.00267,
168
+ 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},
169
+ title={{MEG and EEG data analysis with MNE-Python}},
170
+ journal={Frontiers in Neuroscience},
171
+ volume={7},
172
+ pages={267},
173
+ year={2013},
174
+ url={https://www.frontiersin.org/article/10.3389/fnins.2013.00267},
175
+ doi={10.3389/fnins.2013.00267},
176
+ issn={1662-453X},
177
+ }
178
+
179
+
180
+
181
+
182
+ Licensing
183
+ ^^^^^^^^^
184
+
185
+ This project is primarily licensed under the BSD-3-Clause License.
186
+
187
+ Additional Components
188
+ ~~~~~~~~~~~~~~~~~~~~~
189
+
190
+ Some components within this repository are licensed under the Creative Commons Attribution-NonCommercial 4.0 International
191
+ License.
192
+
193
+ Please refer to the ``LICENSE`` and ``NOTICE`` files for more detailed
194
+ information.
@@ -0,0 +1,122 @@
1
+ .. image:: https://badges.gitter.im/braindecodechat/community.svg
2
+ :alt: Join the chat at https://gitter.im/braindecodechat/community
3
+ :target: https://gitter.im/braindecodechat/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
4
+
5
+ .. image:: https://github.com/braindecode/braindecode/workflows/docs/badge.svg
6
+ :target: https://github.com/braindecode/braindecode/actions
7
+
8
+ .. image:: https://circleci.com/gh/braindecode/braindecode.svg?style=svg
9
+ :target: https://circleci.com/gh/braindecode/braindecode
10
+ :alt: Doc build on CircleCI
11
+
12
+ .. image:: https://codecov.io/gh/braindecode/braindecode/branch/master/graph/badge.svg
13
+ :target: https://codecov.io/gh/braindecode/braindecode
14
+ :alt: Code Coverage
15
+
16
+ .. |Braindecode| image:: https://user-images.githubusercontent.com/42702466/177958779-b00628aa-9155-4c51-96d1-d8c345aff575.svg
17
+ .. _braindecode: braindecode.org/
18
+
19
+ Braindecode
20
+ ===========
21
+
22
+ Braindecode is an open-source Python toolbox for decoding raw electrophysiological brain
23
+ data with deep learning models. It includes dataset fetchers, data preprocessing and
24
+ visualization tools, as well as implementations of several deep learning
25
+ architectures and data augmentations for analysis of EEG, ECoG and MEG.
26
+
27
+ For neuroscientists who want to work with deep learning and
28
+ deep learning researchers who want to work with neurophysiological data.
29
+
30
+
31
+ Installation Braindecode
32
+ ========================
33
+
34
+ 1. Install pytorch from http://pytorch.org/ (you don't need to install torchvision).
35
+
36
+ 2. If you want to download EEG datasets from `MOABB <https://github.com/NeuroTechX/moabb>`_, install it:
37
+
38
+ .. code-block:: bash
39
+
40
+ pip install moabb
41
+
42
+ 3. Install latest release of braindecode via pip:
43
+
44
+ .. code-block:: bash
45
+
46
+ pip install braindecode
47
+
48
+ If you want to install the latest development version of braindecode, please refer to `contributing page <https://github.com/braindecode/braindecode/blob/master/CONTRIBUTING.md>`__
49
+
50
+
51
+ Documentation
52
+ =============
53
+
54
+ Documentation is online under https://braindecode.org, both in the stable and dev versions.
55
+
56
+
57
+ Contributing to Braindecode
58
+ ===========================
59
+
60
+ Guidelines for contributing to the library can be found on the braindecode github:
61
+
62
+ https://github.com/braindecode/braindecode/blob/master/CONTRIBUTING.md
63
+
64
+ Braindecode chat
65
+ ================
66
+
67
+ https://gitter.im/braindecodechat/community
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
+ }
106
+
107
+
108
+
109
+
110
+ Licensing
111
+ ^^^^^^^^^
112
+
113
+ This project is primarily licensed under the BSD-3-Clause License.
114
+
115
+ Additional Components
116
+ ~~~~~~~~~~~~~~~~~~~~~
117
+
118
+ Some components within this repository are licensed under the Creative Commons Attribution-NonCommercial 4.0 International
119
+ License.
120
+
121
+ Please refer to the ``LICENSE`` and ``NOTICE`` files for more detailed
122
+ information.
@@ -1,12 +1,12 @@
1
- """Utilities for data augmentation."""
1
+ """
2
+ Utilities for data augmentation.
3
+ """
2
4
 
3
5
  from . import functional
4
6
  from .base import AugmentedDataLoader, Compose, IdentityTransform, Transform
5
7
  from .transforms import (
6
- AmplitudeScale,
7
8
  BandstopFilter,
8
9
  ChannelsDropout,
9
- ChannelsReref,
10
10
  ChannelsShuffle,
11
11
  ChannelsSymmetry,
12
12
  FrequencyShift,
@@ -46,7 +46,5 @@ __all__ = [
46
46
  "Mixup",
47
47
  "SegmentationReconstruction",
48
48
  "MaskEncoding",
49
- "AmplitudeScale",
50
- "ChannelsReref",
51
49
  "functional",
52
50
  ]
@@ -31,8 +31,7 @@ Operation = Callable[
31
31
 
32
32
 
33
33
  class Transform(torch.nn.Module):
34
- """Basic transform class used for implementing data augmentation.
35
-
34
+ """Basic transform class used for implementing data augmentation
36
35
  operations.
37
36
 
38
37
  Parameters
@@ -43,7 +42,7 @@ class Transform(torch.nn.Module):
43
42
  probability : float, optional
44
43
  Float between 0 and 1 defining the uniform probability of applying the
45
44
  operation. Set to 1.0 by default (e.g always apply the operation).
46
- random_state : int, optional
45
+ random_state: int, optional
47
46
  Seed to be used to instantiate numpy random number generator instance.
48
47
  Used to decide whether or not to transform given the probability
49
48
  argument. Defaults to None.
@@ -126,7 +125,7 @@ class Transform(torch.nn.Module):
126
125
  return out_X
127
126
 
128
127
  def _get_mask(self, batch_size, device) -> torch.Tensor:
129
- """Samples whether to apply operation or not over the whole batch."""
128
+ """Samples whether to apply operation or not over the whole batch"""
130
129
  return torch.as_tensor(self.probability > self.rng.uniform(size=batch_size)).to(
131
130
  device
132
131
  )
@@ -154,7 +153,7 @@ class Compose(Transform):
154
153
 
155
154
  Parameters
156
155
  ----------
157
- transforms : list
156
+ transforms: list
158
157
  Sequence of Transforms to be composed.
159
158
  """
160
159
 
@@ -170,9 +169,7 @@ class Compose(Transform):
170
169
 
171
170
  def _make_collateable(transform, device=None):
172
171
  """Wraps a transform to make it collateable.
173
-
174
- with device control.
175
- """
172
+ with device control."""
176
173
 
177
174
  def _collate_fn(batch):
178
175
  collated_batch = default_collate(batch)
@@ -192,7 +189,7 @@ class AugmentedDataLoader(DataLoader):
192
189
 
193
190
  Parameters
194
191
  ----------
195
- dataset : RecordDataset
192
+ dataset : BaseDataset
196
193
  The dataset containing the signals.
197
194
  transforms : list | Transform, optional
198
195
  Transform or sequence of Transform to be applied to each batch.
@@ -1,7 +1,6 @@
1
1
  # Authors: Cédric Rommel <cedric.rommel@inria.fr>
2
2
  # Alexandre Gramfort <alexandre.gramfort@inria.fr>
3
3
  # Gustavo Rodrigues <gustavenrique01@gmail.com>
4
- # Bruna Lopes <brunajaflopes@gmail.com>
5
4
  #
6
5
  # License: BSD (3-clause)
7
6
 
@@ -144,7 +143,7 @@ def ft_surrogate(
144
143
  EEG input example or batch.
145
144
  y : torch.Tensor
146
145
  EEG labels for the example or batch.
147
- phase_noise_magnitude : float
146
+ phase_noise_magnitude: float
148
147
  Float between 0 and 1 setting the range over which the phase
149
148
  perturbation is uniformly sampled:
150
149
  [0, `phase_noise_magnitude` * 2 * `pi`].
@@ -152,7 +151,7 @@ def ft_surrogate(
152
151
  Whether to sample phase perturbations independently for each channel or
153
152
  not. It is advised to set it to False when spatial information is
154
153
  important for the task, like in BCI.
155
- random_state : int | numpy.random.Generator, optional
154
+ random_state: int | numpy.random.Generator, optional
156
155
  Used to draw the phase perturbation. Defaults to None.
157
156
 
158
157
  Returns
@@ -289,10 +288,10 @@ def channels_shuffle(
289
288
  EEG input example or batch.
290
289
  y : torch.Tensor
291
290
  EEG labels for the example or batch.
292
- p_shuffle : float | None
291
+ p_shuffle: float | None
293
292
  Float between 0 and 1 setting the probability of including the channel
294
293
  in the set of permutted channels.
295
- random_state : int | numpy.random.Generator, optional
294
+ random_state: int | numpy.random.Generator, optional
296
295
  Seed to be used to instantiate numpy random number generator instance.
297
296
  Used to sample which channels to shuffle and to carry the shuffle.
298
297
  Defaults to None.
@@ -335,7 +334,7 @@ def gaussian_noise(
335
334
  EEG labels for the example or batch.
336
335
  std : float
337
336
  Standard deviation to use for the additive noise.
338
- random_state : int | numpy.random.Generator, optional
337
+ random_state: int | numpy.random.Generator, optional
339
338
  Seed to be used to instantiate numpy random number generator instance.
340
339
  Defaults to None.
341
340
 
@@ -468,8 +467,7 @@ def bandstop_filter(
468
467
  bandwidth: float,
469
468
  freqs_to_notch: npt.ArrayLike | None,
470
469
  ) -> tuple[torch.Tensor, torch.Tensor]:
471
- """Apply a band-stop filter with desired bandwidth at the desired frequency.
472
-
470
+ """Apply a band-stop filter with desired bandwidth at the desired frequency
473
471
  position.
474
472
 
475
473
  Suggested e.g. in [1]_ and [2]_
@@ -621,7 +619,6 @@ def _torch_legval(
621
619
  ) -> torch.Tensor:
622
620
  """
623
621
  Evaluate a Legendre series at points x.
624
-
625
622
  If `c` is of length `n + 1`, this function returns the value:
626
623
  .. math:: p(x) = c_0 * L_0(x) + c_1 * L_1(x) + ... + c_n * L_n(x)
627
624
  The parameter `x` is converted to an array only if it is a tuple or a
@@ -807,6 +804,12 @@ def _torch_make_interpolation_matrix(
807
804
  The interpolation matrix that maps good signals to the location
808
805
  of bad signals.
809
806
 
807
+ References
808
+ ----------
809
+ [1] Perrin, F., Pernier, J., Bertrand, O. and Echallier, JF. (1989).
810
+ Spherical splines for scalp potential and current density mapping.
811
+ Electroencephalography Clinical Neurophysiology, Feb; 72(2):184-7.
812
+
810
813
  Notes
811
814
  -----
812
815
  Code copied and modified from MNE-Python:
@@ -837,12 +840,6 @@ def _torch_make_interpolation_matrix(
837
840
  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
838
841
  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
839
842
  DAMAGE.
840
-
841
- References
842
- ----------
843
- [1] Perrin, F., Pernier, J., Bertrand, O. and Echallier, JF. (1989).
844
- Spherical splines for scalp potential and current density mapping.
845
- Electroencephalography Clinical Neurophysiology, Feb; 72(2):184-7.
846
843
  """
847
844
  pos_from = pos_from.clone()
848
845
  pos_to = pos_to.clone()
@@ -970,8 +967,7 @@ def sensors_rotation(
970
967
  angles: npt.ArrayLike,
971
968
  spherical_splines: bool,
972
969
  ) -> tuple[torch.Tensor, torch.Tensor]:
973
- """Interpolates EEG signals over sensors rotated around the desired axis.
974
-
970
+ """Interpolates EEG signals over sensors rotated around the desired axis
975
971
  with the desired angle.
976
972
 
977
973
  Suggested in [1]_
@@ -1030,7 +1026,7 @@ def mixup(
1030
1026
  lam : torch.Tensor
1031
1027
  Values between 0 and 1 setting the linear interpolation between
1032
1028
  examples.
1033
- idx_perm : torch.Tensor
1029
+ idx_perm: torch.Tensor
1034
1030
  Permuted indices of example that are mixed into original examples.
1035
1031
 
1036
1032
  Returns
@@ -1083,20 +1079,18 @@ def segmentation_reconstruction(
1083
1079
  EEG labels for the example or batch.
1084
1080
  n_segments : int
1085
1081
  Number of segments to use in the batch.
1086
- data_classes : list[tuple[int, torch.Tensor]]
1082
+ data_classes: list[tuple[int, torch.Tensor]]
1087
1083
  List of tuples. Each tuple contains the class index and the corresponding EEG data.
1088
- rand_indices : array-like
1084
+ rand_indices: array-like
1089
1085
  Array of indices that indicates which trial to use in each segment.
1090
- idx_shuffle : array-like
1086
+ idx_shuffle: array-like
1091
1087
  Array of indices to shuffle the new generated trials.
1092
-
1093
1088
  Returns
1094
1089
  -------
1095
1090
  torch.Tensor
1096
1091
  Transformed inputs.
1097
1092
  torch.Tensor
1098
1093
  Transformed labels.
1099
-
1100
1094
  References
1101
1095
  ----------
1102
1096
  .. [1] Lotte, F. (2015). Signal processing approaches to minimize or
@@ -1150,7 +1144,7 @@ def mask_encoding(
1150
1144
  segment_length: int,
1151
1145
  n_segments: int,
1152
1146
  ) -> tuple[torch.Tensor, torch.Tensor]:
1153
- """Mark encoding from Ding et al (2024) from [ding2024]_.
1147
+ """Mark encoding from Ding et al. (2024) from [ding2024]_.
1154
1148
 
1155
1149
  Replaces a contiguous part (or parts) of all channels by zeros
1156
1150
  (if more than one segment, it may overlap).
@@ -1200,101 +1194,3 @@ def mask_encoding(
1200
1194
  X[mask] = 0
1201
1195
 
1202
1196
  return X, y # Return the masked tensor and labels
1203
-
1204
-
1205
- def channels_rereference(
1206
- X: torch.Tensor,
1207
- y: torch.Tensor,
1208
- random_state: int | np.random.RandomState | None = None,
1209
- ) -> tuple[torch.Tensor, torch.Tensor]:
1210
- """Randomly re-reference channels in EEG data matrix.
1211
-
1212
- Part of the augmentations proposed in [1]_
1213
-
1214
- Parameters
1215
- ----------
1216
- X : torch.Tensor
1217
- EEG input example or batch.
1218
- y : torch.Tensor
1219
- EEG labels for the example or batch.
1220
- random_state : int | numpy.random.Generator, optional
1221
- Seed to be used to instantiate numpy random number generator instance.
1222
- Defaults to None.
1223
-
1224
- Returns
1225
- -------
1226
- torch.Tensor
1227
- Transformed inputs.
1228
- torch.Tensor
1229
- Transformed labels.
1230
-
1231
- References
1232
- ----------
1233
- .. [1] Mohsenvand, M.N., Izadi, M.R. &amp; Maes, P.. (2020). Contrastive
1234
- Representation Learning for Electroencephalogram Classification. Proceedings
1235
- of the Machine Learning for Health NeurIPS Workshop, in Proceedings of Machine
1236
- Learning Research 136:238-253
1237
- """
1238
-
1239
- rng = check_random_state(random_state)
1240
- batch_size, n_channels, _ = X.shape
1241
-
1242
- ch = rng.randint(0, n_channels, size=batch_size)
1243
-
1244
- X_ch = X[torch.arange(batch_size), ch, :]
1245
- X = X - X_ch.unsqueeze(1)
1246
- X[torch.arange(batch_size), ch, :] = -X_ch
1247
-
1248
- return X, y
1249
-
1250
-
1251
- def amplitude_scale(
1252
- X: torch.Tensor,
1253
- y: torch.Tensor,
1254
- scale: tuple,
1255
- random_state: int | np.random.RandomState | None = None,
1256
- ) -> tuple[torch.Tensor, torch.Tensor]:
1257
- """Rescale amplitude of each channel based on a random sampled scaling value.
1258
-
1259
- Part of the augmentations proposed in [1]_
1260
-
1261
- Parameters
1262
- ----------
1263
- X : torch.Tensor
1264
- EEG input example or batch.
1265
- y : torch.Tensor
1266
- EEG labels for the example or batch.
1267
- scale : tuple of floats
1268
- Interval from which ypu sample the scaling value
1269
- random_state : int | numpy.random.Generator, optional
1270
- Seed to be used to instantiate numpy random number generator instance.
1271
- Defaults to None.
1272
-
1273
- Returns
1274
- -------
1275
- torch.Tensor
1276
- Transformed inputs.
1277
- torch.Tensor
1278
- Transformed labels.
1279
-
1280
- References
1281
- ----------
1282
- .. [1] Mohsenvand, M.N., Izadi, M.R. &amp; Maes, P.. (2020). Contrastive
1283
- Representation Learning for Electroencephalogram Classification. Proceedings
1284
- of the Machine Learning for Health NeurIPS Workshop, in Proceedings of Machine
1285
- Learning Research 136:238-253
1286
- """
1287
-
1288
- rng = torch.Generator()
1289
- rng.manual_seed(random_state)
1290
- batch_size, n_channels, _ = X.shape
1291
-
1292
- # Parameter for scaling amplitude / channel / trial
1293
- l, h = scale
1294
- s = l + (h - l) * torch.rand(
1295
- batch_size, n_channels, 1, generator=rng, device=X.device, dtype=X.dtype
1296
- )
1297
-
1298
- X = s * X
1299
-
1300
- return X, y