-
Notifications
You must be signed in to change notification settings - Fork 0
/
CustomModel3_tuned_hyperparams.yaml
167 lines (160 loc) · 6.83 KB
/
CustomModel3_tuned_hyperparams.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
seed: 1234
__set_torchseed: !apply:torch.manual_seed [!ref <seed>]
# DIRECTORIES
data_folder: !PLACEHOLDER #'/path/to/dataset'. The dataset will be automatically downloaded in this folder
cached_data_folder: !PLACEHOLDER #'path/to/pickled/dataset'
output_folder: !PLACEHOLDER #'path/to/results'
# DATASET HPARS
# Defining the MOABB dataset.
dataset: !new:moabb.datasets.BNCI2014001
save_prepared_dataset: True # set to True if you want to save the prepared dataset as a pkl file to load and use afterwards
data_iterator_name: !PLACEHOLDER
target_subject_idx: !PLACEHOLDER
target_session_idx: !PLACEHOLDER
events_to_load: null # all events will be loaded
original_sample_rate: 250 # Original sampling rate provided by dataset authors
sample_rate: 125 # Target sampling rate (Hz)
# band-pass filtering cut-off frequencies
fmin: 0.2
fmax: 20.5
n_classes: 4
# tmin, tmax respect to stimulus onset that define the interval attribute of the dataset class
# trial begins (0 s), cue (2 s, 1.25 s long); each trial is 6 s long
# dataset interval starts from 2
# -->tmin tmax are referred to this start value (e.g., tmin=0.5 corresponds to 2.5 s)
tmin: 0.
tmax: 3.7
# number of steps used when selecting adjacent channels from a seed channel (default at Cz)
n_steps_channel_selection: 2
T: !apply:math.ceil
- !ref <sample_rate> * (<tmax> - <tmin>)
C: 22
# We here specify how to perfom test:
# - If test_with: 'last' we perform test with the latest model.
# - if test_with: 'best, we perform test with the best model (according to the metric specified in test_key)
# The variable avg_models can be used to average the parameters of the last (or best) N saved models before testing.
# This can have a regularization effect. If avg_models: 1, the last (or best) model is used directly.
test_with: 'last' # 'last' or 'best'
test_key: "acc" # Possible opts: "loss", "f1", "auc", "acc"
# METRICS
f1: !name:sklearn.metrics.f1_score
average: 'macro'
acc: !name:sklearn.metrics.balanced_accuracy_score
cm: !name:sklearn.metrics.confusion_matrix
metrics:
f1: !ref <f1>
acc: !ref <acc>
cm: !ref <cm>
# TRAINING HPARS
n_train_examples: 100 # it will be replaced in the train script
# checkpoints to average
avg_models: 2
number_of_epochs: 817
lr: 0.0001
# Learning rate scheduling (cyclic learning rate is used here)
max_lr: !ref <lr> # Upper bound of the cycle (max value of the lr)
base_lr: 0.00000001 # Lower bound in the cycle (min value of the lr)
step_size_multiplier: 5 #from 2 to 8
step_size: !apply:round
- !ref <step_size_multiplier> * <n_train_examples> / <batch_size>
lr_annealing: !new:speechbrain.nnet.schedulers.CyclicLRScheduler
base_lr: !ref <base_lr>
max_lr: !ref <max_lr>
step_size: !ref <step_size>
label_smoothing: 0.0
loss: !name:speechbrain.nnet.losses.nll_loss
label_smoothing: !ref <label_smoothing>
optimizer: !name:torch.optim.Adam
lr: !ref <lr>
epoch_counter: !new:speechbrain.utils.epoch_loop.EpochCounter # epoch counter
limit: !ref <number_of_epochs>
batch_size_exponent: 4
batch_size: !ref 2 ** <batch_size_exponent>
valid_ratio: 0.2
# DATA AUGMENTATION
# cutcat (disabled when min_num_segments=max_num_segments=1)
max_num_segments: 3
cutcat: !new:speechbrain.augment.time_domain.CutCat
min_num_segments: 2
max_num_segments: !ref <max_num_segments>
# random amplitude gain between 0.5-1.5 uV (disabled when amp_delta=0.)
amp_delta: 0.00327
rand_amp: !new:speechbrain.augment.time_domain.RandAmp
amp_low: !ref 1 - <amp_delta>
amp_high: !ref 1 + <amp_delta>
# random shifts between -300 ms to 300 ms (disabled when shift_delta=0.)
shift_delta_: 1 # orion_step2: --shift_delta_~"uniform(0, 25, discrete=True)"
shift_delta: !ref 1e-2 * <shift_delta_> # 0.250 # 0.-0.25 with steps of 0.01
min_shift: !apply:math.floor
- !ref 0 - <sample_rate> * <shift_delta>
max_shift: !apply:math.floor
- !ref 0 + <sample_rate> * <shift_delta>
time_shift: !new:speechbrain.augment.freq_domain.RandomShift
min_shift: !ref <min_shift>
max_shift: !ref <max_shift>
dim: 1
# injection of gaussian white noise
snr_white_low: 9.4
snr_white_delta: 17.2
snr_white_high: !ref <snr_white_low> + <snr_white_delta>
add_noise_white: !new:speechbrain.augment.time_domain.AddNoise
snr_low: !ref <snr_white_low>
snr_high: !ref <snr_white_high>
repeat_augment: 1 # @orion_step1: --repeat_augment 0
augment: !new:speechbrain.augment.augmenter.Augmenter
parallel_augment: True
concat_original: True
parallel_augment_fixed_bs: True
repeat_augment: !ref <repeat_augment>
shuffle_augmentations: True
min_augmentations: 4
max_augmentations: 4
augmentations: [
!ref <cutcat>,
!ref <rand_amp>,
!ref <time_shift>,
!ref <add_noise_white>]
# DATA NORMALIZATION
dims_to_normalize: 1 # 1 (time) or 2 (EEG channels)
normalize: !name:speechbrain.processing.signal_processing.mean_std_norm
dims: !ref <dims_to_normalize>
# MODEL
input_shape: [null, !ref <T>, !ref <C>, null]
cnn_temporal_kernels: 45
cnn_temporal_kernelsize: 28
# depth multiplier for the spatial depthwise conv. layer
cnn_spatial_depth_multiplier: 2
cnn_spatial_max_norm: 1. # kernel max-norm constaint of the spatial depthwise conv. layer
cnn_spatial_pool: 4
cnn_septemporal_depth_multiplier: 1 # depth multiplier for the separable temporal conv. layer
cnn_septemporal_point_kernels_ratio_: 2
cnn_septemporal_point_kernels_ratio: !ref <cnn_septemporal_point_kernels_ratio_> / 4
## number of temporal filters in the separable temporal conv. layer
cnn_septemporal_point_kernels_: !ref <cnn_temporal_kernels> * <cnn_spatial_depth_multiplier> * <cnn_septemporal_depth_multiplier>
cnn_septemporal_point_kernels: !apply:math.ceil
- !ref <cnn_septemporal_point_kernels_ratio> * <cnn_septemporal_point_kernels_> + 1
cnn_septemporal_kernelsize_: 19
max_cnn_spatial_pool: 4
cnn_septemporal_kernelsize: !apply:round
- !ref <cnn_septemporal_kernelsize_> * <max_cnn_spatial_pool> / <cnn_spatial_pool>
cnn_septemporal_pool: 3
cnn_pool_type: 'avg'
dense_max_norm: 0.25 # kernel max-norm constaint of the dense layer
dropout: 0.03592
activation_type: 'elu'
model: !new:models.CustomModel3.CustomModel3
input_shape: !ref <input_shape>
cnn_temporal_kernels: !ref <cnn_temporal_kernels>
cnn_temporal_kernelsize: [!ref <cnn_temporal_kernelsize>, 1]
cnn_spatial_depth_multiplier: !ref <cnn_spatial_depth_multiplier>
cnn_spatial_max_norm: !ref <cnn_spatial_max_norm>
cnn_spatial_pool: [!ref <cnn_spatial_pool>, 1]
cnn_septemporal_depth_multiplier: !ref <cnn_septemporal_depth_multiplier>
cnn_septemporal_point_kernels: !ref <cnn_septemporal_point_kernels>
cnn_septemporal_kernelsize: [!ref <cnn_septemporal_kernelsize>, 1]
cnn_septemporal_pool: [!ref <cnn_septemporal_pool>, 1]
cnn_pool_type: !ref <cnn_pool_type>
activation_type: !ref <activation_type>
dense_max_norm: !ref <dense_max_norm>
dropout: !ref <dropout>
dense_n_neurons: !ref <n_classes>