FlickrDatasetΒΆ
-
class
dgl.data.
FlickrDataset
(raw_dir=None, force_reload=False, verbose=False, transform=None, reorder=False)[source]ΒΆ Bases:
dgl.data.dgl_dataset.DGLBuiltinDataset
Flickr dataset for node classification from GraphSAINT: Graph Sampling Based Inductive Learning Method
The task of this dataset is categorizing types of images based on the descriptions and common properties of online images.
Flickr dataset statistics:
Nodes: 89,250
Edges: 899,756
Number of classes: 7
Node feature size: 500
- 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: False
transform (callable, optional) β A transform that takes in a
DGLGraph
object and returns a transformed version. TheDGLGraph
object will be transformed before every access.reorder (bool) β Whether to reorder the graph using
reorder_graph()
. Default: False.
Examples
>>> from dgl.data import FlickrDataset >>> dataset = FlickrDataset() >>> dataset.num_classes 7 >>> g = dataset[0] >>> # get node feature >>> feat = g.ndata['feat'] >>> # get node labels >>> labels = g.ndata['label'] >>> # get data split >>> train_mask = g.ndata['train_mask'] >>> val_mask = g.ndata['val_mask'] >>> test_mask = g.ndata['test_mask']
-
__getitem__
(idx)[source]ΒΆ Get graph object
- Parameters
idx (int) β Item index, FlickrDataset has only one graph object
- Returns
The graph contains:
ndata['label']
: node labelndata['feat']
: node featurendata['train_mask']
: mask for training node setndata['val_mask']
: mask for validation node setndata['test_mask']
: mask for test node set
- Return type