Skip to content

AmazonProducts

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

Bases: _GraphSAINTDataset

The Amazon dataset from the "GraphSAINT: Graph Sampling Based Inductive Learning Method" paper, containing products and their categories.

The task is multi-label: node_labels holds 107 binary (float32) targets per node. The raw files take about 2.5 GB, and the processed graph about 3.5 GB (264M edges stored as int32).

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

#nodes #edges #features #classes
1,569,960 264,339,468 200 107

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
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__("amazon_products", base_dir, pre_transform, transform)

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