Skip to content

Commit e573df1

Browse files
committed
updated Notebooks and added new example
1 parent 1548188 commit e573df1

8 files changed

+2223
-500
lines changed

Notebooks/Augmentation_guide.ipynb

+15-92
Large diffs are not rendered by default.

Notebooks/Dataload_guide.ipynb

+15-141
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
},
3131
{
3232
"cell_type": "code",
33-
"execution_count": 1,
33+
"execution_count": null,
3434
"id": "31f8ad6a",
3535
"metadata": {},
3636
"outputs": [],
@@ -68,7 +68,7 @@
6868
},
6969
{
7070
"cell_type": "code",
71-
"execution_count": 2,
71+
"execution_count": null,
7272
"id": "669a9877-adc2-4741-b291-2ff0d5a11396",
7373
"metadata": {},
7474
"outputs": [],
@@ -124,85 +124,10 @@
124124
},
125125
{
126126
"cell_type": "code",
127-
"execution_count": 3,
127+
"execution_count": null,
128128
"id": "0fe92ca6",
129129
"metadata": {},
130-
"outputs": [
131-
{
132-
"data": {
133-
"text/html": [
134-
"<div>\n",
135-
"<style scoped>\n",
136-
" .dataframe tbody tr th:only-of-type {\n",
137-
" vertical-align: middle;\n",
138-
" }\n",
139-
"\n",
140-
" .dataframe tbody tr th {\n",
141-
" vertical-align: top;\n",
142-
" }\n",
143-
"\n",
144-
" .dataframe thead th {\n",
145-
" text-align: right;\n",
146-
" }\n",
147-
"</style>\n",
148-
"<table border=\"1\" class=\"dataframe\">\n",
149-
" <thead>\n",
150-
" <tr style=\"text-align: right;\">\n",
151-
" <th></th>\n",
152-
" <th>full_path</th>\n",
153-
" <th>file_name</th>\n",
154-
" <th>N_samples</th>\n",
155-
" </tr>\n",
156-
" </thead>\n",
157-
" <tbody>\n",
158-
" <tr>\n",
159-
" <th>0</th>\n",
160-
" <td>Simulated_EEG/1_10_1_1.pickle</td>\n",
161-
" <td>1_10_1_1.pickle</td>\n",
162-
" <td>15</td>\n",
163-
" </tr>\n",
164-
" <tr>\n",
165-
" <th>1</th>\n",
166-
" <td>Simulated_EEG/1_10_2_1.pickle</td>\n",
167-
" <td>1_10_2_1.pickle</td>\n",
168-
" <td>5</td>\n",
169-
" </tr>\n",
170-
" <tr>\n",
171-
" <th>2</th>\n",
172-
" <td>Simulated_EEG/1_10_3_1.pickle</td>\n",
173-
" <td>1_10_3_1.pickle</td>\n",
174-
" <td>7</td>\n",
175-
" </tr>\n",
176-
" <tr>\n",
177-
" <th>3</th>\n",
178-
" <td>Simulated_EEG/1_10_4_1.pickle</td>\n",
179-
" <td>1_10_4_1.pickle</td>\n",
180-
" <td>12</td>\n",
181-
" </tr>\n",
182-
" <tr>\n",
183-
" <th>4</th>\n",
184-
" <td>Simulated_EEG/1_10_5_1.pickle</td>\n",
185-
" <td>1_10_5_1.pickle</td>\n",
186-
" <td>6</td>\n",
187-
" </tr>\n",
188-
" </tbody>\n",
189-
"</table>\n",
190-
"</div>"
191-
],
192-
"text/plain": [
193-
" full_path file_name N_samples\n",
194-
"0 Simulated_EEG/1_10_1_1.pickle 1_10_1_1.pickle 15\n",
195-
"1 Simulated_EEG/1_10_2_1.pickle 1_10_2_1.pickle 5\n",
196-
"2 Simulated_EEG/1_10_3_1.pickle 1_10_3_1.pickle 7\n",
197-
"3 Simulated_EEG/1_10_4_1.pickle 1_10_4_1.pickle 12\n",
198-
"4 Simulated_EEG/1_10_5_1.pickle 1_10_5_1.pickle 6"
199-
]
200-
},
201-
"execution_count": 3,
202-
"metadata": {},
203-
"output_type": "execute_result"
204-
}
205-
],
130+
"outputs": [],
206131
"source": [
207132
"# Define partition spec\n",
208133
"eegpath = 'Simulated_EEG'\n",
@@ -265,26 +190,10 @@
265190
},
266191
{
267192
"cell_type": "code",
268-
"execution_count": 4,
193+
"execution_count": null,
269194
"id": "aabf2f21",
270195
"metadata": {},
271-
"outputs": [
272-
{
273-
"name": "stdout",
274-
"output_type": "stream",
275-
"text": [
276-
"\n",
277-
"train ratio: 0.80\n",
278-
"validation ratio: 0.10\n",
279-
"test ratio: 0.10\n",
280-
"\n",
281-
"train labels ratio: 1=0.239, 2=0.244, 3=0.252, 4=0.265, \n",
282-
"val labels ratio: 1=0.239, 2=0.244, 3=0.252, 4=0.265, \n",
283-
"test labels ratio: 1=0.239, 2=0.244, 3=0.252, 4=0.265, \n",
284-
"\n"
285-
]
286-
}
287-
],
196+
"outputs": [],
288197
"source": [
289198
"# for stratified split we need to create an array with the labels\n",
290199
"# associated to each eeg file\n",
@@ -313,21 +222,10 @@
313222
},
314223
{
315224
"cell_type": "code",
316-
"execution_count": 5,
225+
"execution_count": null,
317226
"id": "80f99b9f-a634-4e1c-90cd-10c30f5c20ae",
318227
"metadata": {},
319-
"outputs": [
320-
{
321-
"name": "stdout",
322-
"output_type": "stream",
323-
"text": [
324-
"\n",
325-
"train ratio: 0.80\n",
326-
"validation ratio: 0.10\n",
327-
"test ratio: 0.10\n"
328-
]
329-
}
330-
],
228+
"outputs": [],
331229
"source": [
332230
"EEGsplit2 = dl.GetEEGSplitTable(EEGlen, \n",
333231
" test_ratio=0.1, val_ratio=0.1,\n",
@@ -388,18 +286,10 @@
388286
},
389287
{
390288
"cell_type": "code",
391-
"execution_count": 6,
289+
"execution_count": null,
392290
"id": "80f58518",
393291
"metadata": {},
394-
"outputs": [
395-
{
396-
"name": "stdout",
397-
"output_type": "stream",
398-
"text": [
399-
"torch.Size([2, 256])\n"
400-
]
401-
}
402-
],
292+
"outputs": [],
403293
"source": [
404294
"dataset_pretrain = dl.EEGDataset(EEGlen, EEGsplit, \n",
405295
" [freq, window, overlap], # split parameters must be given as list\n",
@@ -421,18 +311,10 @@
421311
},
422312
{
423313
"cell_type": "code",
424-
"execution_count": 7,
314+
"execution_count": null,
425315
"id": "914261e4",
426316
"metadata": {},
427-
"outputs": [
428-
{
429-
"name": "stdout",
430-
"output_type": "stream",
431-
"text": [
432-
"torch.Size([2, 256]) 1\n"
433-
]
434-
}
435-
],
317+
"outputs": [],
436318
"source": [
437319
"dataset_finetune = dl.EEGDataset(EEGlen, EEGsplit, \n",
438320
" [freq, window, overlap], # split parameters must be given as list\n",
@@ -474,7 +356,7 @@
474356
},
475357
{
476358
"cell_type": "code",
477-
"execution_count": 8,
359+
"execution_count": null,
478360
"id": "abdbddd5-346b-4b5d-860b-2e3459b41646",
479361
"metadata": {},
480362
"outputs": [],
@@ -499,18 +381,10 @@
499381
},
500382
{
501383
"cell_type": "code",
502-
"execution_count": 9,
384+
"execution_count": null,
503385
"id": "57c84ba5-1bd9-4403-92ed-b7c3f791d6bc",
504386
"metadata": {},
505-
"outputs": [
506-
{
507-
"name": "stdout",
508-
"output_type": "stream",
509-
"text": [
510-
"torch.Size([16, 2, 256])\n"
511-
]
512-
}
513-
],
387+
"outputs": [],
514388
"source": [
515389
"Final_Dataloader = DataLoader( dataset = dataset_pretrain, \n",
516390
" batch_size= 16, \n",

0 commit comments

Comments
 (0)