Example #1
0
import sys
sys.path.append(
    '/Users/mcomastu/TFM/brain-states-dl')  # TODO: remove this first two lines

from torch.utils.data import DataLoader
from nn_classification.data_loaders import FullEEGDataset, subject_nn_data
from nn_classification.pl_module import LitConvClassifier
from utils.file_utils import load_cfg
import numpy as np
from scipy.ndimage import gaussian_filter
from data_preprocessing.preprocess_module import sequence_downsampling
from torch import nn
import os.path as osp

if __name__ == '__main__':
    cfg = load_cfg()
    run_pd = cfg['run_pd']
    subjects_list = cfg['pd_subjects'] if run_pd else cfg['healthy_subjects']
    if run_pd:
        med_str = '-on-med' if cfg['model_on_med'] else '-off-med'
    else:
        med_str = ''

    subject = 25
    input_data, targets, long_labels = subject_nn_data(
        subject,
        healthy_subjects=cfg['healthy_subjects'],
        pd_subjects=cfg['pd_subjects'],
        feature_name=cfg['pred_feature'],
        data_path=cfg['data_path'],
        pd_dir=cfg['pd_dir'],
import numpy as np
import os.path as osp
from utils.file_utils import load_cfg
import matplotlib.pyplot as plt

training_aucs = []
validation_aucs = []
training_accs = []
validation_accs = []

cfg = load_cfg()
ckpt_paths = load_cfg('nn_interpretability/ckpt_paths.yml')
if cfg['run_pd']:
    session = '-on' if cfg['model_on_med'] else '-off'
    subjects_list = cfg['pd_subjects']
    inputs_path = cfg['pd_dir']
else:
    session = ''
    subjects_list = cfg['healthy_subjects']
    inputs_path = cfg['healthy_dir']
freq_ids = dict({'alpha': 0, 'beta': 1, 'gamma': 2})

min_max_accs = np.array([
    [[625, 703, 625, 766, 703, 797], [531, 670, 523, 654, 700, 815]],
    [[579, 632, 684, 790, 579, 790], [608, 667, 603, 658, 598, 706]],
    [[406, 484, 531, 672, 750, 844], [400, 485, 531, 585, 762, 823]],
    [[438, 516, 516, 672, 500, 750], [369, 462, 464, 542, 577, 662]],
    [[453, 688, 438, 578, 438, 594], [519, 583, 510, 574, 546, 620]],
    [[625, 672, 641, 719, 797, 906], [600, 670, 631, 700, 746, 854]],
    [[547, 656, 531, 672, 641, 797], [509, 648, 593, 648, 657, 732]],
    [[610, 719, 641, 813, 719, 875], [623, 685, 669, 700, 731, 831]],