braindecode 0.4.1__tar.gz → 0.4.4__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 (78) hide show
  1. {Braindecode-0.4.1 → Braindecode-0.4.4}/Braindecode.egg-info/PKG-INFO +1 -1
  2. {Braindecode-0.4.1 → Braindecode-0.4.4}/Braindecode.egg-info/SOURCES.txt +0 -1
  3. {Braindecode-0.4.1 → Braindecode-0.4.4}/PKG-INFO +1 -1
  4. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/experiments/experiment.py +2 -7
  5. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/models/base.py +16 -9
  6. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/models/deep4.py +3 -3
  7. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/models/hybrid.py +9 -9
  8. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/models/shallow_fbcsp.py +3 -3
  9. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/torch_ext/constraints.py +2 -2
  10. Braindecode-0.4.4/braindecode/version.py +1 -0
  11. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/visualization/perturbation.py +2 -2
  12. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/visualization/plot.py +2 -4
  13. {Braindecode-0.4.1 → Braindecode-0.4.4}/docs/notebooks/BBCI_Data.ipynb +1 -1
  14. {Braindecode-0.4.1 → Braindecode-0.4.4}/docs/notebooks/BBCI_Data_Start_Stop.ipynb +1 -1
  15. {Braindecode-0.4.1 → Braindecode-0.4.4}/docs/notebooks/BBCI_Data_Trialwise.ipynb +1 -1
  16. {Braindecode-0.4.1 → Braindecode-0.4.4}/docs/notebooks/Cropped_Manual_Training_Loop.ipynb +81 -73
  17. {Braindecode-0.4.1 → Braindecode-0.4.4}/docs/notebooks/Trialwise_Manual_Training_Loop.ipynb +6 -2
  18. {Braindecode-0.4.1 → Braindecode-0.4.4}/docs/notebooks/visualization/Perturbation.ipynb +260 -247
  19. Braindecode-0.4.1/braindecode/version.py +0 -1
  20. Braindecode-0.4.1/docs/notebooks/visualization/Perturbation_Old.ipynb +0 -780
  21. {Braindecode-0.4.1 → Braindecode-0.4.4}/Braindecode.egg-info/dependency_links.txt +0 -0
  22. {Braindecode-0.4.1 → Braindecode-0.4.4}/Braindecode.egg-info/not-zip-safe +0 -0
  23. {Braindecode-0.4.1 → Braindecode-0.4.4}/Braindecode.egg-info/requires.txt +0 -0
  24. {Braindecode-0.4.1 → Braindecode-0.4.4}/Braindecode.egg-info/top_level.txt +0 -0
  25. {Braindecode-0.4.1 → Braindecode-0.4.4}/LICENSE.txt +0 -0
  26. {Braindecode-0.4.1 → Braindecode-0.4.4}/MANIFEST.in +0 -0
  27. {Braindecode-0.4.1 → Braindecode-0.4.4}/README.rst +0 -0
  28. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/__init__.py +0 -0
  29. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/datasets/__init__.py +0 -0
  30. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/datasets/bbci.py +0 -0
  31. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/datasets/bcic_iv_2a.py +0 -0
  32. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/datasets/multiple.py +0 -0
  33. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/datasets/sensor_positions.py +0 -0
  34. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/datautil/__init__.py +0 -0
  35. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/datautil/iterators.py +0 -0
  36. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/datautil/signal_target.py +0 -0
  37. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/datautil/signalproc.py +0 -0
  38. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/datautil/splitters.py +0 -0
  39. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/datautil/trial_segment.py +0 -0
  40. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/datautil/util.py +0 -0
  41. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/experiments/__init__.py +0 -0
  42. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/experiments/loggers.py +0 -0
  43. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/experiments/monitors.py +0 -0
  44. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/experiments/stopcriteria.py +0 -0
  45. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/mne_ext/__init__.py +0 -0
  46. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/mne_ext/signalproc.py +0 -0
  47. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/models/__init__.py +0 -0
  48. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/models/eegnet.py +0 -0
  49. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/models/util.py +0 -0
  50. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/torch_ext/__init__.py +0 -0
  51. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/torch_ext/functions.py +0 -0
  52. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/torch_ext/init.py +0 -0
  53. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/torch_ext/losses.py +0 -0
  54. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/torch_ext/modules.py +0 -0
  55. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/torch_ext/optimizers.py +0 -0
  56. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/torch_ext/schedulers.py +0 -0
  57. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/torch_ext/util.py +0 -0
  58. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/util.py +0 -0
  59. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/visualization/__init__.py +0 -0
  60. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/visualization/input_windows.py +0 -0
  61. {Braindecode-0.4.1 → Braindecode-0.4.4}/braindecode/visualization/sinfit.py +0 -0
  62. {Braindecode-0.4.1 → Braindecode-0.4.4}/docs/Makefile +0 -0
  63. {Braindecode-0.4.1 → Braindecode-0.4.4}/docs/conf.py +0 -0
  64. {Braindecode-0.4.1 → Braindecode-0.4.4}/docs/index.rst +0 -0
  65. {Braindecode-0.4.1 → Braindecode-0.4.4}/docs/notebooks/Cropped_Decoding.ipynb +0 -0
  66. {Braindecode-0.4.1 → Braindecode-0.4.4}/docs/notebooks/Cropped_Trialwise_Explanation_Figures.ipynb +0 -0
  67. {Braindecode-0.4.1 → Braindecode-0.4.4}/docs/notebooks/Trialwise_Decoding.ipynb +0 -0
  68. {Braindecode-0.4.1 → Braindecode-0.4.4}/docs/source/braindecode.datasets.rst +0 -0
  69. {Braindecode-0.4.1 → Braindecode-0.4.4}/docs/source/braindecode.datautil.rst +0 -0
  70. {Braindecode-0.4.1 → Braindecode-0.4.4}/docs/source/braindecode.experiments.rst +0 -0
  71. {Braindecode-0.4.1 → Braindecode-0.4.4}/docs/source/braindecode.mne_ext.rst +0 -0
  72. {Braindecode-0.4.1 → Braindecode-0.4.4}/docs/source/braindecode.models.rst +0 -0
  73. {Braindecode-0.4.1 → Braindecode-0.4.4}/docs/source/braindecode.rst +0 -0
  74. {Braindecode-0.4.1 → Braindecode-0.4.4}/docs/source/braindecode.torch_ext.rst +0 -0
  75. {Braindecode-0.4.1 → Braindecode-0.4.4}/docs/source/braindecode.visualization.rst +0 -0
  76. {Braindecode-0.4.1 → Braindecode-0.4.4}/docs/source/modules.rst +0 -0
  77. {Braindecode-0.4.1 → Braindecode-0.4.4}/setup.cfg +0 -0
  78. {Braindecode-0.4.1 → Braindecode-0.4.4}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.1
