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()
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:] inputs = [[] for _ in range(adjs)] for d in data: for i in range(adjs): inputs[i].append(d[i].reshape((*input_shape, 1)))