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. The DGLGraph object will be transformed before every access.

  • reorder (bool) – Whether to reorder the graph using reorder_graph(). Default: False.

num_classesΒΆ

Number of node classes

Type

int

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 label

  • ndata['feat']: node feature

  • ndata['train_mask']: mask for training node set

  • ndata['val_mask']: mask for validation node set

  • ndata['test_mask']: mask for test node set

Return type

dgl.DGLGraph

__len__()[source]ΒΆ

The number of graphs in the dataset.