2
2
  Name: Braindecode
3
- Version: 0.4.1
3
+ Version: 0.4.4
4
4
  Summary: A deep learning toolbox to decode raw time-domain EEG.
5
5
  Home-page: https://github.com/robintibor/braindecode
6
6
  Author: Robin Tibor Schirrmeister
@@ -63,7 +63,6 @@ docs/notebooks/Cropped_Trialwise_Explanation_Figures.ipynb
63
63
  docs/notebooks/Trialwise_Decoding.ipynb
64
64
  docs/notebooks/Trialwise_Manual_Training_Loop.ipynb
65
65
  docs/notebooks/visualization/Perturbation.ipynb
66
- docs/notebooks/visualization/Perturbation_Old.ipynb
67
66
  docs/source/braindecode.datasets.rst
68
67
  docs/source/braindecode.datautil.rst
69
68
  docs/source/braindecode.experiments.rst
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.1
2
2
  Name: Braindecode
3
- Version: 0.4.1
3
+ Version: 0.4.4
4
4
  Summary: A deep learning toolbox to decode raw time-domain EEG.
5
5
  Home-page: https://github.com/robintibor/braindecode
6
6
  Author: Robin Tibor Schirrmeister
@@ -146,8 +146,6 @@ class Experiment(object):
146
146
  start of training.
147
147
  loggers: list of :class:`.Logger`
148
148
  How to show computed metrics.
149
- seed: int
150
- Random seed for python random module numpy.random and torch.
151
149
 
152
150
  Attributes
153
151
  ----------
@@ -163,8 +161,7 @@ class Experiment(object):
163
161
  do_early_stop=True,
164
162
  reset_after_second_run=False,
