Skip to content

Flickr

Flickr(
    base_dir: Optional[str] = None,
    pre_transform: Optional[Callable] = None,
    transform: Optional[Callable] = None,
)

Bases: _GraphSAINTDataset

The Flickr dataset from the "GraphSAINT: Graph Sampling Based Inductive Learning Method" paper, containing descriptions and common properties of images.

Nodes are images, edges connect images sharing properties (same location, gallery, comments by the same user...), node features are bag-of-words of the image descriptions, and the task is to predict one of 7 image classes. The graph has the GraphSAINT split (50% / 25% / 25%) in train_mask / val_mask / test_mask.

This dataset follows the implementation of PyG (same files, edges and splits).

#nodes #edges #features #classes
89,250 899,756 500 7

Parameters:

Name Type Description Default
base_dir Optional[str]

Directory where to store dataset files. Default is in the local directory .mlx_graphs_data/.

None
pre_transform Optional[Callable]

A function/transform applied to the graph once, before it is saved.

None
transform Optional[Callable]

A function/transform applied to the graph at every access.

None

Example:

from mlx_graphs.datasets import Flickr

dataset = Flickr()
dataset[0]
>>> GraphData(
        edge_index(shape=(2, 899756), int32)
        node_features(shape=(89250, 500), float32)
        node_labels(shape=(89250,), int32)
        train_mask(shape=(89250,), bool)
        val_mask(shape=(89250,), bool)
        test_mask(shape=(89250,), bool))
Source code in mlx_graphs/datasets/large_graph.py
def __init__(
    self,
    base_dir: Optional[str] = None,
    pre_transform: Optional[Callable] = None,
    transform: Optional[Callable] = None,
):
    super().__init__("flickr", base_dir, pre_transform, transform)

from mlx_graphs.datasets import Flickr · mlx_graphs/datasets/large_graph.py