Skip to content

Commit 6427e76

Browse files
committed
1 parent c1b8df8 commit 6427e76

74 files changed

Lines changed: 825 additions & 724 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Binary file not shown.

dev/_downloads/0a8b8bc2f1b933515b7b4101626dd179/plot_bcic_iv_2a_moabb_trial.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,18 @@
148148

149149

150150
######################################################################
151-
# Now we create the deep learning model! Braindecode comes with some
151+
# Now we create the deep learning model!
152+
# First thing we need to do is know the properties of our signals.
153+
# For this, we use the :func:`braindecode.datautil.infer_signal_properties` function:
154+
#
155+
from braindecode.datautil import infer_signal_properties
156+
157+
sig_props = infer_signal_properties(train_set, mode="classification")
158+
print(sig_props)
159+
160+
161+
######################################################################
162+
# Braindecode comes with some
152163
# predefined convolutional neural network architectures for raw
153164
# time-domain EEG. Here, we use the :class:`ShallowFBCSPNet
154165
# <braindecode.models.ShallowFBCSPNet>` model from [3]_. These models are
@@ -175,16 +186,10 @@
175186
seed = 20200220
176187
set_random_seeds(seed=seed, cuda=cuda)
177188

178-
n_classes = 4
179-
classes = list(range(n_classes))
180-
# Extract number of chans and time steps from dataset
181-
n_chans = train_set[0][0].shape[0]
182-
n_times = train_set[0][0].shape[1]
183-
184189
model = ShallowFBCSPNet(
185-
n_chans,
186-
n_classes,
187-
n_times=n_times,
190+
n_chans=sig_props["n_chans"],
191+
n_outputs=sig_props["n_outputs"],
192+
n_times=sig_props["n_times"],
188193
final_conv_length="auto",
189194
)
190195

@@ -234,6 +239,7 @@
234239

235240
batch_size = 64
236241
n_epochs = 4
242+
classes = list(range(sig_props["n_outputs"]))
237243

238244
clf = EEGClassifier(
239245
model,
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)