165
163
  log_0_epoch=True,
166
- loggers=('print',),
167
- seed=2382938):
164
+ loggers=('print',)):
168
165
  if run_after_early_stop or reset_after_second_run:
169
166
  assert do_early_stop == True, ("Can only run after early stop or "
170
167
  "reset after second run if doing an early stop")
@@ -199,7 +196,6 @@ class Experiment(object):
199
196
  self.do_early_stop = do_early_stop
200
197
  self.reset_after_second_run = reset_after_second_run
201
198
  self.log_0_epoch = log_0_epoch
202
- self.seed = seed
203
199
  self.loggers = loggers
204
200
 
205
201
  def run(self):
@@ -230,7 +226,7 @@ class Experiment(object):
230
226
 
231
227
  def setup_training(self):
232
228
  """
233
- Setup training, i.e. set random seeds, transform model to cuda,
229
+ Setup training, i.e. transform model to cuda,
234
230
  initialize monitoring.
235
231
  """
236
232
  # reset remember best extension in case you rerun some experiment
@@ -239,7 +235,6 @@ class Experiment(object):
239
235
  if self.loggers == ('print',):
240
236
  self.loggers = [Printer()]
241
237
  self.epochs_df = pd.DataFrame()
242
- set_random_seeds(seed=self.seed, cuda=self.cuda)
243
238
  if self.cuda:
244
239
  assert th.cuda.is_available(), "Cuda not available"
245
240
  self.model.cuda()
@@ -57,7 +57,7 @@ class BaseModel(object):
57
57
  self.cuda = False
58
58
  self.compiled = False
59
59
 
60
- def compile(self, loss, optimizer, monitors=None, cropped=False, iterator_seed=0):
60
+ def compile(self, loss, optimizer, extra_monitors=None, cropped=False, iterator_seed=0):
61
61
  """
62
62
  Setup training for this model.
63
63
 
@@ -66,7 +66,7 @@ class BaseModel(object):
66
66
  loss: function (predictions, targets) -> torch scalar
67
67
  optimizer: `torch.optim.Optimizer` or string
68
68
  Either supply an optimizer or the name of the class (e.g. 'adam')
69
- monitors: List of Braindecode monitors, optional
69
+ extra_monitors: List of Braindecode monitors, optional
70
70
  In case you want to monitor additional values except for loss, misclass and runtime.
71
71
  cropped: bool
72
72
  Whether to perform cropped decoding, see cropped decoding tutorial.
@@ -84,7 +84,7 @@ class BaseModel(object):
84
84
  optimizer_class = find_optimizer(optimizer)
85
85
  optimizer = optimizer_class(self.network.parameters())
86
86
  self.optimizer = optimizer
87
- self.extra_monitors = monitors
87
+ self.extra_monitors = extra_monitors
88
88
  # Already setting it here, so multiple calls to fit
89
89
  # will lead to different batches being drawn
90
90
  self.seed_rng = RandomState(iterator_seed)
@@ -93,7 +93,8 @@ class BaseModel(object):
93
93
 
94
94
  def fit(self, train_X, train_y, epochs, batch_size, input_time_length=None,
95
95
  validation_data=None, model_constraint=None,
96
- remember_best_column=None, scheduler=None):
96
+ remember_best_column=None, scheduler=None,
97
+ log_0_epoch=True):
97
98
  """
98
99
  Fit the model using the given training data.
99
100
 
@@ -122,6 +123,8 @@ class BaseModel(object):
122
123
  determines the best epoch.
123
124
  scheduler: 'cosine' or None, optional
124
125
  Whether to use cosine annealing (:class:`.CosineAnnealing`).
126
+ log_0_epoch: bool
127
+ Whether to compute the metrics once before training as well.
125
128
 
126
129
  Returns
127
130
  -------
@@ -148,12 +151,15 @@ class BaseModel(object):
148
151
  self.iterator = CropsFromTrialsIterator(
149
152
  batch_size=batch_size, input_time_length=input_time_length,
150
153
  n_preds_per_input=n_preds_per_input,
151
- seed=self.seed_rng.randint(0, 4294967295))
154
+ seed=self.seed_rng.randint(0, np.iinfo(np.int32).max-1))
152
155
  else:
153
156
  self.iterator = BalancedBatchSizeIterator(
154
157
  batch_size=batch_size,
155
- seed=self.seed_rng.randint(0, 4294967295))
156
- stop_criterion = MaxEpochs(epochs - 1)# -1 since we dont print 0 epoch, which matters for this stop criterion
158
+ seed=self.seed_rng.randint(0, np.iinfo(np.int32).max-1))
159
+ if log_0_epoch:
160
+ stop_criterion = MaxEpochs(epochs)
161
+ else:
162
+ stop_criterion = MaxEpochs(epochs - 1)
157
163
  train_set = SignalAndTarget(train_X, train_y)
158
164
  optimizer = self.optimizer
159
165
  if scheduler is not None:
@@ -193,7 +199,8 @@ class BaseModel(object):
193
199
  monitors=self.monitors,
194
200
  stop_criterion=stop_criterion,
195
201
  remember_best_column=remember_best_column,
196
- run_after_early_stop=False, cuda=self.cuda, log_0_epoch=False,
202
+ run_after_early_stop=False, cuda=self.cuda,
203
+ log_0_epoch=log_0_epoch,
197
204
  do_early_stop=(remember_best_column is not None))
198
205
  exp.run()
199
206
  self.epochs_df = exp.epochs_df
@@ -238,7 +245,7 @@ class BaseModel(object):
238
245
  stop_criterion=stop_criterion,
239
246
  remember_best_column=None,
240
247
  run_after_early_stop=False, cuda=self.cuda,
241
- log_0_epoch=False,
248
+ log_0_epoch=True,
242
249
  do_early_stop=False)
243
250
 
244
251
  exp.monitor_epoch({'train': train_set})
@@ -17,10 +17,10 @@ class Deep4Net(BaseModel):
17
17
  ----------
18
18
 
19
19
  .. [1] Schirrmeister, R. T., Springenberg, J. T., Fiederer, L. D. J.,
20
- Glasstetter, M., Eggensperger, K., Tangermann, M., ... & Ball, T. (2017).
20
+ Glasstetter, M., Eggensperger, K., Tangermann, M., Hutter, F. & Ball, T. (2017).
21
21
  Deep learning with convolutional neural networks for EEG decoding and
22
22
  visualization.
23
- arXiv preprint arXiv:1703.05051.
23
+ Human Brain Mapping , Aug. 2017. Online: http://dx.doi.org/10.1002/hbm.23730
24
24
  """
25
25
  def __init__(self, in_chans,
26
26
  n_classes,
@@ -103,7 +103,7 @@ class Deep4Net(BaseModel):
103
103
  suffix = '_{:d}'.format(block_nr)
104
104
  model.add_module('drop' + suffix,
105
105
  nn.Dropout(p=self.drop_prob))
106
- model.add_module('conv' + suffix.format(block_nr),
106
+ model.add_module('conv' + suffix,
107
107
  nn.Conv2d(n_filters_before, n_filters,
108
108
  (filter_length, 1),
109
109
  stride=(conv_stride, 1),
@@ -10,18 +10,18 @@ from braindecode.models.util import to_dense_prediction_model
10
10
 
11
11
  class HybridNet(nn.Module, BaseModel):
12
12
  """
13
- Hybrid ConvNet model from [3]_.
13
+ Hybrid ConvNet model from [3]_.
14
14
 
15
- Very hardcoded at the moment.
15
+ Very hardcoded at the moment.
16
16
 
17
- References
18
- ----------
17
+ References
18
+ ----------
19
19
 
