braindecode 0.4.82__tar.gz → 0.4.83__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.82 → Braindecode-0.4.83}/Braindecode.egg-info/PKG-INFO +1 -1
- {Braindecode-0.4.82 → Braindecode-0.4.83}/PKG-INFO +1 -1
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/models/base.py +17 -7
- Braindecode-0.4.83/braindecode/version.py +1 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/docs/notebooks/Cropped_Decoding.ipynb +321 -320
- {Braindecode-0.4.82 → Braindecode-0.4.83}/docs/notebooks/Trialwise_Decoding.ipynb +310 -310
- Braindecode-0.4.82/braindecode/version.py +0 -1
- {Braindecode-0.4.82 → Braindecode-0.4.83}/Braindecode.egg-info/SOURCES.txt +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/Braindecode.egg-info/dependency_links.txt +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/Braindecode.egg-info/not-zip-safe +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/Braindecode.egg-info/requires.txt +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/Braindecode.egg-info/top_level.txt +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/LICENSE.txt +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/MANIFEST.in +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/README.rst +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/__init__.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/datasets/__init__.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/datasets/bbci.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/datasets/bcic_iv_2a.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/datasets/lazy_dataset.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/datasets/multiple.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/datasets/sensor_positions.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/datautil/__init__.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/datautil/iterators.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/datautil/lazy_iterators.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/datautil/signal_target.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/datautil/signalproc.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/datautil/splitters.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/datautil/trial_segment.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/datautil/util.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/experiments/__init__.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/experiments/experiment.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/experiments/loggers.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/experiments/monitors.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/experiments/stopcriteria.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/mne_ext/__init__.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/mne_ext/signalproc.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/models/__init__.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/models/deep4.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/models/eegnet.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/models/hybrid.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/models/shallow_fbcsp.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/models/util.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/torch_ext/__init__.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/torch_ext/constraints.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/torch_ext/functions.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/torch_ext/init.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/torch_ext/losses.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/torch_ext/modules.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/torch_ext/optimizers.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/torch_ext/schedulers.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/torch_ext/util.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/util.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/visualization/__init__.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/visualization/input_windows.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/visualization/perturbation.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/visualization/plot.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/braindecode/visualization/sinfit.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/docs/Makefile +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/docs/conf.py +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/docs/index.rst +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/docs/notebooks/BBCI_Data.ipynb +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/docs/notebooks/BBCI_Data_Start_Stop.ipynb +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/docs/notebooks/BBCI_Data_Trialwise.ipynb +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/docs/notebooks/Cropped_Manual_Training_Loop.ipynb +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/docs/notebooks/Cropped_Trialwise_Explanation_Figures.ipynb +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/docs/notebooks/Trialwise_Manual_Training_Loop.ipynb +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/docs/notebooks/visualization/Perturbation.ipynb +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/docs/source/braindecode.datasets.rst +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/docs/source/braindecode.datautil.rst +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/docs/source/braindecode.experiments.rst +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/docs/source/braindecode.mne_ext.rst +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/docs/source/braindecode.models.rst +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/docs/source/braindecode.rst +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/docs/source/braindecode.torch_ext.rst +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/docs/source/braindecode.visualization.rst +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/docs/source/modules.rst +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/setup.cfg +0 -0
- {Braindecode-0.4.82 → Braindecode-0.4.83}/setup.py +0 -0
|
@@ -180,6 +180,8 @@ class BaseModel(object):
|
|
|
180
180
|
"which is the number of timesteps that will be pushed through"
|
|
181
181
|
"the network in a single pass."
|
|
182
182
|
)
|
|
183
|
+
|
|
184
|
+
train_X = _ensure_float32(train_X)
|
|
183
185
|
if self.cropped:
|
|
184
186
|
self.network.eval()
|
|
185
187
|
test_input = np_to_var(
|
|
@@ -236,7 +238,9 @@ class BaseModel(object):
|
|
|
236
238
|
th.mean(outputs, dim=2), targets
|
|
237
239
|
)
|
|
238
240
|
if validation_data is not None:
|
|
239
|
-
|
|
241
|
+
valid_X = _ensure_float32(validation_data[0])
|
|
242
|
+
valid_y = validation_data[1]
|
|
243
|
+
valid_set = SignalAndTarget(valid_X, valid_y)
|
|
240
244
|
else:
|
|
241
245
|
valid_set = None
|
|
242
246
|
test_set = None
|
|
@@ -286,6 +290,7 @@ class BaseModel(object):
|
|
|
286
290
|
Dictionary with result metrics.
|
|
287
291
|
|
|
288
292
|
"""
|
|
293
|
+
X = _ensure_float32(X)
|
|
289
294
|
stop_criterion = MaxEpochs(0)
|
|
290
295
|
train_set = SignalAndTarget(X, y)
|
|
291
296
|
model_constraint = None
|
|
@@ -351,9 +356,7 @@ class BaseModel(object):
|
|
|
351
356
|
if individual_crops:
|
|
352
357
|
assert self.cropped, "Cropped labels only for cropped decoding"
|
|
353
358
|
outs_per_trial = self.predict_outs(
|
|
354
|
-
X=X,
|
|
355
|
-
threshold_for_binary_case=threshold_for_binary_case,
|
|
356
|
-
individual_crops=individual_crops,
|
|
359
|
+
X=X, individual_crops=individual_crops
|
|
357
360
|
)
|
|
358
361
|
|
|
359
362
|
pred_labels = [np.argmax(o, axis=0) for o in outs_per_trial]
|
|
@@ -361,9 +364,7 @@ class BaseModel(object):
|
|
|
361
364
|
pred_labels = np.array(pred_labels)
|
|
362
365
|
return pred_labels
|
|
363
366
|
|
|
364
|
-
def predict_outs(
|
|
365
|
-
self, X, threshold_for_binary_case=None, individual_crops=False
|
|
366
|
-
):
|
|
367
|
+
def predict_outs(self, X, individual_crops=False):
|
|
367
368
|
"""
|
|
368
369
|
Predict raw outputs of the network for given input.
|
|
369
370
|
|
|
@@ -383,6 +384,7 @@ class BaseModel(object):
|
|
|
383
384
|
"""
|
|
384
385
|
if individual_crops:
|
|
385
386
|
assert self.cropped, "Cropped labels only for cropped decoding"
|
|
387
|
+
X = _ensure_float32(X)
|
|
386
388
|
all_preds = []
|
|
387
389
|
with th.no_grad():
|
|
388
390
|
dummy_y = np.ones(len(X), dtype=np.int64)
|
|
@@ -404,3 +406,11 @@ class BaseModel(object):
|
|
|
404
406
|
else:
|
|
405
407
|
outs_per_trial = np.concatenate(all_preds)
|
|
406
408
|
return outs_per_trial
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
def _ensure_float32(X):
|
|
412
|
+
if hasattr(X, "astype"):
|
|
413
|
+
X = X.astype(np.float32, copy=False)
|
|
414
|
+
else:
|
|
415
|
+
X = [x.astype(np.float32, copy=False) for x in X]
|
|
416
|
+
return X
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.4.83"
|