braindecode 0.1.7__tar.gz → 0.1.8__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 (67) hide show
  1. {Braindecode-0.1.7 → Braindecode-0.1.8}/Braindecode.egg-info/PKG-INFO +1 -1
  2. {Braindecode-0.1.7 → Braindecode-0.1.8}/PKG-INFO +1 -1
  3. {Braindecode-0.1.7 → Braindecode-0.1.8}/braindecode/models/deep4.py +2 -2
  4. Braindecode-0.1.8/braindecode/torch_ext/modules.py +80 -0
  5. {Braindecode-0.1.7 → Braindecode-0.1.8}/docs/notebooks/visualization/Perturbation.ipynb +13 -3
  6. {Braindecode-0.1.7 → Braindecode-0.1.8}/setup.py +1 -1
  7. Braindecode-0.1.7/braindecode/torch_ext/modules.py +0 -30
  8. {Braindecode-0.1.7 → Braindecode-0.1.8}/Braindecode.egg-info/SOURCES.txt +0 -0
  9. {Braindecode-0.1.7 → Braindecode-0.1.8}/Braindecode.egg-info/dependency_links.txt +0 -0
  10. {Braindecode-0.1.7 → Braindecode-0.1.8}/Braindecode.egg-info/not-zip-safe +0 -0
  11. {Braindecode-0.1.7 → Braindecode-0.1.8}/Braindecode.egg-info/requires.txt +0 -0
  12. {Braindecode-0.1.7 → Braindecode-0.1.8}/Braindecode.egg-info/top_level.txt +0 -0
  13. {Braindecode-0.1.7 → Braindecode-0.1.8}/LICENSE.txt +0 -0
  14. {Braindecode-0.1.7 → Braindecode-0.1.8}/MANIFEST.in +0 -0
  15. {Braindecode-0.1.7 → Braindecode-0.1.8}/README.rst +0 -0
  16. {Braindecode-0.1.7 → Braindecode-0.1.8}/braindecode/__init__.py +0 -0
  17. {Braindecode-0.1.7 → Braindecode-0.1.8}/braindecode/datasets/__init__.py +0 -0
  18. {Braindecode-0.1.7 → Braindecode-0.1.8}/braindecode/datasets/bbci.py +0 -0
  19. {Braindecode-0.1.7 → Braindecode-0.1.8}/braindecode/datasets/bcic_iv_2a.py +0 -0
  20. {Braindecode-0.1.7 → Braindecode-0.1.8}/braindecode/datasets/multiple.py +0 -0
  21. {Braindecode-0.1.7 → Braindecode-0.1.8}/braindecode/datasets/sensor_positions.py +0 -0
  22. {Braindecode-0.1.7 → Braindecode-0.1.8}/braindecode/datautil/__init__.py +0 -0
  23. {Braindecode-0.1.7 → Braindecode-0.1.8}/braindecode/datautil/iterators.py +0 -0
  24. {Braindecode-0.1.7 → Braindecode-0.1.8}/braindecode/datautil/signal_target.py +0 -0
  25. {Braindecode-0.1.7 → Braindecode-0.1.8}/braindecode/datautil/signalproc.py +0 -0
  26. {Braindecode-0.1.7 → Braindecode-0.1.8}/braindecode/datautil/splitters.py +0 -0
  27. {Braindecode-0.1.7 → Braindecode-0.1.8}/braindecode/datautil/trial_segment.py +0 -0
  28. {Braindecode-0.1.7 → Braindecode-0.1.8}/braindecode/datautil/util.py +0 -0
  29. {Braindecode-0.1.7 → Braindecode-0.1.8}/braindecode/experiments/__init__.py +0 -0
  30. {Braindecode-0.1.7 → Braindecode-0.1.8}/braindecode/experiments/experiment.py +0 -0
  31. {Braindecode-0.1.7 → Braindecode-0.1.8}/braindecode/experiments/monitors.py +0 -0
  32. {Braindecode-0.1.7 → Braindecode-0.1.8}/braindecode/experiments/stopcriteria.py +0 -0
  33. {Braindecode-0.1.7 → Braindecode-0.1.8}/braindecode/mne_ext/__init__.py +0 -0
  34. {Braindecode-0.1.7 → Braindecode-0.1.8}/braindecode/mne_ext/signalproc.py +0 -0
  35. {Braindecode-0.1.7 → Braindecode-0.1.8}/braindecode/models/__init__.py +0 -0
  36. {Braindecode-0.1.7 → Braindecode-0.1.8}/braindecode/models/eegnet.py +0 -0
  37. {Braindecode-0.1.7 → Braindecode-0.1.8}/braindecode/models/shallow_fbcsp.py +0 -0
  38. {Braindecode-0.1.7 → Braindecode-0.1.8}/braindecode/models/util.py +0 -0
  39. {Braindecode-0.1.7 → Braindecode-0.1.8}/braindecode/torch_ext/__init__.py +0 -0
  40. {Braindecode-0.1.7 → Braindecode-0.1.8}/braindecode/torch_ext/constraints.py +0 -0
  41. {Braindecode-0.1.7 → Braindecode-0.1.8}/braindecode/torch_ext/functions.py +0 -0
  42. {Braindecode-0.1.7 → Braindecode-0.1.8}/braindecode/torch_ext/init.py +0 -0
  43. {Braindecode-0.1.7 → Braindecode-0.1.8}/braindecode/torch_ext/losses.py +0 -0
  44. {Braindecode-0.1.7 → Braindecode-0.1.8}/braindecode/torch_ext/util.py +0 -0
  45. {Braindecode-0.1.7 → Braindecode-0.1.8}/braindecode/util.py +0 -0
  46. {Braindecode-0.1.7 → Braindecode-0.1.8}/braindecode/visualization/__init__.py +0 -0
  47. {Braindecode-0.1.7 → Braindecode-0.1.8}/braindecode/visualization/perturbation.py +0 -0
  48. {Braindecode-0.1.7 → Braindecode-0.1.8}/braindecode/visualization/plot.py +0 -0
  49. {Braindecode-0.1.7 → Braindecode-0.1.8}/docs/Makefile +0 -0
  50. {Braindecode-0.1.7 → Braindecode-0.1.8}/docs/conf.py +0 -0
  51. {Braindecode-0.1.7 → Braindecode-0.1.8}/docs/index.rst +0 -0
  52. {Braindecode-0.1.7 → Braindecode-0.1.8}/docs/notebooks/BBCI_Data.ipynb +0 -0
  53. {Braindecode-0.1.7 → Braindecode-0.1.8}/docs/notebooks/BBCI_Data_Start_Stop.ipynb +0 -0
  54. {Braindecode-0.1.7 → Braindecode-0.1.8}/docs/notebooks/BBCI_Data_Trialwise.ipynb +0 -0
  55. {Braindecode-0.1.7 → Braindecode-0.1.8}/docs/notebooks/Cropped_Decoding.ipynb +0 -0
  56. {Braindecode-0.1.7 → Braindecode-0.1.8}/docs/notebooks/Experiment_Class.ipynb +0 -0
  57. {Braindecode-0.1.7 → Braindecode-0.1.8}/docs/notebooks/TrialWise_Decoding.ipynb +0 -0
  58. {Braindecode-0.1.7 → Braindecode-0.1.8}/docs/source/braindecode.datasets.rst +0 -0
  59. {Braindecode-0.1.7 → Braindecode-0.1.8}/docs/source/braindecode.datautil.rst +0 -0
  60. {Braindecode-0.1.7 → Braindecode-0.1.8}/docs/source/braindecode.experiments.rst +0 -0
  61. {Braindecode-0.1.7 → Braindecode-0.1.8}/docs/source/braindecode.mne_ext.rst +0 -0
  62. {Braindecode-0.1.7 → Braindecode-0.1.8}/docs/source/braindecode.models.rst +0 -0
  63. {Braindecode-0.1.7 → Braindecode-0.1.8}/docs/source/braindecode.rst +0 -0
  64. {Braindecode-0.1.7 → Braindecode-0.1.8}/docs/source/braindecode.torch_ext.rst +0 -0
  65. {Braindecode-0.1.7 → Braindecode-0.1.8}/docs/source/braindecode.visualization.rst +0 -0
  66. {Braindecode-0.1.7 → Braindecode-0.1.8}/docs/source/modules.rst +0 -0
  67. {Braindecode-0.1.7 → Braindecode-0.1.8}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.1
