Skip to content

Actor

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

Bases: _GeomGCNDataset

The actor-only induced subgraph of the film-director-actor-writer network used in the "Geom-GCN: Geometric Graph Convolutional Networks" paper.

Each node corresponds to an actor, and the edge between two nodes denotes co-occurrence on the same Wikipedia page. Node features correspond to some keywords in the Wikipedia pages. The task is to classify the nodes into five categories in terms of words of the actor's Wikipedia page.

The graph has 7,600 nodes, 30,019 edges, 932 features and 5 classes. The 10 fixed train/validation/test splits (60%/20%/20%) of the Geom-GCN paper are stored as masks of shape [num_nodes, 10] in the train_mask, val_mask and test_mask attributes.

This dataset follows the implementation of PyG.

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 Actor

dataset = Actor()
>>> actor(num_graphs=1)

dataset[0]
>>> GraphData(
        edge_index(shape=(2, 30019), int32)
        node_features(shape=(7600, 932), float32)
        node_labels(shape=(7600,), int32)
        train_mask(shape=(7600, 10), bool)
        val_mask(shape=(7600, 10), bool)
        test_mask(shape=(7600, 10), bool))
Source code in mlx_graphs/datasets/geom_gcn.py
def __init__(
    self,
    base_dir: Optional[str] = None,
    pre_transform: Optional[Callable] = None,
    transform: Optional[Callable] = None,
):
    super().__init__(
        name="actor",
        base_dir=base_dir,
        pre_transform=pre_transform,
        transform=transform,
    )

from mlx_graphs.datasets import Actor · mlx_graphs/datasets/geom_gcn.py