Skip to content

JODIEDataset

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

Bases: Dataset

The temporal interaction graphs of the "JODIE: Predicting Dynamic Embedding Trajectory in Temporal Interaction Networks" paper, as PyG's torch_geometric.datasets.JODIEDataset.

Every dataset is a single TemporalData stream of user-item interactions sorted by time, with src the users, dst the items (numbered after the users), t the timestamps (int64), msg the interaction features and y the state change labels.

====================== ======== =========== ========== ======== Name #nodes #events #features #classes ====================== ======== =========== ========== ======== "wikipedia" 9,227 157,474 172 2 "mooc" 7,144 411,749 4 2 "lastfm" 1,980 1,293,103 2 1 ====================== ======== =========== ========== ========

The "reddit" dataset of PyG is not available (its raw file is 2.4 GB).

Parameters:

Name Type Description Default
name str

Name of the dataset, "wikipedia", "mooc" or "lastfm"

required
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 TemporalData before saving it to disk

None
transform Optional[Callable]

A function/transform applied to the TemporalData at every access

None

Example:

from mlx_graphs.datasets import JODIEDataset

dataset = JODIEDataset("wikipedia")
data = dataset[0]
>>> TemporalData(src=[157474], dst=[157474], t=[157474],
                 msg=[157474, 172], y=[157474])
train_data, val_data, test_data = data.train_val_test_split(
    val_ratio=0.15, test_ratio=0.15
)
Source code in mlx_graphs/datasets/jodie.py
def __init__(
    self,
    name: str,
    base_dir: Optional[str] = None,
    pre_transform: Optional[Callable] = None,
    transform: Optional[Callable] = None,
):
    name = name.lower()
    if name not in self.names:
        raise ValueError(f"Unknown JODIE dataset '{name}', available: {self.names}")
    self.jodie_name = name
    super().__init__(
        name=f"jodie_{name}",
        base_dir=base_dir,
        pre_transform=pre_transform,
        transform=transform,
    )

from mlx_graphs.datasets import JODIEDataset · mlx_graphs/datasets/jodie.py