Esempio n. 1
0
    def __call__(self, graph):
        if self.labels is not None:
            graph.y = label_to_one_hot(graph.y, self.labels)
        else:
            graph.y = one_hot(graph.y, self.depth)

        return graph
Esempio n. 2
0
    def __call__(self, graph):
        if 'a' not in graph:
            raise ValueError('The graph must have an adjacency matrix')
        degree = graph.a.sum(1).astype(int)
        if isinstance(degree, np.matrix):
            degree = np.asarray(degree)[:, 0]
        degree = one_hot(degree, self.max_degree + 1)
        if 'x' not in graph:
            graph.x = degree
        else:
            graph.x = np.concatenate((graph.x, degree), axis=-1)

        return graph
Esempio n. 3
0
 def load(fname, class_i):
     graph = load_off(fname)
     graph.y = one_hot(class_i, n_out)
     return graph
Esempio n. 4
0
 def load(fname):
     graph = load_off(fname)
     graph.y = one_hot(i, n_out)
     return graph