Skip to content

PPI

PPI(
    split: Literal["train", "val", "test"] = "train",
    base_dir: Optional[str] = None,
    pre_transform: Optional[Callable] = None,
    transform: Optional[Callable] = None,
)

Bases: Dataset

The protein-protein interaction networks from the "Predicting Multicellular Function through Multi-layer Tissue Networks" paper, containing positional gene sets, motif gene sets and immunological signatures as features (50 in total) and gene ontology sets as labels (121 in total), as used by GraphSAGE.

The dataset has 24 graphs (one per human tissue): 20 for training, 2 for validation and 2 for testing. The task is multi-label node classification: node_labels holds 121 binary (float32) targets per node. Edges are undirected (both directions are stored) and self-loops are removed, as in PyG.

PyG reads DGL's ppi.zip, which is the GraphSAGE release split into one file per split with a graph id per node. As DGL's server is no longer reachable, this dataset reads the GraphSAGE release directly: nodes, features, labels and edges are the same, and the graphs (stored one after the other) are recovered as the node ranges that no edge crosses (this gives exactly 20 / 2 / 2 graphs, with PyG's 44,906 / 6,514 / 5,524 nodes and 1,226,368 training edges). Edges are sorted by (source, target).

#graphs #nodes #edges #features #tasks
20 ~2,245.3 ~61,318.4 50 121

Parameters:

Name Type Description Default
split Literal['train', 'val', 'test']

"train" (20 graphs), "val" (2) or "test" (2).

'train'
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 every graph once, before it is saved.

None
transform Optional[Callable]

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

None

Example:

from mlx_graphs.datasets import PPI
from mlx_graphs.loaders import Dataloader

train = PPI("train")
loader = Dataloader(train, batch_size=2, shuffle=True)
Source code in mlx_graphs/datasets/large_graph.py
def __init__(
    self,
    split: Literal["train", "val", "test"] = "train",
    base_dir: Optional[str] = None,
    pre_transform: Optional[Callable] = None,
    transform: Optional[Callable] = None,
):
    if split not in self._splits:
        raise ValueError(f"`split` must be one of {self._splits} (got '{split}')")
    self.split = split
    super().__init__(
        name="ppi",
        base_dir=base_dir,
        pre_transform=pre_transform,
        transform=transform,
    )

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