braindecode 0.4.3__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.
- {Braindecode-0.4.3 → Braindecode-0.4.4}/Braindecode.egg-info/PKG-INFO +1 -1
- {Braindecode-0.4.3 → Braindecode-0.4.4}/Braindecode.egg-info/SOURCES.txt +0 -1
- {Braindecode-0.4.3 → Braindecode-0.4.4}/PKG-INFO +1 -1
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/experiments/experiment.py +2 -7
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/models/base.py +2 -2
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/models/deep4.py +3 -3
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/models/hybrid.py +9 -9
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/models/shallow_fbcsp.py +3 -3
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/torch_ext/constraints.py +2 -2
- Braindecode-0.4.4/braindecode/version.py +1 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/visualization/perturbation.py +2 -2
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/visualization/plot.py +2 -4
- {Braindecode-0.4.3 → Braindecode-0.4.4}/docs/notebooks/BBCI_Data.ipynb +1 -1
- {Braindecode-0.4.3 → Braindecode-0.4.4}/docs/notebooks/BBCI_Data_Start_Stop.ipynb +1 -1
- {Braindecode-0.4.3 → Braindecode-0.4.4}/docs/notebooks/BBCI_Data_Trialwise.ipynb +1 -1
- {Braindecode-0.4.3 → Braindecode-0.4.4}/docs/notebooks/Cropped_Manual_Training_Loop.ipynb +81 -73
- {Braindecode-0.4.3 → Braindecode-0.4.4}/docs/notebooks/Trialwise_Manual_Training_Loop.ipynb +6 -2
- {Braindecode-0.4.3 → Braindecode-0.4.4}/docs/notebooks/visualization/Perturbation.ipynb +260 -247
- Braindecode-0.4.3/braindecode/models/deep4new.py +0 -228
- Braindecode-0.4.3/braindecode/version.py +0 -1
- {Braindecode-0.4.3 → Braindecode-0.4.4}/Braindecode.egg-info/dependency_links.txt +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/Braindecode.egg-info/not-zip-safe +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/Braindecode.egg-info/requires.txt +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/Braindecode.egg-info/top_level.txt +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/LICENSE.txt +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/MANIFEST.in +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/README.rst +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/__init__.py +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/datasets/__init__.py +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/datasets/bbci.py +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/datasets/bcic_iv_2a.py +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/datasets/multiple.py +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/datasets/sensor_positions.py +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/datautil/__init__.py +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/datautil/iterators.py +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/datautil/signal_target.py +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/datautil/signalproc.py +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/datautil/splitters.py +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/datautil/trial_segment.py +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/datautil/util.py +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/experiments/__init__.py +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/experiments/loggers.py +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/experiments/monitors.py +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/experiments/stopcriteria.py +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/mne_ext/__init__.py +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/mne_ext/signalproc.py +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/models/__init__.py +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/models/eegnet.py +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/models/util.py +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/torch_ext/__init__.py +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/torch_ext/functions.py +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/torch_ext/init.py +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/torch_ext/losses.py +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/torch_ext/modules.py +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/torch_ext/optimizers.py +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/torch_ext/schedulers.py +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/torch_ext/util.py +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/util.py +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/visualization/__init__.py +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/visualization/input_windows.py +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/braindecode/visualization/sinfit.py +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/docs/Makefile +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/docs/conf.py +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/docs/index.rst +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/docs/notebooks/Cropped_Decoding.ipynb +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/docs/notebooks/Cropped_Trialwise_Explanation_Figures.ipynb +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/docs/notebooks/Trialwise_Decoding.ipynb +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/docs/source/braindecode.datasets.rst +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/docs/source/braindecode.datautil.rst +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/docs/source/braindecode.experiments.rst +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/docs/source/braindecode.mne_ext.rst +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/docs/source/braindecode.models.rst +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/docs/source/braindecode.rst +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/docs/source/braindecode.torch_ext.rst +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/docs/source/braindecode.visualization.rst +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/docs/source/modules.rst +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/setup.cfg +0 -0
- {Braindecode-0.4.3 → Braindecode-0.4.4}/setup.py +0 -0
|
@@ -33,7 +33,6 @@ braindecode/mne_ext/signalproc.py
|
|
|
33
33
|
braindecode/models/__init__.py
|
|
34
34
|
braindecode/models/base.py
|
|
35
35
|
braindecode/models/deep4.py
|
|
36
|
-
braindecode/models/deep4new.py
|
|
37
36
|
braindecode/models/eegnet.py
|
|
38
37
|
braindecode/models/hybrid.py
|
|
39
38
|
braindecode/models/shallow_fbcsp.py
|
|
@@ -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.
|
|
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()
|
|
@@ -151,11 +151,11 @@ class BaseModel(object):
|
|
|
151
151
|
self.iterator = CropsFromTrialsIterator(
|
|
152
152
|
batch_size=batch_size, input_time_length=input_time_length,
|
|
153
153
|
n_preds_per_input=n_preds_per_input,
|
|
154
|
-
seed=self.seed_rng.randint(0,
|
|
154
|
+
seed=self.seed_rng.randint(0, np.iinfo(np.int32).max-1))
|
|
155
155
|
else:
|
|
156
156
|
self.iterator = BalancedBatchSizeIterator(
|
|
157
157
|
batch_size=batch_size,
|
|
158
|
-
seed=self.seed_rng.randint(0,
|
|
158
|
+
seed=self.seed_rng.randint(0, np.iinfo(np.int32).max-1))
|
|
159
159
|
if log_0_epoch:
|
|
160
160
|
stop_criterion = MaxEpochs(epochs)
|
|
161
161
|
else:
|
|
@@ -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.,
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
13
|
+
Hybrid ConvNet model from [3]_.
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
Very hardcoded at the moment.
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
References
|
|
18
|
+
----------
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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.,
|
|
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
|
-
|
|
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.,
|
|
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
|
-
|
|
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.,
|
|
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
|
-
|
|
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.,
|
|
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
|
-
|
|
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()
|
|
@@ -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.
|
|
280
|
+
"Train Loss: 3.79010\n",
|
|
273
281
|
"Train Accuracy: 50.0%\n",
|
|
274
|
-
"Valid Loss: 3.
|
|
275
|
-
"Valid Accuracy:
|
|
282
|
+
"Valid Loss: 3.12765\n",
|
|
283
|
+
"Valid Accuracy: 46.7%\n",
|
|
276
284
|
"Epoch 1\n",
|
|
277
|
-
"Train Loss: 1.
|
|
278
|
-
"Train Accuracy:
|
|
279
|
-
"Valid Loss:
|
|
280
|
-
"Valid Accuracy:
|
|
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:
|
|
283
|
-
"Train Accuracy:
|
|
284
|
-
"Valid Loss: 0.
|
|
285
|
-
"Valid Accuracy:
|
|
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.
|
|
288
|
-
"Train Accuracy:
|
|
289
|
-
"Valid Loss: 0.
|
|
290
|
-
"Valid Accuracy:
|
|
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.
|
|
293
|
-
"Train Accuracy:
|
|
294
|
-
"Valid Loss: 0.
|
|
295
|
-
"Valid Accuracy:
|
|
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.
|
|
298
|
-
"Train Accuracy:
|
|
299
|
-
"Valid Loss: 0.
|
|
300
|
-
"Valid Accuracy:
|
|
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.
|
|
310
|
+
"Train Loss: 0.28886\n",
|
|
303
311
|
"Train Accuracy: 90.0%\n",
|
|
304
|
-
"Valid Loss: 0.
|
|
305
|
-
"Valid Accuracy:
|
|
312
|
+
"Valid Loss: 0.59481\n",
|
|
313
|
+
"Valid Accuracy: 73.3%\n",
|
|
306
314
|
"Epoch 7\n",
|
|
307
|
-
"Train Loss: 0.
|
|
308
|
-
"Train Accuracy:
|
|
309
|
-
"Valid Loss: 0.
|
|
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.
|
|
320
|
+
"Train Loss: 0.16713\n",
|
|
313
321
|
"Train Accuracy: 97.5%\n",
|
|
314
|
-
"Valid Loss: 0.
|
|
315
|
-
"Valid Accuracy:
|
|
322
|
+
"Valid Loss: 0.44890\n",
|
|
323
|
+
"Valid Accuracy: 86.7%\n",
|
|
316
324
|
"Epoch 9\n",
|
|
317
|
-
"Train Loss: 0.
|
|
325
|
+
"Train Loss: 0.13149\n",
|
|
318
326
|
"Train Accuracy: 97.5%\n",
|
|
319
|
-
"Valid Loss: 0.
|
|
320
|
-
"Valid Accuracy:
|
|
327
|
+
"Valid Loss: 0.40492\n",
|
|
328
|
+
"Valid Accuracy: 83.3%\n",
|
|
321
329
|
"Epoch 10\n",
|
|
322
|
-
"Train Loss: 0.
|
|
330
|
+
"Train Loss: 0.09581\n",
|
|
323
331
|
"Train Accuracy: 100.0%\n",
|
|
324
|
-
"Valid Loss: 0.
|
|
325
|
-
"Valid Accuracy:
|
|
332
|
+
"Valid Loss: 0.36021\n",
|
|
333
|
+
"Valid Accuracy: 90.0%\n",
|
|
326
334
|
"Epoch 11\n",
|
|
327
|
-
"Train Loss: 0.
|
|
335
|
+
"Train Loss: 0.07818\n",
|
|
328
336
|
"Train Accuracy: 100.0%\n",
|
|
329
|
-
"Valid Loss: 0.
|
|
330
|
-
"Valid Accuracy:
|
|
337
|
+
"Valid Loss: 0.34625\n",
|
|
338
|
+
"Valid Accuracy: 90.0%\n",
|
|
331
339
|
"Epoch 12\n",
|
|
332
|
-
"Train Loss: 0.
|
|
340
|
+
"Train Loss: 0.07454\n",
|
|
333
341
|
"Train Accuracy: 100.0%\n",
|
|
334
|
-
"Valid Loss: 0.
|
|
335
|
-
"Valid Accuracy:
|
|
342
|
+
"Valid Loss: 0.34489\n",
|
|
343
|
+
"Valid Accuracy: 90.0%\n",
|
|
336
344
|
"Epoch 13\n",
|
|
337
|
-
"Train Loss: 0.
|
|
345
|
+
"Train Loss: 0.06694\n",
|
|
338
346
|
"Train Accuracy: 100.0%\n",
|
|
339
|
-
"Valid Loss: 0.
|
|
340
|
-
"Valid Accuracy:
|
|
347
|
+
"Valid Loss: 0.33878\n",
|
|
348
|
+
"Valid Accuracy: 90.0%\n",
|
|
341
349
|
"Epoch 14\n",
|
|
342
|
-
"Train Loss: 0.
|
|
350
|
+
"Train Loss: 0.05971\n",
|
|
343
351
|
"Train Accuracy: 100.0%\n",
|
|
344
|
-
"Valid Loss: 0.
|
|
345
|
-
"Valid Accuracy:
|
|
352
|
+
"Valid Loss: 0.33128\n",
|
|
353
|
+
"Valid Accuracy: 90.0%\n",
|
|
346
354
|
"Epoch 15\n",
|
|
347
|
-
"Train Loss: 0.
|
|
355
|
+
"Train Loss: 0.05269\n",
|
|
348
356
|
"Train Accuracy: 100.0%\n",
|
|
349
|
-
"Valid Loss: 0.
|
|
350
|
-
"Valid Accuracy:
|
|
357
|
+
"Valid Loss: 0.32202\n",
|
|
358
|
+
"Valid Accuracy: 90.0%\n",
|
|
351
359
|
"Epoch 16\n",
|
|
352
|
-
"Train Loss: 0.
|
|
360
|
+
"Train Loss: 0.04354\n",
|
|
353
361
|
"Train Accuracy: 100.0%\n",
|
|
354
|
-
"Valid Loss: 0.
|
|
355
|
-
"Valid Accuracy:
|
|
362
|
+
"Valid Loss: 0.31063\n",
|
|
363
|
+
"Valid Accuracy: 90.0%\n",
|
|
356
364
|
"Epoch 17\n",
|
|
357
|
-
"Train Loss: 0.
|
|
365
|
+
"Train Loss: 0.03759\n",
|
|
358
366
|
"Train Accuracy: 100.0%\n",
|
|
359
|
-
"Valid Loss: 0.
|
|
360
|
-
"Valid Accuracy:
|
|
367
|
+
"Valid Loss: 0.30314\n",
|
|
368
|
+
"Valid Accuracy: 90.0%\n",
|
|
361
369
|
"Epoch 18\n",
|
|
362
|
-
"Train Loss: 0.
|
|
370
|
+
"Train Loss: 0.03401\n",
|
|
363
371
|
"Train Accuracy: 100.0%\n",
|
|
364
|
-
"Valid Loss: 0.
|
|
365
|
-
"Valid Accuracy:
|
|
372
|
+
"Valid Loss: 0.29997\n",
|
|
373
|
+
"Valid Accuracy: 90.0%\n",
|
|
366
374
|
"Epoch 19\n",
|
|
367
|
-
"Train Loss: 0.
|
|
375
|
+
"Train Loss: 0.03145\n",
|
|
368
376
|
"Train Accuracy: 100.0%\n",
|
|
369
|
-
"Valid Loss: 0.
|
|
370
|
-
"Valid Accuracy:
|
|
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=
|
|
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
|
|
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":
|
|
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.
|
|
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",
|