20
- .. [3] Schirrmeister, R. T., Springenberg, J. T., Fiederer, L. D. J.,
21
- Glasstetter, M., Eggensperger, K., Tangermann, M., ... & Ball, T. (2017).
22
- Deep learning with convolutional neural networks for EEG decoding and
23
- visualization.
24
- arXiv preprint arXiv:1703.05051.
20
+ .. [3] Schirrmeister, R. T., Springenberg, J. T., Fiederer, L. D. J.,
21
+ Glasstetter, M., Eggensperger, K., Tangermann, M., Hutter, F. & Ball, T. (2017).
22
+ Deep learning with convolutional neural networks for EEG decoding and
23
+ visualization.
24
+ Human Brain Mapping , Aug. 2017. Online: http://dx.doi.org/10.1002/hbm.23730
25
25
  """
26
26
  def __init__(self, n_chans, n_classes, input_time_length):
27
27
  super(HybridNet, self).__init__()
@@ -15,11 +15,11 @@ class ShallowFBCSPNet(BaseModel):
15
15
  References
16
16
  ----------
17
17
 
18
- .. [2] Schirrmeister, R. T., Springenberg, J. T., Fiederer, L. D. J.,
19
- Glasstetter, M., Eggensperger, K., Tangermann, M., ... & Ball, T. (2017).
18
+ .. [2] Schirrmeister, R. T., Springenberg, J. T., Fiederer, L. D. J.,
19
+ Glasstetter, M., Eggensperger, K., Tangermann, M., Hutter, F. & Ball, T. (2017).
20
20
  Deep learning with convolutional neural networks for EEG decoding and
21
21
  visualization.
22
- arXiv preprint arXiv:1703.05051.
22
+ Human Brain Mapping , Aug. 2017. Online: http://dx.doi.org/10.1002/hbm.23730
23
23
  """
