Example #1
0
 def test_dataset(self):
     dataset = TUHEEGAbnormalDataset(self.PATH)
     preprocessing = Pipeline([
         CommonChannelSet(),
         LowestFrequency(),
         BandPassFrequency(0.1, 47),
         ToDataframe(),
         DynamicWindow(4),
         JoinedPreprocessor(inputs=[[
             BinarizedSpearmanCorrelation(),
             CorrelationToAdjacency()
         ],
                                    Bandpower()],
                            output=GraphWithFeatures())
     ])
     dataset = dataset.set_pipeline(preprocessing).load()
from sklearn.model_selection import StratifiedKFold
import numpy as np

import os
import sys

sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../..')))
from pyeeglab import    TUHEEGAbnormalDataset, SinglePickleCache, Pipeline, CommonChannelSet, \
                        LowestFrequency, BandPassFrequency, ToDataframe, DynamicWindow, \
                        BinarizedSpearmanCorrelation, ToNumpy

dataset = TUHEEGAbnormalDataset('../../data/tuh_eeg_abnormal/v2.0.0/edf')
dataset.set_cache_manager(SinglePickleCache('../../export'))

preprocessing = Pipeline([
    CommonChannelSet(),
    LowestFrequency(),
    BandPassFrequency(0.1, 47),
    ToDataframe(),
    DynamicWindow(8),
    BinarizedSpearmanCorrelation(),
    ToNumpy()
])

dataset = dataset.set_pipeline(preprocessing).load()
data, labels = dataset['data'], dataset['labels']

adjs = data[0].shape[0]
classes = len(set(labels))
input_shape = data[0].shape[1:]