Ejemplo n.º 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()
    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))

graphs = len(data[0])
from pyeeglab import    TUHEEGAbnormalDataset, SinglePickleCache, Pipeline, CommonChannelSet, \
                        LowestFrequency, ToDataframe, DynamicWindow, BinarizedSpearmanCorrelation, \
                        CorrelationToAdjacency, Bandpower, GraphWithFeatures, JoinedPreprocessor

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

preprocessing = Pipeline([
    CommonChannelSet(),
    LowestFrequency(),
    ToDataframe(),
    DynamicWindow(8),
    JoinedPreprocessor(
        inputs=[
            [BinarizedSpearmanCorrelation(), CorrelationToAdjacency()],
            Bandpower()
        ],
        output=GraphWithFeatures()
    )
])

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