braindecode 0.4.8__tar.gz → 0.4.81__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.8 → Braindecode-0.4.81}/Braindecode.egg-info/PKG-INFO +1 -1
- {Braindecode-0.4.8 → Braindecode-0.4.81}/PKG-INFO +1 -1
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/models/base.py +23 -7
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/models/deep4.py +19 -6
- Braindecode-0.4.81/braindecode/version.py +1 -0
- Braindecode-0.4.8/braindecode/version.py +0 -1
- {Braindecode-0.4.8 → Braindecode-0.4.81}/Braindecode.egg-info/SOURCES.txt +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/Braindecode.egg-info/dependency_links.txt +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/Braindecode.egg-info/not-zip-safe +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/Braindecode.egg-info/requires.txt +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/Braindecode.egg-info/top_level.txt +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/LICENSE.txt +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/MANIFEST.in +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/README.rst +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/__init__.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/datasets/__init__.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/datasets/bbci.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/datasets/bcic_iv_2a.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/datasets/lazy_dataset.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/datasets/multiple.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/datasets/sensor_positions.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/datautil/__init__.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/datautil/iterators.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/datautil/lazy_iterators.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/datautil/signal_target.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/datautil/signalproc.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/datautil/splitters.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/datautil/trial_segment.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/datautil/util.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/experiments/__init__.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/experiments/experiment.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/experiments/loggers.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/experiments/monitors.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/experiments/stopcriteria.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/mne_ext/__init__.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/mne_ext/signalproc.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/models/__init__.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/models/eegnet.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/models/hybrid.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/models/shallow_fbcsp.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/models/util.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/torch_ext/__init__.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/torch_ext/constraints.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/torch_ext/functions.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/torch_ext/init.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/torch_ext/losses.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/torch_ext/modules.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/torch_ext/optimizers.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/torch_ext/schedulers.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/torch_ext/util.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/util.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/visualization/__init__.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/visualization/input_windows.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/visualization/perturbation.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/visualization/plot.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/braindecode/visualization/sinfit.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/docs/Makefile +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/docs/conf.py +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/docs/index.rst +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/docs/notebooks/BBCI_Data.ipynb +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/docs/notebooks/BBCI_Data_Start_Stop.ipynb +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/docs/notebooks/BBCI_Data_Trialwise.ipynb +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/docs/notebooks/Cropped_Decoding.ipynb +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/docs/notebooks/Cropped_Manual_Training_Loop.ipynb +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/docs/notebooks/Cropped_Trialwise_Explanation_Figures.ipynb +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/docs/notebooks/Trialwise_Decoding.ipynb +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/docs/notebooks/Trialwise_Manual_Training_Loop.ipynb +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/docs/notebooks/visualization/Perturbation.ipynb +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/docs/source/braindecode.datasets.rst +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/docs/source/braindecode.datautil.rst +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/docs/source/braindecode.experiments.rst +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/docs/source/braindecode.mne_ext.rst +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/docs/source/braindecode.models.rst +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/docs/source/braindecode.rst +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/docs/source/braindecode.torch_ext.rst +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/docs/source/braindecode.visualization.rst +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/docs/source/modules.rst +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/setup.cfg +0 -0
- {Braindecode-0.4.8 → Braindecode-0.4.81}/setup.py +0 -0
|
@@ -69,7 +69,12 @@ class BaseModel(object):
|
|
|
69
69
|
self.compiled = False
|
|
70
70
|
|
|
71
71
|
def compile(
|
|
72
|
-
self,
|
|
72
|
+
self,
|
|
73
|
+
loss,
|
|
74
|
+
optimizer,
|
|
75
|
+
extra_monitors=None,
|
|
76
|
+
cropped=False,
|
|
77
|
+
iterator_seed=0,
|
|
73
78
|
):
|
|
74
79
|
"""
|
|
75
80
|
Setup training for this model.
|
|
@@ -179,7 +184,8 @@ class BaseModel(object):
|
|
|
179
184
|
self.network.eval()
|
|
180
185
|
test_input = np_to_var(
|
|
181
186
|
np.ones(
|
|
182
|
-
(1, train_X.shape[
|
|
187
|
+
(1, train_X[0].shape[0], input_time_length)
|
|
188
|
+
+ train_X[0].shape[2:],
|
|
183
189
|
dtype=np.float32,
|
|
184
190
|
)
|
|
185
191
|
)
|
|
@@ -207,7 +213,9 @@ class BaseModel(object):
|
|
|
207
213
|
train_set = SignalAndTarget(train_X, train_y)
|
|
208
214
|
optimizer = self.optimizer
|
|
209
215
|
if scheduler is not None:
|
|
210
|
-
assert
|
|
216
|
+
assert (
|
|
217
|
+
scheduler == "cosine"
|
|
218
|
+
), "Supply either 'cosine' or None as scheduler."
|
|
211
219
|
n_updates_per_epoch = sum(
|
|
212
220
|
[1 for _ in self.iterator.get_batches(train_set, shuffle=True)]
|
|
213
221
|
)
|
|
@@ -218,7 +226,9 @@ class BaseModel(object):
|
|
|
218
226
|
if optimizer.__class__.__name__ == "AdamW":
|
|
219
227
|
schedule_weight_decay = True
|
|
220
228
|
optimizer = ScheduledOptimizer(
|
|
221
|
-
scheduler,
|
|
229
|
+
scheduler,
|
|
230
|
+
self.optimizer,
|
|
231
|
+
schedule_weight_decay=schedule_weight_decay,
|
|
222
232
|
)
|
|
223
233
|
loss_function = self.loss
|
|
224
234
|
if self.cropped:
|
|
@@ -351,7 +361,9 @@ class BaseModel(object):
|
|
|
351
361
|
pred_labels = np.array(pred_labels)
|
|
352
362
|
return pred_labels
|
|
353
363
|
|
|
354
|
-
def predict_outs(
|
|
364
|
+
def predict_outs(
|
|
365
|
+
self, X, threshold_for_binary_case=None, individual_crops=False
|
|
366
|
+
):
|
|
355
367
|
"""
|
|
356
368
|
Predict raw outputs of the network for given input.
|
|
357
369
|
|
|
@@ -373,7 +385,9 @@ class BaseModel(object):
|
|
|
373
385
|
assert self.cropped, "Cropped labels only for cropped decoding"
|
|
374
386
|
all_preds = []
|
|
375
387
|
with th.no_grad():
|
|
376
|
-
for b_X, _ in self.iterator.get_batches(
|
|
388
|
+
for b_X, _ in self.iterator.get_batches(
|
|
389
|
+
SignalAndTarget(X, X), False
|
|
390
|
+
):
|
|
377
391
|
b_X_var = np_to_var(b_X)
|
|
378
392
|
if self.cuda:
|
|
379
393
|
b_X_var = b_X_var.cuda()
|
|
@@ -383,7 +397,9 @@ class BaseModel(object):
|
|
|
383
397
|
all_preds, self.iterator.input_time_length, X
|
|
384
398
|
)
|
|
385
399
|
if not individual_crops:
|
|
386
|
-
outs_per_trial = np.array(
|
|
400
|
+
outs_per_trial = np.array(
|
|
401
|
+
[np.mean(o, axis=1) for o in outs_per_trial]
|
|
402
|
+
)
|
|
387
403
|
else:
|
|
388
404
|
outs_per_trial = np.concatenate(all_preds)
|
|
389
405
|
return outs_per_trial
|
|
@@ -75,7 +75,10 @@ class Deep4Net(BaseModel):
|
|
|
75
75
|
model.add_module(
|
|
76
76
|
"conv_time",
|
|
77
77
|
nn.Conv2d(
|
|
78
|
-
1,
|
|
78
|
+
1,
|
|
79
|
+
self.n_filters_time,
|
|
80
|
+
(self.filter_time_length, 1),
|
|
81
|
+
stride=1,
|
|
79
82
|
),
|
|
80
83
|
)
|
|
81
84
|
model.add_module(
|
|
@@ -139,7 +142,10 @@ class Deep4Net(BaseModel):
|
|
|
139
142
|
model.add_module(
|
|
140
143
|
"bnorm" + suffix,
|
|
141
144
|
nn.BatchNorm2d(
|
|
142
|
-
n_filters,
|
|
145
|
+
n_filters,
|
|
146
|
+
momentum=self.batch_norm_alpha,
|
|
147
|
+
affine=True,
|
|
148
|
+
eps=1e-5,
|
|
143
149
|
),
|
|
144
150
|
)
|
|
145
151
|
model.add_module("nonlin" + suffix, Expression(self.later_nonlin))
|
|
@@ -147,10 +153,13 @@ class Deep4Net(BaseModel):
|
|
|
147
153
|
model.add_module(
|
|
148
154
|
"pool" + suffix,
|
|
149
155
|
later_pool_class(
|
|
150
|
-
kernel_size=(self.pool_time_length, 1),
|
|
156
|
+
kernel_size=(self.pool_time_length, 1),
|
|
157
|
+
stride=(pool_stride, 1),
|
|
151
158
|
),
|
|
152
159
|
)
|
|
153
|
-
model.add_module(
|
|
160
|
+
model.add_module(
|
|
161
|
+
"pool_nonlin" + suffix, Expression(self.later_pool_nonlin)
|
|
162
|
+
)
|
|
154
163
|
|
|
155
164
|
add_conv_pool_block(
|
|
156
165
|
model, n_filters_conv, self.n_filters_2, self.filter_length_2, 2
|
|
@@ -168,7 +177,8 @@ class Deep4Net(BaseModel):
|
|
|
168
177
|
out = model(
|
|
169
178
|
np_to_var(
|
|
170
179
|
np.ones(
|
|
171
|
-
(1, self.in_chans, self.input_time_length, 1),
|
|
180
|
+
(1, self.in_chans, self.input_time_length, 1),
|
|
181
|
+
dtype=np.float32,
|
|
172
182
|
)
|
|
173
183
|
)
|
|
174
184
|
)
|
|
@@ -177,7 +187,10 @@ class Deep4Net(BaseModel):
|
|
|
177
187
|
model.add_module(
|
|
178
188
|
"conv_classifier",
|
|
179
189
|
nn.Conv2d(
|
|
180
|
-
self.n_filters_4,
|
|
190
|
+
self.n_filters_4,
|
|
191
|
+
self.n_classes,
|
|
192
|
+
(self.final_conv_length, 1),
|
|
193
|
+
bias=True,
|
|
181
194
|
),
|
|
182
195
|
)
|
|
183
196
|
model.add_module("softmax", nn.LogSoftmax(dim=1))
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.4.81"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.4.8"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{Braindecode-0.4.8 → Braindecode-0.4.81}/docs/notebooks/Cropped_Trialwise_Explanation_Figures.ipynb
RENAMED
|
File without changes
|
|
File without changes
|
{Braindecode-0.4.8 → Braindecode-0.4.81}/docs/notebooks/Trialwise_Manual_Training_Loop.ipynb
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|