2
2
  Name: Braindecode
3
- Version: 0.1.7
3
+ Version: 0.1.8
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.1
2
2
  Name: Braindecode
3
- Version: 0.1.7
3
+ Version: 0.1.8
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
@@ -2,7 +2,7 @@ import numpy as np
2
2
  from torch import nn
3
3
  from torch.nn import init
4
4
  from torch.nn.functional import elu
5
- from braindecode.torch_ext.modules import Expression
5
+ from braindecode.torch_ext.modules import Expression, AvgPool2dWithConv
6
6
  from braindecode.torch_ext.functions import identity
7
7
  from braindecode.torch_ext.util import np_to_var
8
8
 
@@ -53,7 +53,7 @@ class Deep4Net(object):
53
53
  del self.self
54
54
 
55
55
  def create_network(self):
56
- pool_class_dict = dict(max=nn.MaxPool2d, mean=nn.AvgPool2d)
56
+ pool_class_dict = dict(max=nn.MaxPool2d, mean=AvgPool2dWithConv)
57
57
  first_pool_class = pool_class_dict[self.first_pool_mode]
58
58
  later_pool_class = pool_class_dict[self.later_pool_mode]
59
59
  model = nn.Sequential()
@@ -0,0 +1,80 @@
1
+ import numpy as np
2
+ import torch
3
+ import torch.nn.functional as F
4
+
5
+ from braindecode.torch_ext.util import np_to_var
6
+
7
+
8
+ class Expression(torch.nn.Module):
9
+ """
10
+ Compute given expression on forward pass.
11
+
12
+ Parameters
13
+ ----------
14
+ expression_fn: function
15
+ Should accept variable number of objects of type
16
+ `torch.autograd.Variable` to compute its output.
17
+ """
18
+ def __init__(self, expression_fn):
19
+ super(Expression, self).__init__()
20
+ self.expression_fn = expression_fn
21
+
22
+ def forward(self, *x):
23
+ return self.expression_fn(*x)
24
+
25
+ def __repr__(self):
26
+ if (hasattr(self.expression_fn, 'func') and
27
+ hasattr(self.expression_fn, 'kwargs')):
28
+ expression_str = "{:s} {:s}".format(
29
+ self.expression_fn.func.__name__,
30
+ str(self.expression_fn.kwargs))
31
+ else:
32
+ expression_str = self.expression_fn.__name__
33
+ return (self.__class__.__name__ + '(' +
34
+ 'expression=' + str(expression_str) + ')')
35
+
36
+
37
+ class AvgPool2dWithConv(torch.nn.Module):
38
+ """
39
+ Compute average pooling using a convolution, to have the dilation parameter.
40
+
41
+ Parameters
42
+ ----------
43
+ kernel_size: (int,int)
44
+ Size of the pooling region.
45
+ stride: (int,int)
46
+ Stride of the pooling operation.
47
+ dilation: int or (int,int)
48
+ Dilation applied to the pooling filter.
49
+ """
50
+ def __init__(self, kernel_size, stride, dilation=1):
51
+ super(AvgPool2dWithConv, self).__init__()
52
+ self.kernel_size = kernel_size
53
+ self.stride = stride
54
+ self.dilation = dilation
55
+ self.weights = None
56
+
57
+ def forward(self, x):
58
+ # Create weights for the convolution on demand:
59
+ # size or type of x changed...
60
+ in_channels = x.size()[1]
61
+ weight_shape = (in_channels, 1,
62
+ self.kernel_size[0], self.kernel_size[1])
63
+ if self.weights is None or (
64
+ (tuple(self.weights.size()) != tuple(weight_shape)) or (
65
+ self.weights.is_cuda != x.is_cuda
66
+ ) or (
67
+ self.weights.data.type() != x.data.type()
68
+ )):
69
+ n_pool = np.prod(self.kernel_size)
70
+ weights = np_to_var(
71
+ np.ones(weight_shape, dtype=np.float32) / float(n_pool))
72
+ weights = weights.type_as(x)
73
+ if x.is_cuda:
74
+ weights = weights.cuda()
75
+ self.weights = weights
76
+
77
+ pooled = F.conv2d(x, self.weights, bias=None, stride=self.stride,
78
+ dilation=self.dilation,
79
+ groups=in_channels,)
80
+ return pooled
@@ -48,7 +48,9 @@
48
48
  {
49
49
  "cell_type": "code",
50
50
  "execution_count": 2,
51
- "metadata": {},
51
+ "metadata": {
52
+ "collapsed": true
53
+ },
52
54
  "outputs": [],
53
55
  "source": [
54
56
  "%%capture\n",
@@ -554,7 +556,9 @@
554
556
  {
555
557
  "cell_type": "code",
556
558
  "execution_count": 8,
557
- "metadata": {},
559
+ "metadata": {
560
+ "collapsed": true
561
+ },
558
562
  "outputs": [],
559
563
  "source": [
560
564
  "mean_corr = np.mean(amp_pred_corrs, axis=0)"
@@ -571,7 +575,9 @@
571
575
  {
572
576
  "cell_type": "code",
573
577
  "execution_count": 9,
574
- "metadata": {},
578
+ "metadata": {
579
+ "collapsed": true
580
+ },
575
581
  "outputs": [],
576
582
  "source": [
577
583
  "\n",
@@ -720,6 +726,10 @@
720
726
  }
721
727
  ],
722
728
  "metadata": {
729
+ "celltoolbar": "Edit Metadata",
730
+ "git": {
731
+ "keep_outputs": true
732
+ },
723
733
  "kernelspec": {
724
734
  "display_name": "Python 3",
725
735
  "language": "python",
@@ -15,7 +15,7 @@ setup(
15
15
  # Versions should comply with PEP440. For a discussion on single-sourcing
16
16
  # the version across setup.py and the project code, see
17
17
  # http://packaging.python.org/en/latest/tutorial.html#version
18
- version='0.1.7', # TODO: read from __init__.py?
18
+ version='0.1.8', # TODO: read from __init__.py?
19
19
 
20
20
  description='A deep learning toolbox to decode raw time-domain EEG.',
21
21
  long_description=long_description,
@@ -1,30 +0,0 @@
1
- import torch
2
-
3
-
4
- class Expression(torch.nn.Module):
5
- """
6
- Compute given expression on forward pass.
7
-
8
- Parameters
9
- ----------
10
- expression_fn: function
11
- Should accept variable number of objects of type
12
- `torch.autograd.Variable` to compute its output.
13
- """
14
- def __init__(self, expression_fn):
15
- super(Expression, self).__init__()
16
- self.expression_fn = expression_fn
17
-
18
- def forward(self, *x):
19
- return self.expression_fn(*x)
20
-
21
- def __repr__(self):
22
- if (hasattr(self.expression_fn, 'func') and
23
- hasattr(self.expression_fn, 'kwargs')):
24
- expression_str = "{:s} {:s}".format(
25
- self.expression_fn.func.__name__,
26
- str(self.expression_fn.kwargs))
27
- else:
28
- expression_str = self.expression_fn.__name__
29
- return (self.__class__.__name__ + '(' +
30
- 'expression=' + str(expression_str) + ')')
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes