CoraFullDatasetο
- class dgl.data.CoraFullDataset(raw_dir=None, force_reload=False, verbose=False, transform=None)[source]ο
Bases:
GNNBenchmarkDataset
CORA-Full dataset for node classification task.
Extended Cora dataset. Nodes represent paper and edges represent citations.
Reference: https://github.com/shchur/gnn-benchmark#datasets
Statistics:
Nodes: 19,793
Edges: 126,842 (note that the original dataset has 65,311 edges but DGL adds the reverse edges and remove the duplicates, hence with a different number)
Number of Classes: 70
Node feature size: 8,710
- Parameters:
raw_dir (str) β Raw file directory to download/contains the input data directory. Default: ~/.dgl/
force_reload (bool) β Whether to reload the dataset. Default: False
verbose (bool) β Whether to print out progress information. Default: True.
transform (callable, optional) β A transform that takes in a
DGLGraph
object and returns a transformed version. TheDGLGraph
object will be transformed before every access.
Examples
>>> data = CoraFullDataset() >>> g = data[0] >>> num_class = data.num_classes >>> feat = g.ndata['feat'] # get node feature >>> label = g.ndata['label'] # get node labels
- __getitem__(idx)ο
Get graph by index
- Parameters:
idx (int) β Item index
- Returns:
The graph contains:
ndata['feat']
: node featuresndata['label']
: node labels
- Return type:
- __len__()ο
Number of graphs in the dataset