[02bf81]: / oldexamples / exampleBV.py

Download this file

38 lines (31 with data), 1.0 kB

 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
#conda create -n deepeeg
#source activate deepeeg
#chomd +x install.sh
#bash install.sh
#!git clone https://github.com/kylemath/eeg-notebooks_v0.1
#python
from utils import *
data_dir = '/Users/kylemathewson/Desktop/'
exp = 'bikepark'
#subs = [ '009']
subs = ['005', '007', '009', '010', '012', '013', '014', '015', '016', '019']
sessions = ['quiet','traffic']
nsesh = len(sessions)
event_id = {'Standard': 1, 'Target': 2}
#https://martinos.org/mne/stable/auto_tutorials/plot_visualize_evoked.html
epochs = []
for sub in subs:
print('Loading data for subject ' + sub)
#Load Data
raw = LoadBVData(sub,sessions,data_dir,exp)
#Pre-Process EEG Data
epochs.append(PreProcess(raw,event_id,emcp=True,rereference=True,
plot_erp=True))
epochs = concatenate_epochs(epochs)
print(epochs)
#Engineer Features for Model
feats = FeatureEngineer(epochs,model_type='NN',electrode_median=False)
#Create Model
model,_ = CreateModel(feats, units=[16,16], dropout=.15)
#Train with validation, then Test
TrainTestVal(model,feats)