Beispiel #1
0
 def _print_info(self):
     print('Finished data loading.')
     print('  NumNodes: {}'.format(self._graph.number_of_nodes()))
     print('  NumEdges: {}'.format(self._graph.number_of_edges()))
     print('  NumFeats: {}'.format(self._graph.ndata['feat'].shape[1]))
     print('  NumClasses: {}'.format(self.num_classes))
     print('  NumTrainingSamples: {}'.format(
         F.nonzero_1d(self._graph.ndata['train_mask']).shape[0]))
     print('  NumValidationSamples: {}'.format(
         F.nonzero_1d(self._graph.ndata['val_mask']).shape[0]))
     print('  NumTestSamples: {}'.format(
         F.nonzero_1d(self._graph.ndata['test_mask']).shape[0]))
Beispiel #2
0
Datei: rdf.py Projekt: xnuohz/dgl
    def load(self):
        """load the graph list and the labels from disk"""
        graph_path = os.path.join(self.save_path, self.save_name + '.bin')
        info_path = os.path.join(self.save_path, self.save_name + '.pkl')
        graphs, _ = load_graphs(str(graph_path))

        info = load_info(str(info_path))
        self._num_classes = info['num_classes']
        self._predict_category = info['predict_category']
        self._hg = graphs[0]
        train_mask = self._hg.nodes[self.predict_category].data['train_mask']
        test_mask = self._hg.nodes[self.predict_category].data['test_mask']
        self._labels = self._hg.nodes[self.predict_category].data['labels']

        train_idx = F.nonzero_1d(train_mask)
        test_idx = F.nonzero_1d(test_mask)
        self._train_idx = train_idx
        self._test_idx = test_idx