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 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:] inputs = [[] for _ in range(adjs)] for d in data: for i in range(adjs):
import sys sys.path.insert( 0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../..'))) from pyeeglab import TUHEEGAbnormalDataset, Pipeline, CommonChannelSet, \ LowestFrequency, ToDataframe, DynamicWindow, BinarizedSpearmanCorrelation, \ CorrelationToAdjacency, Bandpower, GraphWithFeatures, ForkedPreprocessor dataset = TUHEEGAbnormalDataset('../../data/tuh_eeg_abnormal/') preprocessing = Pipeline([ CommonChannelSet(), LowestFrequency(), ToDataframe(), DynamicWindow(8), ForkedPreprocessor(inputs=[[ BinarizedSpearmanCorrelation(), CorrelationToAdjacency() ], Bandpower()], output=GraphWithFeatures()) ], to_numpy=False) dataset = dataset.set_pipeline(preprocessing).load() data, labels = dataset['data'], dataset['labels'] data = [[[nx_to_node_features(G, ['features'])[0], add_eye(nx_to_adj(G)[0])] for G in graphs] for graphs in data] data = [[e for G in graphs for e in G] for graphs in data] classes = len(set(labels))