OnDiskDataset for Heterogeneous Graphο
This tutorial shows how to create OnDiskDataset
for heterogeneous graph that could be used in GraphBolt framework. The major difference from creating dataset for homogeneous graph is that we need to specify node/edge types for edges, feature data, training/validation/test sets.
By the end of this tutorial, you will be able to
organize graph structure data.
organize feature data.
organize training/validation/test set for specific tasks.
To create an OnDiskDataset
object, you need to organize all the data including graph structure, feature data and tasks into a directory. The directory should contain a metadata.yaml
file that describes the metadata of the dataset.
Now letβs generate various data step by step and organize them together to instantiate OnDiskDataset
finally.
Install DGL packageο
[1]:
# Install required packages.
import os
import torch
import numpy as np
os.environ['TORCH'] = torch.__version__
os.environ['DGLBACKEND'] = "pytorch"
# Install the CPU version.
device = torch.device("cpu")
!pip install --pre dgl -f https://data.dgl.ai/wheels-test/repo.html
try:
import dgl
import dgl.graphbolt as gb
installed = True
except ImportError as error:
installed = False
print(error)
print("DGL installed!" if installed else "DGL not found!")
Looking in links: https://data.dgl.ai/wheels-test/repo.html
Requirement already satisfied: dgl in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.1.x/lib/python3.8/site-packages/dgl-2.1.0-py3.8-linux-x86_64.egg (2.1.0)
Requirement already satisfied: numpy>=1.14.0 in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.1.x/lib/python3.8/site-packages (from dgl) (1.24.4)
Requirement already satisfied: scipy>=1.1.0 in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.1.x/lib/python3.8/site-packages (from dgl) (1.10.1)
Requirement already satisfied: networkx>=2.1 in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.1.x/lib/python3.8/site-packages (from dgl) (3.1)
Requirement already satisfied: requests>=2.19.0 in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.1.x/lib/python3.8/site-packages (from dgl) (2.31.0)
Requirement already satisfied: tqdm in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.1.x/lib/python3.8/site-packages (from dgl) (4.66.2)
Requirement already satisfied: psutil>=5.8.0 in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.1.x/lib/python3.8/site-packages (from dgl) (5.9.8)
Requirement already satisfied: torchdata>=0.5.0 in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.1.x/lib/python3.8/site-packages (from dgl) (0.7.1)
Requirement already satisfied: charset-normalizer<4,>=2 in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.1.x/lib/python3.8/site-packages (from requests>=2.19.0->dgl) (3.3.2)
Requirement already satisfied: idna<4,>=2.5 in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.1.x/lib/python3.8/site-packages (from requests>=2.19.0->dgl) (3.6)
Requirement already satisfied: urllib3<3,>=1.21.1 in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.1.x/lib/python3.8/site-packages (from requests>=2.19.0->dgl) (2.2.1)
Requirement already satisfied: certifi>=2017.4.17 in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.1.x/lib/python3.8/site-packages (from requests>=2.19.0->dgl) (2024.2.2)
Requirement already satisfied: torch>=2 in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.1.x/lib/python3.8/site-packages (from torchdata>=0.5.0->dgl) (2.0.0)
Requirement already satisfied: filelock in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.1.x/lib/python3.8/site-packages (from torch>=2->torchdata>=0.5.0->dgl) (3.13.1)
Requirement already satisfied: typing-extensions in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.1.x/lib/python3.8/site-packages (from torch>=2->torchdata>=0.5.0->dgl) (4.10.0)
Requirement already satisfied: sympy in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.1.x/lib/python3.8/site-packages (from torch>=2->torchdata>=0.5.0->dgl) (1.12)
Requirement already satisfied: jinja2 in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.1.x/lib/python3.8/site-packages (from torch>=2->torchdata>=0.5.0->dgl) (3.1.3)
Requirement already satisfied: nvidia-cuda-nvrtc-cu11==11.7.99 in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.1.x/lib/python3.8/site-packages (from torch>=2->torchdata>=0.5.0->dgl) (11.7.99)
Requirement already satisfied: nvidia-cuda-runtime-cu11==11.7.99 in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.1.x/lib/python3.8/site-packages (from torch>=2->torchdata>=0.5.0->dgl) (11.7.99)
Requirement already satisfied: nvidia-cuda-cupti-cu11==11.7.101 in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.1.x/lib/python3.8/site-packages (from torch>=2->torchdata>=0.5.0->dgl) (11.7.101)
Requirement already satisfied: nvidia-cudnn-cu11==8.5.0.96 in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.1.x/lib/python3.8/site-packages (from torch>=2->torchdata>=0.5.0->dgl) (8.5.0.96)
Requirement already satisfied: nvidia-cublas-cu11==11.10.3.66 in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.1.x/lib/python3.8/site-packages (from torch>=2->torchdata>=0.5.0->dgl) (11.10.3.66)
Requirement already satisfied: nvidia-cufft-cu11==10.9.0.58 in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.1.x/lib/python3.8/site-packages (from torch>=2->torchdata>=0.5.0->dgl) (10.9.0.58)
Requirement already satisfied: nvidia-curand-cu11==10.2.10.91 in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.1.x/lib/python3.8/site-packages (from torch>=2->torchdata>=0.5.0->dgl) (10.2.10.91)
Requirement already satisfied: nvidia-cusolver-cu11==11.4.0.1 in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.1.x/lib/python3.8/site-packages (from torch>=2->torchdata>=0.5.0->dgl) (11.4.0.1)
Requirement already satisfied: nvidia-cusparse-cu11==11.7.4.91 in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.1.x/lib/python3.8/site-packages (from torch>=2->torchdata>=0.5.0->dgl) (11.7.4.91)
Requirement already satisfied: nvidia-nccl-cu11==2.14.3 in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.1.x/lib/python3.8/site-packages (from torch>=2->torchdata>=0.5.0->dgl) (2.14.3)
Requirement already satisfied: nvidia-nvtx-cu11==11.7.91 in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.1.x/lib/python3.8/site-packages (from torch>=2->torchdata>=0.5.0->dgl) (11.7.91)
Requirement already satisfied: triton==2.0.0 in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.1.x/lib/python3.8/site-packages (from torch>=2->torchdata>=0.5.0->dgl) (2.0.0)
Requirement already satisfied: setuptools in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.1.x/lib/python3.8/site-packages (from nvidia-cublas-cu11==11.10.3.66->torch>=2->torchdata>=0.5.0->dgl) (69.1.0)
Requirement already satisfied: wheel in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.1.x/lib/python3.8/site-packages (from nvidia-cublas-cu11==11.10.3.66->torch>=2->torchdata>=0.5.0->dgl) (0.42.0)
Requirement already satisfied: cmake in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.1.x/lib/python3.8/site-packages (from triton==2.0.0->torch>=2->torchdata>=0.5.0->dgl) (3.28.3)
Requirement already satisfied: lit in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.1.x/lib/python3.8/site-packages (from triton==2.0.0->torch>=2->torchdata>=0.5.0->dgl) (17.0.6)
Requirement already satisfied: MarkupSafe>=2.0 in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.1.x/lib/python3.8/site-packages (from jinja2->torch>=2->torchdata>=0.5.0->dgl) (2.1.5)
Requirement already satisfied: mpmath>=0.19 in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.1.x/lib/python3.8/site-packages (from sympy->torch>=2->torchdata>=0.5.0->dgl) (1.3.0)
DGL installed!
Data preparationο
In order to demonstrate how to organize various data, letβs create a base directory first.
[2]:
base_dir = './ondisk_dataset_heterograph'
os.makedirs(base_dir, exist_ok=True)
print(f"Created base directory: {base_dir}")
Created base directory: ./ondisk_dataset_heterograph
Generate graph structure dataο
For heterogeneous graph, we need to save different edge edges(namely node pairs) into separate Numpy or CSV files.
Note: - when saving to Numpy, the array requires to be in shape of (2, N)
. This format is recommended as constructing graph from it is much faster than CSV file. - when saving to CSV file, do not save index and header.
[3]:
import numpy as np
import pandas as pd
# For simplicity, we create a heterogeneous graph with
# 2 node types: `user`, `item`
# 2 edge types: `user:like:item`, `user:follow:user`
# And each node/edge type has the same number of nodes/edges.
num_nodes = 1000
num_edges = 10 * num_nodes
# Edge type: "user:like:item"
like_edges_path = os.path.join(base_dir, "like-edges.csv")
like_edges = np.random.randint(0, num_nodes, size=(num_edges, 2))
print(f"Part of [user:like:item] edges: {like_edges[:5, :]}\n")
df = pd.DataFrame(like_edges)
df.to_csv(like_edges_path, index=False, header=False)
print(f"[user:like:item] edges are saved into {like_edges_path}\n")
# Edge type: "user:follow:user"
follow_edges_path = os.path.join(base_dir, "follow-edges.csv")
follow_edges = np.random.randint(0, num_nodes, size=(num_edges, 2))
print(f"Part of [user:follow:user] edges: {follow_edges[:5, :]}\n")
df = pd.DataFrame(follow_edges)
df.to_csv(follow_edges_path, index=False, header=False)
print(f"[user:follow:user] edges are saved into {follow_edges_path}\n")
Part of [user:like:item] edges: [[611 315]
[221 595]
[228 444]
[572 610]
[852 740]]
[user:like:item] edges are saved into ./ondisk_dataset_heterograph/like-edges.csv
Part of [user:follow:user] edges: [[657 157]
[922 328]
[141 41]
[914 806]
[561 509]]
[user:follow:user] edges are saved into ./ondisk_dataset_heterograph/follow-edges.csv
Generate feature data for graphο
For feature data, numpy arrays and torch tensors are supported for now. Letβs generate feature data for each node/edge type.
[4]:
# Generate node[user] feature in numpy array.
node_user_feat_0_path = os.path.join(base_dir, "node-user-feat-0.npy")
node_user_feat_0 = np.random.rand(num_nodes, 5)
print(f"Part of node[user] feature [feat_0]: {node_user_feat_0[:3, :]}")
np.save(node_user_feat_0_path, node_user_feat_0)
print(f"Node[user] feature [feat_0] is saved to {node_user_feat_0_path}\n")
# Generate another node[user] feature in torch tensor
node_user_feat_1_path = os.path.join(base_dir, "node-user-feat-1.pt")
node_user_feat_1 = torch.rand(num_nodes, 5)
print(f"Part of node[user] feature [feat_1]: {node_user_feat_1[:3, :]}")
torch.save(node_user_feat_1, node_user_feat_1_path)
print(f"Node[user] feature [feat_1] is saved to {node_user_feat_1_path}\n")
# Generate node[item] feature in numpy array.
node_item_feat_0_path = os.path.join(base_dir, "node-item-feat-0.npy")
node_item_feat_0 = np.random.rand(num_nodes, 5)
print(f"Part of node[item] feature [feat_0]: {node_item_feat_0[:3, :]}")
np.save(node_item_feat_0_path, node_item_feat_0)
print(f"Node[item] feature [feat_0] is saved to {node_item_feat_0_path}\n")
# Generate another node[item] feature in torch tensor
node_item_feat_1_path = os.path.join(base_dir, "node-item-feat-1.pt")
node_item_feat_1 = torch.rand(num_nodes, 5)
print(f"Part of node[item] feature [feat_1]: {node_item_feat_1[:3, :]}")
torch.save(node_item_feat_1, node_item_feat_1_path)
print(f"Node[item] feature [feat_1] is saved to {node_item_feat_1_path}\n")
# Generate edge[user:like:item] feature in numpy array.
edge_like_feat_0_path = os.path.join(base_dir, "edge-like-feat-0.npy")
edge_like_feat_0 = np.random.rand(num_edges, 5)
print(f"Part of edge[user:like:item] feature [feat_0]: {edge_like_feat_0[:3, :]}")
np.save(edge_like_feat_0_path, edge_like_feat_0)
print(f"Edge[user:like:item] feature [feat_0] is saved to {edge_like_feat_0_path}\n")
# Generate another edge[user:like:item] feature in torch tensor
edge_like_feat_1_path = os.path.join(base_dir, "edge-like-feat-1.pt")
edge_like_feat_1 = torch.rand(num_edges, 5)
print(f"Part of edge[user:like:item] feature [feat_1]: {edge_like_feat_1[:3, :]}")
torch.save(edge_like_feat_1, edge_like_feat_1_path)
print(f"Edge[user:like:item] feature [feat_1] is saved to {edge_like_feat_1_path}\n")
# Generate edge[user:follow:user] feature in numpy array.
edge_follow_feat_0_path = os.path.join(base_dir, "edge-follow-feat-0.npy")
edge_follow_feat_0 = np.random.rand(num_edges, 5)
print(f"Part of edge[user:follow:user] feature [feat_0]: {edge_follow_feat_0[:3, :]}")
np.save(edge_follow_feat_0_path, edge_follow_feat_0)
print(f"Edge[user:follow:user] feature [feat_0] is saved to {edge_follow_feat_0_path}\n")
# Generate another edge[user:follow:user] feature in torch tensor
edge_follow_feat_1_path = os.path.join(base_dir, "edge-follow-feat-1.pt")
edge_follow_feat_1 = torch.rand(num_edges, 5)
print(f"Part of edge[user:follow:user] feature [feat_1]: {edge_follow_feat_1[:3, :]}")
torch.save(edge_follow_feat_1, edge_follow_feat_1_path)
print(f"Edge[user:follow:user] feature [feat_1] is saved to {edge_follow_feat_1_path}\n")
Part of node[user] feature [feat_0]: [[0.31029529 0.76939773 0.86253023 0.10180554 0.97639388]
[0.58330258 0.86538892 0.33095151 0.34738833 0.12672927]
[0.31894488 0.28191157 0.1951335 0.6176331 0.4238241 ]]
Node[user] feature [feat_0] is saved to ./ondisk_dataset_heterograph/node-user-feat-0.npy
Part of node[user] feature [feat_1]: tensor([[0.1045, 0.7957, 0.6117, 0.9011, 0.3117],
[0.3086, 0.0020, 0.3306, 0.6672, 0.1924],
[0.8779, 0.2527, 0.4192, 0.0540, 0.2669]])
Node[user] feature [feat_1] is saved to ./ondisk_dataset_heterograph/node-user-feat-1.pt
Part of node[item] feature [feat_0]: [[0.87889889 0.7852822 0.10819262 0.81591011 0.80781404]
[0.20190583 0.2310996 0.63091941 0.82123329 0.68183098]
[0.62056908 0.63729061 0.91149333 0.07686129 0.37201902]]
Node[item] feature [feat_0] is saved to ./ondisk_dataset_heterograph/node-item-feat-0.npy
Part of node[item] feature [feat_1]: tensor([[0.4168, 0.7485, 0.6407, 0.8442, 0.2938],
[0.7859, 0.3260, 0.4767, 0.8423, 0.3778],
[0.7924, 0.4614, 0.3753, 0.9977, 0.3645]])
Node[item] feature [feat_1] is saved to ./ondisk_dataset_heterograph/node-item-feat-1.pt
Part of edge[user:like:item] feature [feat_0]: [[0.82491022 0.66672418 0.10540511 0.30503791 0.37950118]
[0.9269383 0.96153384 0.85979233 0.93523173 0.12174713]
[0.80610667 0.28225996 0.1508371 0.97257956 0.90533677]]
Edge[user:like:item] feature [feat_0] is saved to ./ondisk_dataset_heterograph/edge-like-feat-0.npy
Part of edge[user:like:item] feature [feat_1]: tensor([[0.0357, 0.2868, 0.5560, 0.5982, 0.4974],
[0.3080, 0.2024, 0.1633, 0.4725, 0.9675],
[0.5536, 0.3117, 0.5308, 0.0956, 0.5199]])
Edge[user:like:item] feature [feat_1] is saved to ./ondisk_dataset_heterograph/edge-like-feat-1.pt
Part of edge[user:follow:user] feature [feat_0]: [[0.4569769 0.66374582 0.32679242 0.41175467 0.51243346]
[0.0059584 0.45281173 0.36746983 0.0793982 0.30255418]
[0.23547879 0.68279714 0.6009931 0.41328117 0.03650759]]
Edge[user:follow:user] feature [feat_0] is saved to ./ondisk_dataset_heterograph/edge-follow-feat-0.npy
Part of edge[user:follow:user] feature [feat_1]: tensor([[0.5178, 0.9014, 0.9423, 0.7487, 0.8715],
[0.5569, 0.5531, 0.1457, 0.7525, 0.5563],
[0.1705, 0.0710, 0.6074, 0.4751, 0.6737]])
Edge[user:follow:user] feature [feat_1] is saved to ./ondisk_dataset_heterograph/edge-follow-feat-1.pt
Generate tasksο
OnDiskDataset
supports multiple tasks. For each task, we need to prepare training/validation/test sets respectively. Such sets usually vary among different tasks. In this tutorial, letβs create a Node Classification task and Link Prediction task.
Node Classification Taskο
For node classification task, we need node IDs and corresponding labels for each training/validation/test set. Like feature data, numpy arrays and torch tensors are supported for these sets.
[5]:
# For illustration, let's generate item sets for each node type.
num_trains = int(num_nodes * 0.6)
num_vals = int(num_nodes * 0.2)
num_tests = num_nodes - num_trains - num_vals
user_ids = np.arange(num_nodes)
np.random.shuffle(user_ids)
item_ids = np.arange(num_nodes)
np.random.shuffle(item_ids)
# Train IDs for user.
nc_train_user_ids_path = os.path.join(base_dir, "nc-train-user-ids.npy")
nc_train_user_ids = user_ids[:num_trains]
print(f"Part of train ids[user] for node classification: {nc_train_user_ids[:3]}")
np.save(nc_train_user_ids_path, nc_train_user_ids)
print(f"NC train ids[user] are saved to {nc_train_user_ids_path}\n")
# Train labels for user.
nc_train_user_labels_path = os.path.join(base_dir, "nc-train-user-labels.pt")
nc_train_user_labels = torch.randint(0, 10, (num_trains,))
print(f"Part of train labels[user] for node classification: {nc_train_user_labels[:3]}")
torch.save(nc_train_user_labels, nc_train_user_labels_path)
print(f"NC train labels[user] are saved to {nc_train_user_labels_path}\n")
# Train IDs for item.
nc_train_item_ids_path = os.path.join(base_dir, "nc-train-item-ids.npy")
nc_train_item_ids = item_ids[:num_trains]
print(f"Part of train ids[item] for node classification: {nc_train_item_ids[:3]}")
np.save(nc_train_item_ids_path, nc_train_item_ids)
print(f"NC train ids[item] are saved to {nc_train_item_ids_path}\n")
# Train labels for item.
nc_train_item_labels_path = os.path.join(base_dir, "nc-train-item-labels.pt")
nc_train_item_labels = torch.randint(0, 10, (num_trains,))
print(f"Part of train labels[item] for node classification: {nc_train_item_labels[:3]}")
torch.save(nc_train_item_labels, nc_train_item_labels_path)
print(f"NC train labels[item] are saved to {nc_train_item_labels_path}\n")
# Val IDs for user.
nc_val_user_ids_path = os.path.join(base_dir, "nc-val-user-ids.npy")
nc_val_user_ids = user_ids[num_trains:num_trains+num_vals]
print(f"Part of val ids[user] for node classification: {nc_val_user_ids[:3]}")
np.save(nc_val_user_ids_path, nc_val_user_ids)
print(f"NC val ids[user] are saved to {nc_val_user_ids_path}\n")
# Val labels for user.
nc_val_user_labels_path = os.path.join(base_dir, "nc-val-user-labels.pt")
nc_val_user_labels = torch.randint(0, 10, (num_vals,))
print(f"Part of val labels[user] for node classification: {nc_val_user_labels[:3]}")
torch.save(nc_val_user_labels, nc_val_user_labels_path)
print(f"NC val labels[user] are saved to {nc_val_user_labels_path}\n")
# Val IDs for item.
nc_val_item_ids_path = os.path.join(base_dir, "nc-val-item-ids.npy")
nc_val_item_ids = item_ids[num_trains:num_trains+num_vals]
print(f"Part of val ids[item] for node classification: {nc_val_item_ids[:3]}")
np.save(nc_val_item_ids_path, nc_val_item_ids)
print(f"NC val ids[item] are saved to {nc_val_item_ids_path}\n")
# Val labels for item.
nc_val_item_labels_path = os.path.join(base_dir, "nc-val-item-labels.pt")
nc_val_item_labels = torch.randint(0, 10, (num_vals,))
print(f"Part of val labels[item] for node classification: {nc_val_item_labels[:3]}")
torch.save(nc_val_item_labels, nc_val_item_labels_path)
print(f"NC val labels[item] are saved to {nc_val_item_labels_path}\n")
# Test IDs for user.
nc_test_user_ids_path = os.path.join(base_dir, "nc-test-user-ids.npy")
nc_test_user_ids = user_ids[-num_tests:]
print(f"Part of test ids[user] for node classification: {nc_test_user_ids[:3]}")
np.save(nc_test_user_ids_path, nc_test_user_ids)
print(f"NC test ids[user] are saved to {nc_test_user_ids_path}\n")
# Test labels for user.
nc_test_user_labels_path = os.path.join(base_dir, "nc-test-user-labels.pt")
nc_test_user_labels = torch.randint(0, 10, (num_tests,))
print(f"Part of test labels[user] for node classification: {nc_test_user_labels[:3]}")
torch.save(nc_test_user_labels, nc_test_user_labels_path)
print(f"NC test labels[user] are saved to {nc_test_user_labels_path}\n")
# Test IDs for item.
nc_test_item_ids_path = os.path.join(base_dir, "nc-test-item-ids.npy")
nc_test_item_ids = item_ids[-num_tests:]
print(f"Part of test ids[item] for node classification: {nc_test_item_ids[:3]}")
np.save(nc_test_item_ids_path, nc_test_item_ids)
print(f"NC test ids[item] are saved to {nc_test_item_ids_path}\n")
# Test labels for item.
nc_test_item_labels_path = os.path.join(base_dir, "nc-test-item-labels.pt")
nc_test_item_labels = torch.randint(0, 10, (num_tests,))
print(f"Part of test labels[item] for node classification: {nc_test_item_labels[:3]}")
torch.save(nc_test_item_labels, nc_test_item_labels_path)
print(f"NC test labels[item] are saved to {nc_test_item_labels_path}\n")
Part of train ids[user] for node classification: [147 306 330]
NC train ids[user] are saved to ./ondisk_dataset_heterograph/nc-train-user-ids.npy
Part of train labels[user] for node classification: tensor([1, 4, 3])
NC train labels[user] are saved to ./ondisk_dataset_heterograph/nc-train-user-labels.pt
Part of train ids[item] for node classification: [ 75 842 150]
NC train ids[item] are saved to ./ondisk_dataset_heterograph/nc-train-item-ids.npy
Part of train labels[item] for node classification: tensor([0, 8, 4])
NC train labels[item] are saved to ./ondisk_dataset_heterograph/nc-train-item-labels.pt
Part of val ids[user] for node classification: [703 551 801]
NC val ids[user] are saved to ./ondisk_dataset_heterograph/nc-val-user-ids.npy
Part of val labels[user] for node classification: tensor([3, 7, 4])
NC val labels[user] are saved to ./ondisk_dataset_heterograph/nc-val-user-labels.pt
Part of val ids[item] for node classification: [619 492 584]
NC val ids[item] are saved to ./ondisk_dataset_heterograph/nc-val-item-ids.npy
Part of val labels[item] for node classification: tensor([0, 0, 9])
NC val labels[item] are saved to ./ondisk_dataset_heterograph/nc-val-item-labels.pt
Part of test ids[user] for node classification: [ 97 370 540]
NC test ids[user] are saved to ./ondisk_dataset_heterograph/nc-test-user-ids.npy
Part of test labels[user] for node classification: tensor([6, 0, 7])
NC test labels[user] are saved to ./ondisk_dataset_heterograph/nc-test-user-labels.pt
Part of test ids[item] for node classification: [797 361 612]
NC test ids[item] are saved to ./ondisk_dataset_heterograph/nc-test-item-ids.npy
Part of test labels[item] for node classification: tensor([4, 7, 2])
NC test labels[item] are saved to ./ondisk_dataset_heterograph/nc-test-item-labels.pt
Link Prediction Taskο
For link prediction task, we need node pairs or negative src/dsts for each training/validation/test set. Like feature data, numpy arrays and torch tensors are supported for these sets.
[6]:
# For illustration, let's generate item sets for each edge type.
num_trains = int(num_edges * 0.6)
num_vals = int(num_edges * 0.2)
num_tests = num_edges - num_trains - num_vals
# Train node pairs for user:like:item.
lp_train_like_node_pairs_path = os.path.join(base_dir, "lp-train-like-node-pairs.npy")
lp_train_like_node_pairs = like_edges[:num_trains, :]
print(f"Part of train node pairs[user:like:item] for link prediction: {lp_train_like_node_pairs[:3]}")
np.save(lp_train_like_node_pairs_path, lp_train_like_node_pairs)
print(f"LP train node pairs[user:like:item] are saved to {lp_train_like_node_pairs_path}\n")
# Train node pairs for user:follow:user.
lp_train_follow_node_pairs_path = os.path.join(base_dir, "lp-train-follow-node-pairs.npy")
lp_train_follow_node_pairs = follow_edges[:num_trains, :]
print(f"Part of train node pairs[user:follow:user] for link prediction: {lp_train_follow_node_pairs[:3]}")
np.save(lp_train_follow_node_pairs_path, lp_train_follow_node_pairs)
print(f"LP train node pairs[user:follow:user] are saved to {lp_train_follow_node_pairs_path}\n")
# Val node pairs for user:like:item.
lp_val_like_node_pairs_path = os.path.join(base_dir, "lp-val-like-node-pairs.npy")
lp_val_like_node_pairs = like_edges[num_trains:num_trains+num_vals, :]
print(f"Part of val node pairs[user:like:item] for link prediction: {lp_val_like_node_pairs[:3]}")
np.save(lp_val_like_node_pairs_path, lp_val_like_node_pairs)
print(f"LP val node pairs[user:like:item] are saved to {lp_val_like_node_pairs_path}\n")
# Val negative dsts for user:like:item.
lp_val_like_neg_dsts_path = os.path.join(base_dir, "lp-val-like-neg-dsts.pt")
lp_val_like_neg_dsts = torch.randint(0, num_nodes, (num_vals, 10))
print(f"Part of val negative dsts[user:like:item] for link prediction: {lp_val_like_neg_dsts[:3]}")
torch.save(lp_val_like_neg_dsts, lp_val_like_neg_dsts_path)
print(f"LP val negative dsts[user:like:item] are saved to {lp_val_like_neg_dsts_path}\n")
# Val node pairs for user:follow:user.
lp_val_follow_node_pairs_path = os.path.join(base_dir, "lp-val-follow-node-pairs.npy")
lp_val_follow_node_pairs = follow_edges[num_trains:num_trains+num_vals, :]
print(f"Part of val node pairs[user:follow:user] for link prediction: {lp_val_follow_node_pairs[:3]}")
np.save(lp_val_follow_node_pairs_path, lp_val_follow_node_pairs)
print(f"LP val node pairs[user:follow:user] are saved to {lp_val_follow_node_pairs_path}\n")
# Val negative dsts for user:follow:user.
lp_val_follow_neg_dsts_path = os.path.join(base_dir, "lp-val-follow-neg-dsts.pt")
lp_val_follow_neg_dsts = torch.randint(0, num_nodes, (num_vals, 10))
print(f"Part of val negative dsts[user:follow:user] for link prediction: {lp_val_follow_neg_dsts[:3]}")
torch.save(lp_val_follow_neg_dsts, lp_val_follow_neg_dsts_path)
print(f"LP val negative dsts[user:follow:user] are saved to {lp_val_follow_neg_dsts_path}\n")
# Test node paris for user:like:item.
lp_test_like_node_pairs_path = os.path.join(base_dir, "lp-test-like-node-pairs.npy")
lp_test_like_node_pairs = like_edges[-num_tests, :]
print(f"Part of test node pairs[user:like:item] for link prediction: {lp_test_like_node_pairs[:3]}")
np.save(lp_test_like_node_pairs_path, lp_test_like_node_pairs)
print(f"LP test node pairs[user:like:item] are saved to {lp_test_like_node_pairs_path}\n")
# Test negative dsts for user:like:item.
lp_test_like_neg_dsts_path = os.path.join(base_dir, "lp-test-like-neg-dsts.pt")
lp_test_like_neg_dsts = torch.randint(0, num_nodes, (num_tests, 10))
print(f"Part of test negative dsts[user:like:item] for link prediction: {lp_test_like_neg_dsts[:3]}")
torch.save(lp_test_like_neg_dsts, lp_test_like_neg_dsts_path)
print(f"LP test negative dsts[user:like:item] are saved to {lp_test_like_neg_dsts_path}\n")
# Test node paris for user:follow:user.
lp_test_follow_node_pairs_path = os.path.join(base_dir, "lp-test-follow-node-pairs.npy")
lp_test_follow_node_pairs = follow_edges[-num_tests, :]
print(f"Part of test node pairs[user:follow:user] for link prediction: {lp_test_follow_node_pairs[:3]}")
np.save(lp_test_follow_node_pairs_path, lp_test_follow_node_pairs)
print(f"LP test node pairs[user:follow:user] are saved to {lp_test_follow_node_pairs_path}\n")
# Test negative dsts for user:follow:user.
lp_test_follow_neg_dsts_path = os.path.join(base_dir, "lp-test-follow-neg-dsts.pt")
lp_test_follow_neg_dsts = torch.randint(0, num_nodes, (num_tests, 10))
print(f"Part of test negative dsts[user:follow:user] for link prediction: {lp_test_follow_neg_dsts[:3]}")
torch.save(lp_test_follow_neg_dsts, lp_test_follow_neg_dsts_path)
print(f"LP test negative dsts[user:follow:user] are saved to {lp_test_follow_neg_dsts_path}\n")
Part of train node pairs[user:like:item] for link prediction: [[611 315]
[221 595]
[228 444]]
LP train node pairs[user:like:item] are saved to ./ondisk_dataset_heterograph/lp-train-like-node-pairs.npy
Part of train node pairs[user:follow:user] for link prediction: [[657 157]
[922 328]
[141 41]]
LP train node pairs[user:follow:user] are saved to ./ondisk_dataset_heterograph/lp-train-follow-node-pairs.npy
Part of val node pairs[user:like:item] for link prediction: [[755 622]
[738 623]
[558 309]]
LP val node pairs[user:like:item] are saved to ./ondisk_dataset_heterograph/lp-val-like-node-pairs.npy
Part of val negative dsts[user:like:item] for link prediction: tensor([[255, 99, 35, 32, 441, 810, 797, 279, 942, 410],
[184, 487, 530, 95, 363, 174, 728, 884, 482, 674],
[638, 273, 739, 770, 479, 764, 398, 661, 234, 9]])
LP val negative dsts[user:like:item] are saved to ./ondisk_dataset_heterograph/lp-val-like-neg-dsts.pt
Part of val node pairs[user:follow:user] for link prediction: [[579 232]
[916 105]
[524 559]]
LP val node pairs[user:follow:user] are saved to ./ondisk_dataset_heterograph/lp-val-follow-node-pairs.npy
Part of val negative dsts[user:follow:user] for link prediction: tensor([[145, 446, 650, 243, 744, 177, 498, 875, 221, 290],
[590, 126, 218, 33, 146, 373, 960, 5, 447, 230],
[375, 645, 490, 149, 449, 451, 341, 107, 568, 956]])
LP val negative dsts[user:follow:user] are saved to ./ondisk_dataset_heterograph/lp-val-follow-neg-dsts.pt
Part of test node pairs[user:like:item] for link prediction: [674 480]
LP test node pairs[user:like:item] are saved to ./ondisk_dataset_heterograph/lp-test-like-node-pairs.npy
Part of test negative dsts[user:like:item] for link prediction: tensor([[756, 175, 247, 474, 643, 910, 509, 220, 718, 578],
[411, 26, 407, 809, 276, 120, 156, 65, 179, 74],
[680, 927, 303, 348, 120, 921, 318, 605, 171, 308]])
LP test negative dsts[user:like:item] are saved to ./ondisk_dataset_heterograph/lp-test-like-neg-dsts.pt
Part of test node pairs[user:follow:user] for link prediction: [565 314]
LP test node pairs[user:follow:user] are saved to ./ondisk_dataset_heterograph/lp-test-follow-node-pairs.npy
Part of test negative dsts[user:follow:user] for link prediction: tensor([[276, 385, 878, 206, 381, 330, 682, 133, 289, 407],
[341, 6, 85, 38, 98, 894, 620, 719, 810, 272],
[993, 833, 56, 961, 32, 329, 348, 541, 158, 322]])
LP test negative dsts[user:follow:user] are saved to ./ondisk_dataset_heterograph/lp-test-follow-neg-dsts.pt
Organize Data into YAML Fileο
Now we need to create a metadata.yaml
file which contains the paths, dadta types of graph structure, feature data, training/validation/test sets. Please note that all path should be relative to metadata.yaml
.
For heterogeneous graph, we need to specify the node/edge type in type fields. For edge type, canonical etype is required which is a string thatβs concatenated by source node type, etype, and destination node type together with :
.
Notes: - all path should be relative to metadata.yaml
. - Below fields are optional and not specified in below example. - in_memory
: indicates whether to load dada into memory or mmap
. Default is True
.
Please refer to YAML specification for more details.
[7]:
yaml_content = f"""
dataset_name: heterogeneous_graph_nc_lp
graph:
nodes:
- type: user
num: {num_nodes}
- type: item
num: {num_nodes}
edges:
- type: "user:like:item"
format: csv
path: {os.path.basename(like_edges_path)}
- type: "user:follow:user"
format: csv
path: {os.path.basename(follow_edges_path)}
feature_data:
- domain: node
type: user
name: feat_0
format: numpy
path: {os.path.basename(node_user_feat_0_path)}
- domain: node
type: user
name: feat_1
format: torch
path: {os.path.basename(node_user_feat_1_path)}
- domain: node
type: item
name: feat_0
format: numpy
path: {os.path.basename(node_item_feat_0_path)}
- domain: node
type: item
name: feat_1
format: torch
path: {os.path.basename(node_item_feat_1_path)}
- domain: edge
type: "user:like:item"
name: feat_0
format: numpy
path: {os.path.basename(edge_like_feat_0_path)}
- domain: edge
type: "user:like:item"
name: feat_1
format: torch
path: {os.path.basename(edge_like_feat_1_path)}
- domain: edge
type: "user:follow:user"
name: feat_0
format: numpy
path: {os.path.basename(edge_follow_feat_0_path)}
- domain: edge
type: "user:follow:user"
name: feat_1
format: torch
path: {os.path.basename(edge_follow_feat_1_path)}
tasks:
- name: node_classification
num_classes: 10
train_set:
- type: user
data:
- name: seed_nodes
format: numpy
path: {os.path.basename(nc_train_user_ids_path)}
- name: labels
format: torch
path: {os.path.basename(nc_train_user_labels_path)}
- type: item
data:
- name: seed_nodes
format: numpy
path: {os.path.basename(nc_train_item_ids_path)}
- name: labels
format: torch
path: {os.path.basename(nc_train_item_labels_path)}
validation_set:
- type: user
data:
- name: seed_nodes
format: numpy
path: {os.path.basename(nc_val_user_ids_path)}
- name: labels
format: torch
path: {os.path.basename(nc_val_user_labels_path)}
- type: item
data:
- name: seed_nodes
format: numpy
path: {os.path.basename(nc_val_item_ids_path)}
- name: labels
format: torch
path: {os.path.basename(nc_val_item_labels_path)}
test_set:
- type: user
data:
- name: seed_nodes
format: numpy
path: {os.path.basename(nc_test_user_ids_path)}
- name: labels
format: torch
path: {os.path.basename(nc_test_user_labels_path)}
- type: item
data:
- name: seed_nodes
format: numpy
path: {os.path.basename(nc_test_item_ids_path)}
- name: labels
format: torch
path: {os.path.basename(nc_test_item_labels_path)}
- name: link_prediction
num_classes: 10
train_set:
- type: "user:like:item"
data:
- name: node_pairs
format: numpy
path: {os.path.basename(lp_train_like_node_pairs_path)}
- type: "user:follow:user"
data:
- name: node_pairs
format: numpy
path: {os.path.basename(lp_train_follow_node_pairs_path)}
validation_set:
- type: "user:like:item"
data:
- name: node_pairs
format: numpy
path: {os.path.basename(lp_val_like_node_pairs_path)}
- name: negative_dsts
format: torch
path: {os.path.basename(lp_val_like_neg_dsts_path)}
- type: "user:follow:user"
data:
- name: node_pairs
format: numpy
path: {os.path.basename(lp_val_follow_node_pairs_path)}
- name: negative_dsts
format: torch
path: {os.path.basename(lp_val_follow_neg_dsts_path)}
test_set:
- type: "user:like:item"
data:
- name: node_pairs
format: numpy
path: {os.path.basename(lp_test_like_node_pairs_path)}
- name: negative_dsts
format: torch
path: {os.path.basename(lp_test_like_neg_dsts_path)}
- type: "user:follow:user"
data:
- name: node_pairs
format: numpy
path: {os.path.basename(lp_test_follow_node_pairs_path)}
- name: negative_dsts
format: torch
path: {os.path.basename(lp_test_follow_neg_dsts_path)}
"""
metadata_path = os.path.join(base_dir, "metadata.yaml")
with open(metadata_path, "w") as f:
f.write(yaml_content)
Instantiate OnDiskDataset
ο
Now weβre ready to load dataset via dgl.graphbolt.OnDiskDataset
. When instantiating, we just pass in the base directory where metadata.yaml
file lies.
During first instantiation, GraphBolt preprocesses the raw data such as constructing FusedCSCSamplingGraph
from edges. All data including graph, feature data, training/validation/test sets are put into preprocessed
directory after preprocessing. Any following dataset loading will skip the preprocess stage.
After preprocessing, load()
is required to be called explicitly in order to load graph, feature data and tasks.
[8]:
dataset = gb.OnDiskDataset(base_dir).load()
graph = dataset.graph
print(f"Loaded graph: {graph}\n")
feature = dataset.feature
print(f"Loaded feature store: {feature}\n")
tasks = dataset.tasks
nc_task = tasks[0]
print(f"Loaded node classification task: {nc_task}\n")
lp_task = tasks[1]
print(f"Loaded link prediction task: {lp_task}\n")
Start to preprocess the on-disk dataset.
Finish preprocessing the on-disk dataset.
Loaded graph: FusedCSCSamplingGraph(csc_indptr=tensor([ 0, 12, 20, ..., 19982, 19988, 20000], dtype=torch.int32),
indices=tensor([1410, 1054, 1267, ..., 1410, 1047, 1953], dtype=torch.int32),
total_num_nodes=2000, num_edges={'user:follow:user': 10000, 'user:like:item': 10000},
node_type_offset=tensor([ 0, 1000, 2000], dtype=torch.int32),
type_per_edge=tensor([1, 1, 1, ..., 0, 0, 0], dtype=torch.uint8),
node_type_to_id={'item': 0, 'user': 1},
edge_type_to_id={'user:follow:user': 0, 'user:like:item': 1},)
Loaded feature store: TorchBasedFeatureStore(
{(<OnDiskFeatureDataDomain.NODE: 'node'>, 'user', 'feat_0'): TorchBasedFeature(
feature=tensor([[0.3103, 0.7694, 0.8625, 0.1018, 0.9764],
[0.5833, 0.8654, 0.3310, 0.3474, 0.1267],
[0.3189, 0.2819, 0.1951, 0.6176, 0.4238],
...,
[0.9105, 0.4883, 0.9886, 0.5891, 0.9580],
[0.7452, 0.0454, 0.6262, 0.1252, 0.4608],
[0.4461, 0.5210, 0.6961, 0.2792, 0.9526]], dtype=torch.float64),
metadata={},
), (<OnDiskFeatureDataDomain.NODE: 'node'>, 'user', 'feat_1'): TorchBasedFeature(
feature=tensor([[0.1045, 0.7957, 0.6117, 0.9011, 0.3117],
[0.3086, 0.0020, 0.3306, 0.6672, 0.1924],
[0.8779, 0.2527, 0.4192, 0.0540, 0.2669],
...,
[0.8638, 0.7662, 0.5526, 0.6774, 0.8078],
[0.6080, 0.1280, 0.3153, 0.2283, 0.3758],
[0.4925, 0.8680, 0.5731, 0.0334, 0.5362]]),
metadata={},
), (<OnDiskFeatureDataDomain.NODE: 'node'>, 'item', 'feat_0'): TorchBasedFeature(
feature=tensor([[0.8789, 0.7853, 0.1082, 0.8159, 0.8078],
[0.2019, 0.2311, 0.6309, 0.8212, 0.6818],
[0.6206, 0.6373, 0.9115, 0.0769, 0.3720],
...,
[0.2772, 0.1169, 0.1312, 0.6544, 0.9301],
[0.8961, 0.9702, 0.9103, 0.6076, 0.7310],
[0.0367, 0.2918, 0.4366, 0.9263, 0.2355]], dtype=torch.float64),
metadata={},
), (<OnDiskFeatureDataDomain.NODE: 'node'>, 'item', 'feat_1'): TorchBasedFeature(
feature=tensor([[0.4168, 0.7485, 0.6407, 0.8442, 0.2938],
[0.7859, 0.3260, 0.4767, 0.8423, 0.3778],
[0.7924, 0.4614, 0.3753, 0.9977, 0.3645],
...,
[0.3171, 0.5080, 0.8837, 0.1130, 0.5401],
[0.1685, 0.8228, 0.2052, 0.9037, 0.9133],
[0.1690, 0.4715, 0.5522, 0.5094, 0.6512]]),
metadata={},
), (<OnDiskFeatureDataDomain.EDGE: 'edge'>, 'user:like:item', 'feat_0'): TorchBasedFeature(
feature=tensor([[0.8249, 0.6667, 0.1054, 0.3050, 0.3795],
[0.9269, 0.9615, 0.8598, 0.9352, 0.1217],
[0.8061, 0.2823, 0.1508, 0.9726, 0.9053],
...,
[0.1344, 0.8607, 0.6676, 0.7351, 0.5839],
[0.7632, 0.0621, 0.3317, 0.0085, 0.4914],
[0.5484, 0.7921, 0.2345, 0.3059, 0.7179]], dtype=torch.float64),
metadata={},
), (<OnDiskFeatureDataDomain.EDGE: 'edge'>, 'user:like:item', 'feat_1'): TorchBasedFeature(
feature=tensor([[0.0357, 0.2868, 0.5560, 0.5982, 0.4974],
[0.3080, 0.2024, 0.1633, 0.4725, 0.9675],
[0.5536, 0.3117, 0.5308, 0.0956, 0.5199],
...,
[0.7382, 0.3758, 0.3215, 0.8395, 0.3613],
[0.8576, 0.5830, 0.9153, 0.7353, 0.3347],
[0.4978, 0.6863, 0.6784, 0.6586, 0.4231]]),
metadata={},
), (<OnDiskFeatureDataDomain.EDGE: 'edge'>, 'user:follow:user', 'feat_0'): TorchBasedFeature(
feature=tensor([[0.4570, 0.6637, 0.3268, 0.4118, 0.5124],
[0.0060, 0.4528, 0.3675, 0.0794, 0.3026],
[0.2355, 0.6828, 0.6010, 0.4133, 0.0365],
...,
[0.8681, 0.5339, 0.8088, 0.8476, 0.6196],
[0.5416, 0.1146, 0.1107, 0.8683, 0.2304],
[0.2678, 0.0448, 0.5394, 0.5319, 0.3811]], dtype=torch.float64),
metadata={},
), (<OnDiskFeatureDataDomain.EDGE: 'edge'>, 'user:follow:user', 'feat_1'): TorchBasedFeature(
feature=tensor([[0.5178, 0.9014, 0.9423, 0.7487, 0.8715],
[0.5569, 0.5531, 0.1457, 0.7525, 0.5563],
[0.1705, 0.0710, 0.6074, 0.4751, 0.6737],
...,
[0.9686, 0.3390, 0.3946, 0.6231, 0.6062],
[0.6570, 0.0961, 0.3738, 0.9357, 0.7936],
[0.4014, 0.1495, 0.7442, 0.3822, 0.6350]]),
metadata={},
)}
)
Loaded node classification task: OnDiskTask(validation_set=ItemSetDict(
itemsets={'user': ItemSet(
items=(tensor([703, 551, 801, 62, 976, 236, 756, 253, 687, 997, 612, 276, 744, 843,
614, 858, 472, 814, 563, 244, 831, 971, 39, 697, 201, 777, 822, 435,
267, 398, 926, 395, 748, 555, 72, 11, 616, 79, 652, 452, 313, 265,
763, 111, 423, 676, 9, 416, 36, 73, 624, 501, 64, 314, 215, 102,
632, 328, 469, 509, 53, 149, 173, 353, 301, 937, 105, 26, 440, 129,
947, 887, 686, 350, 754, 909, 512, 450, 28, 854, 723, 419, 644, 455,
295, 795, 996, 33, 580, 538, 210, 583, 613, 207, 521, 721, 558, 654,
975, 269, 794, 367, 753, 461, 261, 622, 486, 714, 468, 43, 41, 966,
30, 70, 351, 5, 489, 700, 372, 178, 336, 827, 746, 502, 651, 10,
99, 670, 237, 824, 696, 811, 58, 410, 943, 430, 323, 987, 808, 198,
956, 905, 768, 286, 672, 641, 860, 280, 552, 900, 312, 96, 605, 399,
856, 94, 163, 867, 361, 24, 792, 699, 845, 920, 667, 782, 258, 406,
254, 634, 327, 339, 176, 844, 411, 821, 993, 485, 23, 103, 355, 429,
473, 872, 713, 984, 904, 829, 82, 349, 695, 842, 665, 835, 701, 151,
277, 432, 436, 172], dtype=torch.int32), tensor([3, 7, 4, 1, 1, 2, 3, 3, 5, 7, 7, 7, 9, 8, 0, 4, 5, 9, 9, 7, 8, 0, 2, 2,
3, 2, 8, 2, 3, 8, 0, 2, 6, 7, 9, 2, 5, 1, 4, 6, 3, 1, 2, 9, 7, 2, 1, 1,
1, 1, 3, 5, 8, 0, 9, 9, 0, 6, 7, 7, 6, 6, 5, 5, 2, 8, 5, 7, 7, 5, 3, 9,
3, 3, 4, 0, 2, 1, 1, 5, 1, 1, 1, 9, 6, 7, 1, 6, 7, 0, 6, 3, 9, 0, 3, 4,
0, 2, 2, 2, 0, 3, 6, 7, 1, 5, 2, 6, 2, 8, 6, 7, 1, 9, 9, 9, 5, 3, 4, 6,
0, 0, 0, 7, 5, 8, 3, 0, 7, 3, 5, 2, 6, 4, 7, 2, 1, 4, 3, 0, 9, 3, 8, 5,
7, 7, 9, 1, 2, 1, 1, 1, 0, 7, 4, 9, 9, 5, 1, 8, 3, 4, 6, 1, 8, 9, 1, 2,
0, 4, 4, 6, 1, 1, 4, 6, 4, 2, 5, 8, 3, 6, 6, 2, 3, 1, 1, 5, 5, 7, 4, 4,
9, 6, 9, 6, 9, 6, 7, 0])),
names=('seed_nodes', 'labels'),
), 'item': ItemSet(
items=(tensor([619, 492, 584, 173, 917, 6, 59, 364, 828, 371, 307, 703, 241, 377,
853, 624, 48, 679, 761, 751, 345, 310, 882, 317, 539, 203, 38, 372,
351, 154, 214, 267, 98, 996, 841, 998, 857, 468, 96, 655, 506, 592,
667, 920, 314, 899, 493, 54, 885, 704, 260, 113, 186, 45, 652, 335,
968, 880, 887, 641, 73, 536, 976, 870, 924, 294, 147, 121, 618, 482,
969, 495, 9, 27, 189, 663, 776, 783, 713, 124, 63, 681, 399, 665,
874, 338, 76, 738, 141, 86, 590, 143, 225, 11, 545, 498, 82, 606,
512, 963, 731, 461, 613, 330, 501, 462, 794, 696, 510, 823, 758, 320,
104, 790, 131, 210, 865, 546, 171, 987, 631, 639, 602, 812, 344, 303,
645, 918, 184, 683, 666, 163, 847, 766, 781, 835, 285, 511, 134, 20,
609, 576, 499, 878, 229, 252, 616, 340, 788, 286, 907, 370, 881, 178,
31, 862, 430, 795, 250, 538, 70, 671, 191, 674, 185, 249, 273, 41,
577, 695, 879, 8, 470, 22, 115, 557, 325, 830, 959, 906, 448, 628,
700, 816, 567, 623, 192, 389, 146, 894, 348, 25, 478, 594, 559, 910,
873, 421, 966, 832], dtype=torch.int32), tensor([0, 0, 9, 7, 0, 9, 3, 6, 2, 4, 1, 0, 6, 3, 9, 2, 5, 6, 8, 0, 4, 4, 6, 0,
4, 6, 1, 9, 6, 4, 5, 0, 0, 6, 5, 5, 1, 4, 2, 9, 2, 0, 7, 1, 1, 1, 5, 8,
5, 4, 8, 1, 7, 3, 6, 3, 2, 0, 8, 8, 1, 8, 7, 5, 0, 2, 6, 9, 9, 3, 6, 9,
0, 6, 2, 4, 4, 4, 6, 2, 1, 9, 2, 9, 6, 8, 8, 0, 5, 4, 3, 8, 4, 0, 5, 5,
2, 2, 6, 9, 5, 1, 6, 7, 4, 0, 0, 1, 8, 4, 6, 3, 6, 3, 9, 8, 4, 3, 0, 5,
0, 9, 0, 7, 6, 8, 4, 4, 9, 6, 3, 0, 2, 6, 1, 4, 3, 8, 7, 5, 8, 3, 3, 5,
7, 8, 5, 3, 6, 2, 9, 3, 8, 3, 4, 7, 9, 9, 3, 0, 1, 0, 1, 7, 0, 6, 0, 5,
1, 1, 1, 4, 2, 4, 8, 5, 0, 7, 8, 5, 9, 9, 6, 8, 9, 2, 1, 4, 5, 0, 3, 2,
8, 6, 4, 9, 9, 4, 7, 3])),
names=('seed_nodes', 'labels'),
)},
names=('seed_nodes', 'labels'),
),
train_set=ItemSetDict(
itemsets={'user': ItemSet(
items=(tensor([147, 306, 330, 647, 335, 974, 332, 589, 208, 861, 405, 569, 684, 539,
610, 247, 940, 544, 994, 368, 673, 585, 59, 837, 707, 104, 968, 141,
505, 249, 365, 164, 635, 199, 433, 214, 953, 195, 273, 56, 88, 581,
271, 359, 412, 884, 348, 846, 520, 125, 250, 880, 235, 319, 750, 659,
582, 288, 730, 69, 17, 833, 693, 751, 516, 246, 181, 849, 421, 7,
819, 45, 248, 143, 87, 649, 114, 371, 619, 712, 445, 885, 31, 347,
668, 376, 678, 557, 879, 490, 57, 537, 44, 413, 531, 838, 877, 682,
741, 342, 902, 630, 749, 526, 93, 451, 414, 206, 881, 278, 281, 815,
882, 240, 862, 889, 717, 571, 946, 574, 16, 710, 718, 796, 800, 424,
952, 434, 263, 601, 417, 221, 27, 479, 986, 806, 692, 762, 192, 503,
179, 287, 702, 803, 438, 186, 341, 202, 534, 140, 615, 690, 219, 595,
35, 363, 611, 963, 873, 448, 969, 893, 839, 12, 912, 752, 779, 991,
217, 38, 311, 739, 146, 491, 529, 863, 998, 981, 648, 388, 2, 722,
356, 919, 928, 227, 617, 608, 636, 527, 832, 868, 875, 628, 584, 157,
681, 71, 171, 118, 268, 4, 400, 318, 51, 130, 285, 134, 289, 19,
259, 804, 514, 74, 65, 533, 892, 724, 915, 573, 77, 669, 304, 554,
553, 983, 793, 498, 196, 510, 786, 992, 995, 955, 709, 866, 387, 851,
869, 226, 725, 115, 110, 715, 586, 0, 830, 119, 482, 408, 283, 212,
790, 425, 637, 316, 90, 37, 494, 504, 109, 694, 607, 393, 142, 322,
758, 541, 908, 307, 918, 467, 232, 175, 954, 231, 309, 492, 197, 935,
865, 747, 78, 106, 329, 383, 392, 903, 706, 13, 185, 530, 471, 296,
934, 592, 144, 565, 158, 373, 708, 820, 135, 6, 705, 1, 298, 960,
14, 270, 924, 274, 132, 850, 124, 760, 590, 366, 480, 404, 726, 466,
639, 168, 688, 241, 523, 239, 891, 187, 191, 716, 459, 456, 978, 131,
167, 857, 848, 525, 75, 737, 506, 230, 602, 591, 224, 294, 211, 220,
508, 282, 364, 519, 911, 876, 548, 152, 47, 374, 588, 326, 765, 358,
772, 578, 354, 789, 810, 165, 826, 407, 633, 381, 89, 643, 797, 871,
985, 536, 874, 180, 174, 484, 834, 3, 780, 656, 145, 112, 609, 256,
719, 922, 664, 517, 390, 823, 618, 840, 333, 597, 42, 738, 137, 507,
266, 127, 809, 177, 218, 343, 625, 108, 662, 474, 48, 761, 420, 225,
21, 291, 899, 950, 148, 720, 345, 543, 444, 883, 272, 896, 80, 101,
495, 906, 528, 798, 859, 150, 40, 742, 666, 305, 958, 836, 816, 518,
847, 302, 898, 661, 462, 161, 488, 386, 162, 733, 962, 257, 245, 61,
561, 980, 443, 572, 767, 757, 222, 698, 18, 255, 20, 728, 403, 564,
401, 600, 929, 638, 547, 870, 653, 841, 704, 76, 465, 677, 120, 55,
895, 320, 68, 818, 982, 776, 415, 788, 817, 500, 942, 914, 340, 446,
556, 771, 897, 209, 970, 86, 478, 315, 389, 190, 570, 442, 901, 894,
925, 378, 549, 95, 542, 418, 344, 121, 627, 535, 464, 948, 812, 34,
576, 170, 375, 233, 470, 941, 932, 685, 338, 337, 497, 923, 766, 587,
369, 938, 334, 852, 380, 778, 642, 743, 566, 136, 133, 620, 545, 957,
629, 888, 855, 513, 933, 460, 939, 205, 774, 54, 15, 791, 631, 977,
260, 660, 550, 453, 979, 139, 49, 575, 964, 691, 203, 735, 577, 67,
799, 579, 308, 773, 310, 385, 784, 439, 188, 293, 66, 731],
dtype=torch.int32), tensor([1, 4, 3, 8, 6, 9, 2, 5, 0, 5, 5, 1, 5, 5, 7, 5, 3, 6, 2, 4, 7, 1, 0, 5,
5, 3, 5, 4, 4, 0, 5, 1, 0, 0, 7, 2, 5, 9, 0, 4, 4, 6, 4, 5, 4, 7, 4, 7,
7, 0, 6, 6, 8, 8, 6, 9, 4, 8, 7, 8, 0, 4, 0, 5, 7, 3, 0, 7, 1, 1, 4, 9,
0, 3, 6, 6, 3, 8, 7, 5, 3, 9, 8, 0, 2, 9, 0, 5, 6, 1, 5, 1, 2, 2, 2, 7,
9, 5, 2, 6, 9, 2, 3, 1, 0, 4, 5, 5, 8, 5, 4, 9, 0, 6, 7, 7, 8, 5, 3, 6,
8, 3, 5, 2, 1, 8, 0, 0, 2, 6, 8, 4, 2, 4, 1, 1, 5, 8, 6, 5, 5, 6, 5, 1,
1, 4, 2, 1, 1, 1, 8, 2, 2, 8, 3, 8, 2, 9, 1, 0, 0, 4, 7, 8, 2, 1, 1, 9,
3, 7, 6, 6, 7, 3, 9, 7, 6, 0, 0, 3, 8, 7, 9, 8, 2, 1, 9, 7, 3, 8, 1, 8,
5, 5, 1, 2, 0, 7, 7, 1, 1, 4, 3, 3, 1, 9, 3, 9, 6, 7, 8, 2, 1, 7, 9, 5,
7, 8, 5, 2, 3, 9, 5, 7, 6, 4, 4, 1, 3, 1, 8, 9, 7, 1, 3, 5, 1, 8, 7, 1,
9, 6, 0, 5, 1, 3, 3, 2, 1, 4, 2, 8, 1, 0, 6, 9, 6, 9, 8, 9, 0, 9, 5, 2,
6, 4, 7, 8, 9, 7, 0, 1, 0, 1, 7, 9, 2, 3, 6, 3, 6, 2, 4, 3, 4, 0, 3, 4,
3, 8, 9, 3, 4, 9, 4, 5, 1, 4, 6, 3, 0, 1, 1, 1, 5, 4, 3, 7, 9, 3, 8, 4,
6, 5, 9, 0, 3, 8, 7, 9, 0, 6, 7, 5, 9, 0, 7, 0, 9, 5, 8, 3, 7, 0, 8, 2,
1, 8, 3, 2, 4, 0, 2, 4, 8, 1, 7, 1, 8, 9, 1, 5, 2, 3, 3, 8, 8, 2, 7, 6,
1, 9, 2, 0, 8, 4, 0, 2, 1, 6, 0, 8, 1, 5, 6, 8, 3, 3, 5, 7, 6, 9, 4, 0,
7, 5, 9, 8, 7, 0, 7, 8, 5, 6, 4, 0, 0, 8, 6, 1, 9, 6, 9, 4, 7, 9, 4, 4,
4, 6, 5, 5, 0, 9, 0, 0, 5, 0, 1, 9, 9, 4, 3, 6, 2, 0, 8, 1, 2, 4, 9, 6,
9, 5, 7, 9, 5, 1, 6, 4, 4, 7, 5, 6, 4, 1, 0, 6, 4, 8, 1, 9, 2, 5, 4, 5,
3, 5, 7, 0, 1, 4, 7, 4, 8, 1, 9, 8, 8, 2, 3, 4, 1, 8, 3, 1, 4, 2, 5, 7,
4, 1, 4, 9, 5, 6, 8, 1, 4, 4, 7, 0, 8, 1, 5, 5, 5, 5, 5, 9, 9, 8, 7, 8,
4, 4, 7, 1, 2, 9, 8, 4, 3, 4, 6, 6, 4, 0, 0, 2, 3, 2, 5, 2, 2, 4, 6, 2,
5, 3, 0, 4, 9, 3, 0, 3, 6, 4, 4, 5, 4, 8, 5, 8, 2, 9, 5, 7, 8, 1, 9, 3,
4, 2, 4, 3, 2, 8, 1, 4, 0, 5, 3, 8, 7, 6, 6, 3, 0, 7, 7, 5, 8, 2, 8, 8,
6, 4, 1, 1, 0, 0, 9, 4, 8, 0, 2, 6, 1, 0, 6, 7, 8, 8, 4, 2, 7, 0, 3, 9])),
names=('seed_nodes', 'labels'),
), 'item': ItemSet(
items=(tensor([ 75, 842, 150, 923, 604, 77, 405, 542, 503, 301, 459, 258, 406, 19,
749, 893, 142, 802, 363, 116, 159, 122, 942, 34, 136, 915, 23, 193,
233, 491, 402, 234, 223, 144, 231, 892, 266, 734, 656, 174, 690, 432,
688, 228, 221, 246, 961, 817, 780, 187, 127, 108, 814, 791, 88, 508,
572, 722, 999, 537, 745, 71, 415, 518, 306, 337, 914, 496, 244, 607,
712, 614, 936, 251, 333, 948, 257, 112, 135, 952, 489, 176, 485, 472,
328, 425, 574, 710, 312, 581, 714, 238, 166, 932, 350, 236, 343, 647,
834, 902, 42, 888, 248, 111, 281, 242, 316, 158, 423, 815, 394, 177,
775, 739, 445, 827, 79, 322, 591, 972, 719, 283, 585, 718, 83, 771,
555, 957, 181, 769, 297, 99, 747, 973, 527, 630, 255, 573, 168, 929,
632, 928, 743, 64, 383, 682, 324, 164, 392, 132, 958, 360, 302, 895,
912, 309, 62, 387, 280, 711, 553, 282, 476, 760, 277, 617, 1, 691,
196, 664, 689, 504, 355, 762, 767, 550, 10, 621, 764, 477, 513, 412,
208, 219, 202, 497, 505, 269, 868, 799, 278, 901, 358, 215, 284, 110,
247, 640, 311, 443, 520, 855, 435, 381, 543, 805, 562, 117, 295, 97,
0, 988, 480, 570, 989, 715, 806, 709, 391, 201, 447, 650, 91, 24,
109, 58, 291, 935, 436, 50, 808, 422, 587, 21, 727, 991, 978, 716,
777, 809, 454, 270, 746, 635, 457, 908, 440, 390, 346, 984, 954, 701,
595, 723, 787, 753, 469, 863, 107, 939, 458, 552, 940, 60, 359, 194,
413, 220, 629, 329, 843, 678, 556, 68, 993, 304, 732, 673, 916, 380,
610, 55, 92, 925, 720, 569, 318, 586, 622, 453, 509, 393, 605, 548,
106, 271, 216, 642, 161, 934, 245, 396, 261, 534, 571, 52, 72, 46,
433, 455, 931, 648, 367, 563, 583, 464, 218, 118, 376, 51, 726, 831,
222, 596, 833, 199, 735, 840, 276, 101, 637, 94, 821, 919, 981, 195,
784, 123, 752, 305, 582, 818, 891, 593, 456, 125, 487, 30, 105, 530,
822, 379, 28, 386, 627, 444, 428, 382, 488, 362, 603, 736, 190, 964,
525, 886, 44, 326, 759, 801, 209, 949, 313, 742, 139, 864, 80, 474,
466, 946, 138, 877, 133, 967, 331, 33, 78, 994, 913, 909, 884, 438,
450, 473, 296, 770, 896, 500, 188, 826, 983, 800, 547, 657, 601, 437,
15, 494, 541, 554, 198, 431, 408, 213, 859, 85, 253, 785, 575, 724,
698, 786, 424, 653, 669, 774, 971, 625, 327, 675, 531, 956, 922, 659,
39, 37, 995, 441, 289, 813, 933, 162, 535, 451, 589, 708, 237, 265,
2, 170, 937, 26, 61, 339, 523, 36, 400, 279, 342, 368, 137, 789,
856, 854, 579, 385, 869, 600, 911, 467, 4, 875, 119, 12, 643, 426,
721, 256, 938, 779, 179, 336, 820, 744, 204, 646, 17, 866, 772, 378,
484, 486, 347, 156, 768, 599, 475, 836, 319, 373, 479, 992, 103, 699,
401, 212, 93, 811, 427, 254, 658, 950, 169, 460, 40, 733, 580, 529,
970, 578, 263, 977, 507, 232, 409, 321, 839, 87, 205, 268, 226, 375,
694, 353, 638, 728, 516, 517, 418, 442, 672, 227, 53, 532, 611, 290,
871, 750, 829, 597, 588, 965, 323, 598, 167, 982, 687, 810, 298, 149,
566, 49, 944, 175, 848, 524, 804, 676, 796, 897, 872, 756, 677, 446,
356, 803, 680, 763, 551, 224, 930, 807, 483, 837, 634, 685, 615, 67,
374, 707, 549, 824, 533, 357, 180, 365, 32, 900, 95, 239],
dtype=torch.int32), tensor([0, 8, 4, 2, 0, 6, 3, 8, 8, 8, 9, 7, 5, 1, 1, 5, 9, 6, 1, 5, 5, 3, 7, 4,
4, 5, 5, 8, 4, 4, 3, 2, 9, 6, 2, 3, 6, 8, 6, 2, 9, 7, 4, 1, 6, 7, 8, 8,
4, 9, 4, 3, 4, 9, 3, 3, 9, 4, 3, 6, 7, 5, 5, 1, 2, 4, 6, 3, 9, 1, 1, 2,
5, 6, 7, 9, 7, 3, 2, 6, 3, 9, 4, 7, 4, 0, 7, 1, 0, 5, 9, 1, 1, 8, 2, 1,
4, 7, 2, 6, 6, 7, 4, 8, 9, 5, 4, 9, 3, 7, 5, 8, 3, 5, 1, 3, 6, 3, 7, 5,
8, 2, 1, 8, 5, 3, 2, 4, 3, 2, 6, 3, 5, 8, 5, 6, 6, 7, 5, 6, 3, 2, 3, 0,
8, 8, 1, 0, 7, 7, 8, 6, 8, 4, 0, 9, 5, 0, 3, 2, 5, 0, 9, 8, 4, 5, 7, 3,
5, 0, 3, 2, 1, 2, 1, 9, 5, 1, 9, 8, 3, 3, 6, 4, 3, 6, 2, 7, 1, 0, 2, 7,
5, 6, 6, 5, 8, 8, 8, 7, 0, 8, 7, 4, 1, 5, 1, 5, 1, 7, 9, 4, 4, 6, 9, 2,
8, 4, 5, 2, 3, 2, 7, 2, 5, 7, 1, 9, 0, 1, 7, 4, 0, 9, 5, 8, 0, 9, 6, 8,
6, 2, 5, 5, 1, 2, 6, 2, 2, 2, 5, 7, 8, 8, 5, 9, 5, 0, 4, 3, 3, 0, 1, 2,
7, 3, 1, 8, 9, 9, 1, 8, 0, 5, 8, 0, 3, 2, 5, 1, 7, 9, 5, 6, 2, 2, 5, 2,
2, 6, 7, 0, 9, 1, 2, 2, 4, 2, 2, 3, 7, 5, 9, 8, 3, 3, 4, 5, 0, 9, 4, 4,
1, 5, 9, 0, 9, 0, 0, 2, 3, 6, 5, 9, 3, 8, 4, 1, 9, 0, 7, 4, 8, 5, 5, 9,
5, 6, 4, 9, 2, 2, 3, 9, 4, 3, 6, 6, 7, 3, 3, 3, 7, 0, 2, 7, 3, 4, 5, 5,
6, 5, 9, 2, 0, 7, 0, 4, 1, 7, 1, 1, 1, 4, 5, 9, 0, 3, 1, 5, 9, 5, 5, 1,
1, 0, 5, 4, 5, 2, 8, 2, 9, 6, 3, 5, 6, 5, 9, 3, 6, 0, 1, 8, 9, 2, 1, 6,
4, 6, 3, 6, 5, 0, 5, 0, 9, 5, 5, 4, 1, 9, 8, 3, 9, 6, 1, 9, 5, 3, 7, 4,
0, 3, 3, 3, 4, 3, 3, 5, 4, 4, 3, 2, 0, 9, 8, 6, 9, 5, 3, 1, 9, 8, 8, 3,
5, 7, 7, 3, 2, 7, 1, 9, 6, 1, 7, 6, 3, 5, 2, 9, 8, 9, 2, 0, 8, 8, 2, 1,
6, 6, 3, 3, 7, 9, 5, 1, 0, 3, 3, 5, 6, 9, 6, 1, 2, 5, 1, 7, 0, 2, 8, 4,
8, 1, 9, 4, 3, 9, 2, 3, 6, 6, 1, 5, 5, 9, 5, 3, 7, 1, 7, 4, 0, 2, 0, 4,
6, 2, 6, 1, 8, 0, 8, 7, 4, 7, 8, 5, 9, 5, 4, 5, 9, 1, 7, 5, 4, 9, 2, 4,
0, 3, 9, 2, 0, 9, 3, 7, 0, 1, 8, 6, 0, 4, 7, 1, 9, 4, 8, 0, 0, 7, 5, 6,
3, 6, 5, 8, 9, 4, 0, 2, 6, 3, 7, 8, 6, 2, 9, 8, 5, 2, 9, 2, 4, 8, 8, 9])),
names=('seed_nodes', 'labels'),
)},
names=('seed_nodes', 'labels'),
),
test_set=ItemSetDict(
itemsets={'user': ItemSet(
items=(tensor([ 97, 370, 540, 736, 944, 85, 658, 216, 431, 50, 396, 769, 83, 745,
299, 999, 927, 449, 674, 183, 458, 907, 603, 680, 457, 402, 951, 787,
204, 675, 60, 25, 594, 989, 886, 476, 930, 671, 160, 511, 251, 107,
325, 264, 532, 84, 29, 910, 913, 740, 626, 481, 655, 155, 604, 116,
98, 493, 252, 303, 382, 290, 988, 159, 126, 734, 238, 184, 567, 729,
427, 379, 8, 422, 621, 559, 560, 646, 463, 377, 657, 100, 447, 292,
483, 853, 781, 22, 965, 640, 645, 878, 357, 727, 663, 391, 562, 546,
362, 234, 91, 437, 650, 397, 496, 113, 154, 441, 785, 242, 916, 596,
346, 807, 487, 921, 52, 321, 243, 711, 156, 46, 973, 864, 475, 775,
931, 972, 300, 279, 117, 759, 275, 949, 599, 229, 324, 32, 317, 200,
689, 409, 683, 959, 352, 122, 679, 802, 138, 128, 890, 182, 477, 805,
828, 63, 813, 783, 297, 81, 732, 936, 961, 515, 945, 153, 426, 598,
606, 568, 123, 825, 623, 189, 284, 990, 223, 331, 428, 593, 917, 394,
193, 384, 499, 522, 166, 262, 194, 213, 770, 360, 967, 228, 454, 524,
755, 764, 169, 92], dtype=torch.int32), tensor([6, 0, 7, 2, 1, 6, 8, 9, 3, 4, 4, 5, 8, 0, 4, 2, 5, 4, 6, 4, 8, 0, 9, 2,
8, 4, 1, 5, 3, 7, 3, 1, 4, 7, 6, 9, 4, 3, 0, 5, 7, 4, 5, 3, 5, 0, 6, 8,
1, 7, 3, 6, 4, 2, 4, 3, 0, 1, 0, 9, 2, 7, 8, 2, 8, 3, 0, 9, 5, 4, 0, 6,
6, 9, 9, 1, 3, 4, 0, 5, 1, 9, 2, 0, 9, 0, 2, 1, 2, 7, 1, 6, 3, 9, 8, 7,
7, 3, 3, 2, 5, 3, 6, 5, 0, 4, 7, 8, 6, 5, 0, 4, 3, 4, 5, 0, 5, 3, 0, 3,
7, 3, 1, 1, 7, 3, 5, 7, 7, 7, 9, 2, 7, 4, 7, 3, 1, 4, 8, 1, 2, 0, 9, 3,
5, 9, 4, 9, 3, 2, 4, 8, 7, 2, 6, 5, 4, 6, 4, 7, 9, 9, 4, 2, 5, 0, 6, 3,
6, 8, 6, 5, 8, 5, 5, 3, 4, 9, 1, 5, 3, 0, 8, 0, 1, 5, 6, 5, 1, 5, 8, 7,
7, 5, 4, 6, 9, 8, 2, 3])),
names=('seed_nodes', 'labels'),
), 'item': ItemSet(
items=(tensor([797, 361, 612, 240, 463, 287, 157, 197, 388, 686, 128, 521, 670, 651,
439, 558, 661, 519, 449, 414, 730, 737, 825, 35, 114, 544, 889, 369,
684, 741, 206, 420, 904, 765, 14, 140, 561, 332, 395, 7, 926, 65,
153, 404, 905, 975, 947, 165, 90, 292, 182, 481, 693, 272, 148, 514,
654, 608, 419, 644, 846, 649, 757, 275, 217, 341, 490, 660, 410, 13,
990, 620, 528, 725, 985, 411, 706, 151, 84, 43, 29, 126, 997, 145,
352, 200, 288, 293, 974, 740, 129, 838, 568, 262, 172, 3, 955, 941,
850, 315, 526, 57, 465, 243, 81, 211, 66, 235, 819, 565, 349, 300,
844, 334, 299, 921, 100, 697, 943, 155, 366, 130, 860, 867, 5, 692,
705, 754, 417, 962, 16, 452, 953, 793, 903, 668, 560, 407, 69, 398,
230, 308, 748, 858, 47, 729, 960, 397, 883, 717, 927, 945, 782, 792,
852, 845, 120, 890, 471, 979, 951, 264, 986, 851, 849, 702, 160, 798,
861, 18, 74, 898, 183, 633, 416, 522, 207, 515, 778, 259, 626, 540,
274, 876, 152, 384, 354, 564, 429, 502, 980, 773, 636, 89, 755, 662,
102, 434, 403, 56], dtype=torch.int32), tensor([4, 7, 2, 2, 9, 3, 9, 9, 8, 1, 9, 4, 5, 5, 5, 5, 4, 9, 8, 3, 4, 2, 3, 5,
0, 3, 9, 0, 8, 6, 4, 9, 7, 5, 2, 7, 5, 2, 7, 6, 6, 2, 0, 6, 3, 5, 1, 9,
8, 5, 5, 5, 5, 1, 8, 3, 5, 8, 3, 0, 1, 5, 0, 4, 6, 7, 2, 4, 4, 3, 7, 9,
8, 8, 4, 6, 0, 2, 4, 9, 3, 4, 3, 3, 4, 9, 8, 6, 5, 3, 7, 0, 4, 7, 2, 4,
0, 6, 7, 9, 8, 5, 1, 2, 7, 9, 4, 0, 5, 3, 5, 7, 1, 7, 8, 3, 5, 9, 2, 1,
5, 9, 1, 9, 1, 3, 5, 9, 0, 5, 6, 5, 4, 0, 4, 2, 8, 8, 2, 2, 0, 5, 8, 7,
0, 3, 5, 6, 9, 0, 9, 1, 2, 1, 7, 0, 1, 6, 8, 6, 8, 0, 0, 2, 5, 3, 7, 7,
7, 0, 8, 3, 6, 8, 7, 3, 7, 5, 9, 2, 7, 7, 7, 8, 9, 2, 9, 0, 1, 9, 7, 7,
5, 6, 8, 0, 6, 0, 9, 1])),
names=('seed_nodes', 'labels'),
)},
names=('seed_nodes', 'labels'),
),
metadata={'name': 'node_classification', 'num_classes': 10},)
Loaded link prediction task: OnDiskTask(validation_set=ItemSetDict(
itemsets={'user:like:item': ItemSet(
items=(tensor([[755, 622],
[738, 623],
[558, 309],
...,
[799, 123],
[643, 507],
[680, 696]], dtype=torch.int32), tensor([[255, 99, 35, ..., 279, 942, 410],
[184, 487, 530, ..., 884, 482, 674],
[638, 273, 739, ..., 661, 234, 9],
...,
[962, 647, 298, ..., 616, 496, 108],
[754, 385, 241, ..., 840, 975, 298],
[456, 926, 33, ..., 731, 579, 820]], dtype=torch.int32)),
names=('node_pairs', 'negative_dsts'),
), 'user:follow:user': ItemSet(
items=(tensor([[579, 232],
[916, 105],
[524, 559],
...,
[150, 968],
[ 40, 975],
[592, 926]], dtype=torch.int32), tensor([[145, 446, 650, ..., 875, 221, 290],
[590, 126, 218, ..., 5, 447, 230],
[375, 645, 490, ..., 107, 568, 956],
...,
[ 85, 279, 107, ..., 395, 302, 276],
[802, 289, 769, ..., 41, 106, 194],
[880, 215, 503, ..., 770, 174, 30]], dtype=torch.int32)),
names=('node_pairs', 'negative_dsts'),
)},
names=('node_pairs', 'negative_dsts'),
),
train_set=ItemSetDict(
itemsets={'user:like:item': ItemSet(
items=(tensor([[611, 315],
[221, 595],
[228, 444],
...,
[834, 567],
[544, 658],
[924, 513]], dtype=torch.int32),),
names=('node_pairs',),
), 'user:follow:user': ItemSet(
items=(tensor([[657, 157],
[922, 328],
[141, 41],
...,
[732, 209],
[606, 574],
[ 54, 981]], dtype=torch.int32),),
names=('node_pairs',),
)},
names=('node_pairs',),
),
test_set=ItemSetDict(
itemsets={'user:like:item': ItemSet(
items=(tensor([674, 480], dtype=torch.int32), tensor([[756, 175, 247, ..., 220, 718, 578],
[411, 26, 407, ..., 65, 179, 74],
[680, 927, 303, ..., 605, 171, 308],
...,
[540, 330, 637, ..., 770, 318, 45],
[891, 989, 555, ..., 943, 239, 532],
[754, 86, 407, ..., 521, 185, 103]], dtype=torch.int32)),
names=('node_pairs', 'negative_dsts'),
), 'user:follow:user': ItemSet(
items=(tensor([565, 314], dtype=torch.int32), tensor([[276, 385, 878, ..., 133, 289, 407],
[341, 6, 85, ..., 719, 810, 272],
[993, 833, 56, ..., 541, 158, 322],
...,
[795, 594, 808, ..., 206, 889, 466],
[325, 487, 96, ..., 381, 391, 227],
[908, 179, 583, ..., 721, 960, 415]], dtype=torch.int32)),
names=('node_pairs', 'negative_dsts'),
)},
names=('node_pairs', 'negative_dsts'),
),
metadata={'name': 'link_prediction', 'num_classes': 10},)
/home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.1.x/lib/python3.8/site-packages/dgl-2.1.0-py3.8-linux-x86_64.egg/dgl/graphbolt/impl/ondisk_dataset.py:464: DGLWarning: Edge feature is stored, but edge IDs are not saved.
dgl_warning("Edge feature is stored, but edge IDs are not saved.")