24
24
  def __init__(self, in_chans,
25
25
  n_classes,
@@ -10,10 +10,10 @@ class MaxNormDefaultConstraint(object):
10
10
  ----------
11
11
 
12
12
  .. [1] Schirrmeister, R. T., Springenberg, J. T., Fiederer, L. D. J.,
13
- Glasstetter, M., Eggensperger, K., Tangermann, M., ... & Ball, T. (2017).
13
+ Glasstetter, M., Eggensperger, K., Tangermann, M., Hutter, F. & Ball, T. (2017).
14
14
  Deep learning with convolutional neural networks for EEG decoding and
15
15
  visualization.
16
- arXiv preprint arXiv:1703.05051.
16
+ Human Brain Mapping , Aug. 2017. Online: http://dx.doi.org/10.1002/hbm.23730
17
17
 
18
18
  """
19
19
  def apply(self, model):
@@ -0,0 +1 @@
1
+ __version__ = "0.4.4"
@@ -278,10 +278,10 @@ def compute_amplitude_prediction_correlations(pred_fn, examples, n_iterations,
278
278
  ----------
279
279
 
280
280
  .. [EEGDeepLearning] Schirrmeister, R. T., Springenberg, J. T., Fiederer, L. D. J.,
281
- Glasstetter, M., Eggensperger, K., Tangermann, M., ... & Ball, T. (2017).
281
+ Glasstetter, M., Eggensperger, K., Tangermann, M., Hutter, F. & Ball, T. (2017).
282
282
  Deep learning with convolutional neural networks for EEG decoding and
283
283
  visualization.
284
- arXiv preprint arXiv:1703.05051.
284
+ Human Brain Mapping , Aug. 2017. Online: http://dx.doi.org/10.1002/hbm.23730
285
285
  """
286
286
  pred_fn_new = lambda x: [pred_fn(x)]
287
287
  pred_corrs = spectral_perturbation_correlation(perturb_fn, mean_diff_feature_maps,
@@ -67,13 +67,11 @@ def ax_scalp(v, channels,
67
67
  References
68
68
  ----------
69
69
 
70
-
71
70
  .. [1] Schirrmeister, R. T., Springenberg, J. T., Fiederer, L. D. J.,
72
- Glasstetter, M., Eggensperger, K., Tangermann, M., ... & Ball, T. (2017).
71
+ Glasstetter, M., Eggensperger, K., Tangermann, M., Hutter, F. & Ball, T. (2017).
73
72
  Deep learning with convolutional neural networks for EEG decoding and
74
73
  visualization.
75
- arXiv preprint arXiv:1703.05051.
76
-
74
+ Human Brain Mapping , Aug. 2017. Online: http://dx.doi.org/10.1002/hbm.23730
77
75
  """
78
76
  if ax is None:
79
77
  ax = plt.gca()
@@ -833,7 +833,7 @@
833
833
  "name": "python",
834
834
  "nbconvert_exporter": "python",
835
835
  "pygments_lexer": "ipython3",
836
- "version": "3.6.2"
836
+ "version": "3.6.6"
837
837
  }
838
838
  },
839
839
  "nbformat": 4,
@@ -891,7 +891,7 @@
891
891
  "name": "python",
892
892
  "nbconvert_exporter": "python",
893
893
  "pygments_lexer": "ipython3",
894
- "version": "3.6.2"
894
+ "version": "3.6.6"
895
895
  }
896
896
  },
897
897
  "nbformat": 4,
@@ -707,7 +707,7 @@
707
707
  "name": "python",
708
708
  "nbconvert_exporter": "python",
709
709
  "pygments_lexer": "ipython3",
710
- "version": "3.6.2"
710
+ "version": "3.6.6"
711
711
  }
712
712
  },
713
713
  "nbformat": 4,
@@ -50,7 +50,9 @@
50
50
  {
51
51
  "cell_type": "code",
52
52
  "execution_count": 2,
53
- "metadata": {},
53
+ "metadata": {
54
+ "collapsed": true
55
+ },
54
56
  "outputs": [],
55
57
  "source": [
56
58
  "import mne\n",
@@ -93,7 +95,9 @@
93
95
  {
94
96
  "cell_type": "code",
95
97
  "execution_count": 3,
96
- "metadata": {},
98
+ "metadata": {
99
+ "collapsed": true
100
+ },
97
101
  "outputs": [],
98
102
  "source": [
99
103
  "import numpy as np\n",
@@ -195,7 +199,9 @@
195
199
  {
196
200
  "cell_type": "code",
197
201
  "execution_count": 6,
198
- "metadata": {},
202
+ "metadata": {
203
+ "collapsed": true
204
+ },
199
205
  "outputs": [],
200
206
  "source": [
201
207
  "from braindecode.datautil.iterators import CropsFromTrialsIterator\n",
@@ -227,7 +233,9 @@
227
233
  {
228
234
  "cell_type": "code",
229
235
  "execution_count": 7,
230
- "metadata": {},
236
+ "metadata": {
237
+ "collapsed": true
238
+ },
231
239
  "outputs": [],
232
240
  "source": [
233
241
  "from braindecode.torch_ext.optimizers import AdamW\n",
@@ -269,105 +277,105 @@
269
277
  "output_type": "stream",
270
278
  "text": [
271
279
  "Epoch 0\n",
272
- "Train Loss: 3.88829\n",
280
+ "Train Loss: 3.79010\n",
273
281
  "Train Accuracy: 50.0%\n",
274
- "Valid Loss: 3.18595\n",
275
- "Valid Accuracy: 50.0%\n",
282
+ "Valid Loss: 3.12765\n",
283
+ "Valid Accuracy: 46.7%\n",
276
284
  "Epoch 1\n",
277
- "Train Loss: 1.33431\n",
278
- "Train Accuracy: 55.0%\n",
279
- "Valid Loss: 0.96900\n",
280
- "Valid Accuracy: 60.0%\n",
285
+ "Train Loss: 1.91778\n",
286
+ "Train Accuracy: 50.0%\n",
287
+ "Valid Loss: 1.52058\n",
288
+ "Valid Accuracy: 46.7%\n",
281
289
  "Epoch 2\n",
282
- "Train Loss: 0.60838\n",
283
- "Train Accuracy: 77.5%\n",
284
- "Valid Loss: 0.55685\n",
285
- "Valid Accuracy: 76.7%\n",
290
+ "Train Loss: 1.09943\n",
291
+ "Train Accuracy: 60.0%\n",
292
+ "Valid Loss: 0.99602\n",
293
+ "Valid Accuracy: 56.7%\n",
286
294
  "Epoch 3\n",
287
- "Train Loss: 0.49553\n",
288
- "Train Accuracy: 77.5%\n",
289
- "Valid Loss: 0.57463\n",
290
- "Valid Accuracy: 76.7%\n",
295
+ "Train Loss: 0.73015\n",
296
+ "Train Accuracy: 67.5%\n",
297
+ "Valid Loss: 0.82321\n",
298
+ "Valid Accuracy: 56.7%\n",
291
299
  "Epoch 4\n",
292
- "Train Loss: 0.46749\n",
293
- "Train Accuracy: 80.0%\n",
294
- "Valid Loss: 0.62036\n",
295
- "Valid Accuracy: 76.7%\n",
300
+ "Train Loss: 0.55965\n",
301
+ "Train Accuracy: 75.0%\n",
302
+ "Valid Loss: 0.77549\n",
303
+ "Valid Accuracy: 63.3%\n",
296
304
  "Epoch 5\n",
297
- "Train Loss: 0.36088\n",
298
- "Train Accuracy: 85.0%\n",
299
- "Valid Loss: 0.59054\n",
300
- "Valid Accuracy: 76.7%\n",
305
+ "Train Loss: 0.38075\n",
306
+ "Train Accuracy: 82.5%\n",
307
+ "Valid Loss: 0.65490\n",
308
+ "Valid Accuracy: 73.3%\n",
301
309
  "Epoch 6\n",
302
- "Train Loss: 0.26471\n",
310
+ "Train Loss: 0.28886\n",
303
311
  "Train Accuracy: 90.0%\n",
304
- "Valid Loss: 0.55745\n",
305
- "Valid Accuracy: 76.7%\n",
312
+ "Valid Loss: 0.59481\n",
313
+ "Valid Accuracy: 73.3%\n",
306
314
  "Epoch 7\n",
307
- "Train Loss: 0.19023\n",
308
- "Train Accuracy: 95.0%\n",
309
- "Valid Loss: 0.53162\n",
315
+ "Train Loss: 0.21871\n",
316
+ "Train Accuracy: 97.5%\n",
317
+ "Valid Loss: 0.52357\n",
310
318
  "Valid Accuracy: 83.3%\n",
311
319
  "Epoch 8\n",
312
- "Train Loss: 0.13684\n",
320
+ "Train Loss: 0.16713\n",
313
321
  "Train Accuracy: 97.5%\n",
314
- "Valid Loss: 0.50510\n",
315
- "Valid Accuracy: 83.3%\n",
322
+ "Valid Loss: 0.44890\n",
323
+ "Valid Accuracy: 86.7%\n",
316
324
  "Epoch 9\n",
317
- "Train Loss: 0.10682\n",
325
+ "Train Loss: 0.13149\n",
318
326
  "Train Accuracy: 97.5%\n",
319
- "Valid Loss: 0.47980\n",
320
- "Valid Accuracy: 86.7%\n",
327
+ "Valid Loss: 0.40492\n",
328
+ "Valid Accuracy: 83.3%\n",
321
329
  "Epoch 10\n",
322
- "Train Loss: 0.08165\n",
330
+ "Train Loss: 0.09581\n",
323
331
  "Train Accuracy: 100.0%\n",
324
- "Valid Loss: 0.45300\n",
325
- "Valid Accuracy: 86.7%\n",
332
+ "Valid Loss: 0.36021\n",
333
+ "Valid Accuracy: 90.0%\n",
326
334
  "Epoch 11\n",
327
- "Train Loss: 0.05927\n",
335
+ "Train Loss: 0.07818\n",
328
336
  "Train Accuracy: 100.0%\n",
329
- "Valid Loss: 0.43593\n",
330
- "Valid Accuracy: 86.7%\n",
337
+ "Valid Loss: 0.34625\n",
338
+ "Valid Accuracy: 90.0%\n",
331
339
  "Epoch 12\n",
332
- "Train Loss: 0.04447\n",
340
+ "Train Loss: 0.07454\n",
333
341
  "Train Accuracy: 100.0%\n",
334
- "Valid Loss: 0.43543\n",
335
- "Valid Accuracy: 83.3%\n",
342
+ "Valid Loss: 0.34489\n",
343
+ "Valid Accuracy: 90.0%\n",
336
344
  "Epoch 13\n",
337
- "Train Loss: 0.03776\n",
345
+ "Train Loss: 0.06694\n",
338
346
  "Train Accuracy: 100.0%\n",
339
- "Valid Loss: 0.43941\n",
340
- "Valid Accuracy: 83.3%\n",
347
+ "Valid Loss: 0.33878\n",
348
+ "Valid Accuracy: 90.0%\n",
341
349
  "Epoch 14\n",
342
- "Train Loss: 0.03341\n",
350
+ "Train Loss: 0.05971\n",
343
351
  "Train Accuracy: 100.0%\n",
344
- "Valid Loss: 0.43653\n",
345
- "Valid Accuracy: 83.3%\n",
352
+ "Valid Loss: 0.33128\n",
353
+ "Valid Accuracy: 90.0%\n",
346
354
  "Epoch 15\n",
347
- "Train Loss: 0.02990\n",
355
+ "Train Loss: 0.05269\n",
348
356
  "Train Accuracy: 100.0%\n",
349
- "Valid Loss: 0.43027\n",
350
- "Valid Accuracy: 83.3%\n",
357
+ "Valid Loss: 0.32202\n",
358
+ "Valid Accuracy: 90.0%\n",
351
359
  "Epoch 16\n",
352
- "Train Loss: 0.02713\n",
360
+ "Train Loss: 0.04354\n",
353
361
  "Train Accuracy: 100.0%\n",
354
- "Valid Loss: 0.42535\n",
355
- "Valid Accuracy: 83.3%\n",
362
+ "Valid Loss: 0.31063\n",
363
+ "Valid Accuracy: 90.0%\n",
356
364
  "Epoch 17\n",
357
- "Train Loss: 0.02483\n",
365
+ "Train Loss: 0.03759\n",
358
366
  "Train Accuracy: 100.0%\n",
359
- "Valid Loss: 0.42535\n",
360
- "Valid Accuracy: 83.3%\n",
367
+ "Valid Loss: 0.30314\n",
368
+ "Valid Accuracy: 90.0%\n",
361
369
  "Epoch 18\n",
362
- "Train Loss: 0.02301\n",
370
+ "Train Loss: 0.03401\n",
363
371
  "Train Accuracy: 100.0%\n",
364
- "Valid Loss: 0.42749\n",
365
- "Valid Accuracy: 83.3%\n",
372
+ "Valid Loss: 0.29997\n",
373
+ "Valid Accuracy: 90.0%\n",
366
374
  "Epoch 19\n",
367
- "Train Loss: 0.02164\n",
375
+ "Train Loss: 0.03145\n",
368
376
  "Train Accuracy: 100.0%\n",
369
- "Valid Loss: 0.42855\n",
370
- "Valid Accuracy: 86.7%\n"
377
+ "Valid Loss: 0.29764\n",
378
+ "Valid Accuracy: 90.0%\n"
371
379
  ]
372
380
  }
373
381
  ],
@@ -381,7 +389,7 @@
381
389
  "for i_epoch in range(20):\n",
382
390
  " # Set model to training mode\n",
383
391
  " model.train()\n",
384
- " for batch_X, batch_y in iterator.get_batches(train_set, shuffle=False):\n",
392
+ " for batch_X, batch_y in iterator.get_batches(train_set, shuffle=True):\n",
385
393
  " net_in = np_to_var(batch_X)\n",
386
394
  " if cuda:\n",
387
395
  " net_in = net_in.cuda()\n",
@@ -443,7 +451,7 @@
443
451
  "cell_type": "markdown",
444
452
  "metadata": {},
445
453
  "source": [
446
- "Eventually, we arrive at 86.7% accuracy, so 26 from 30 trials are correctly predicted, 4 more than for the trialwise decoding method."
454
+ "Eventually, we arrive at 90.0% accuracy, so 27 from 30 trials are correctly predicted, 5 more than for the trialwise decoding method."
447
455
  ]
448
456
  },
449
457
  {
@@ -462,14 +470,14 @@
462
470
  },
463
471
  {
464
472
  "cell_type": "code",
465
- "execution_count": 10,
473
+ "execution_count": 9,
466
474
  "metadata": {},
467
475
  "outputs": [
468
476
  {
469
477
  "name": "stdout",
470
478
  "output_type": "stream",
471
479
  "text": [
472
- "Test Loss: 0.43439\n",
480
+ "Test Loss: 0.42105\n",
473
481
  "Test Accuracy: 85.0%\n"
474
482
  ]
475
483
  }
@@ -92,7 +92,9 @@
92
92
  {
93
93
  "cell_type": "code",
94
94
  "execution_count": 4,
95
- "metadata": {},
95
+ "metadata": {
96
+ "collapsed": true
97
+ },
96
98
  "outputs": [],
97
99
  "source": [
98
100
  "import mne\n",
@@ -226,7 +228,9 @@
226
228
  {
227
229
  "cell_type": "code",
228
230
  "execution_count": 21,
229
- "metadata": {},
231
+ "metadata": {
232
+ "collapsed": true
233
+ },
230
234
  "outputs": [],
231
235
  "source": [
232
236
  "from braindecode.torch_ext.optimizers import AdamW\n",