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.2.x/lib/python3.8/site-packages/dgl-2.2.1-py3.8-linux-x86_64.egg (2.2.1)
Requirement already satisfied: numpy>=1.14.0 in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.2.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.2.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.2.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.2.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.2.x/lib/python3.8/site-packages (from dgl) (4.66.4)
Requirement already satisfied: psutil>=5.8.0 in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.2.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.2.x/lib/python3.8/site-packages (from dgl) (0.7.1)
Requirement already satisfied: pandas in /home/ubuntu/.pyenv/versions/miniconda3-latest/lib/python3.8/site-packages (from dgl) (2.0.3)
Requirement already satisfied: charset-normalizer<4,>=2 in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.2.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.2.x/lib/python3.8/site-packages (from requests>=2.19.0->dgl) (3.7)
Requirement already satisfied: urllib3<3,>=1.21.1 in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.2.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.2.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.2.x/lib/python3.8/site-packages (from torchdata>=0.5.0->dgl) (2.0.0)
Requirement already satisfied: python-dateutil>=2.8.2 in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.2.x/lib/python3.8/site-packages (from pandas->dgl) (2.9.0.post0)
Requirement already satisfied: pytz>=2020.1 in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.2.x/lib/python3.8/site-packages (from pandas->dgl) (2024.1)
Requirement already satisfied: tzdata>=2022.1 in /home/ubuntu/.pyenv/versions/miniconda3-latest/lib/python3.8/site-packages (from pandas->dgl) (2024.1)
Requirement already satisfied: six>=1.5 in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.2.x/lib/python3.8/site-packages (from python-dateutil>=2.8.2->pandas->dgl) (1.16.0)
Requirement already satisfied: filelock in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.2.x/lib/python3.8/site-packages (from torch>=2->torchdata>=0.5.0->dgl) (3.14.0)
Requirement already satisfied: typing-extensions in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.2.x/lib/python3.8/site-packages (from torch>=2->torchdata>=0.5.0->dgl) (4.11.0)
Requirement already satisfied: sympy in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.2.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.2.x/lib/python3.8/site-packages (from torch>=2->torchdata>=0.5.0->dgl) (3.1.4)
Requirement already satisfied: nvidia-cuda-nvrtc-cu11==11.7.99 in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.2.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.2.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.2.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.2.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.2.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.2.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.2.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.2.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.2.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.2.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.2.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.2.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.2.x/lib/python3.8/site-packages (from nvidia-cublas-cu11==11.10.3.66->torch>=2->torchdata>=0.5.0->dgl) (69.2.0)
Requirement already satisfied: wheel in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.2.x/lib/python3.8/site-packages (from nvidia-cublas-cu11==11.10.3.66->torch>=2->torchdata>=0.5.0->dgl) (0.43.0)
Requirement already satisfied: cmake in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.2.x/lib/python3.8/site-packages (from triton==2.0.0->torch>=2->torchdata>=0.5.0->dgl) (3.29.2)
Requirement already satisfied: lit in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.2.x/lib/python3.8/site-packages (from triton==2.0.0->torch>=2->torchdata>=0.5.0->dgl) (18.1.4)
Requirement already satisfied: MarkupSafe>=2.0 in /home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.2.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.2.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 seeds) 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: [[685 6]
[461 656]
[385 516]
[290 240]
[691 983]]
[user:like:item] edges are saved into ./ondisk_dataset_heterograph/like-edges.csv
Part of [user:follow:user] edges: [[497 148]
[922 403]
[975 178]
[ 55 68]
[770 510]]
[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.86914986 0.22448017 0.16112851 0.06150023 0.89254853]
[0.89436219 0.20935625 0.73306942 0.72544336 0.29431591]
[0.5132641 0.22651667 0.51456988 0.61235222 0.38974511]]
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.4559, 0.8980, 0.7473, 0.9186, 0.9245],
[0.0291, 0.2997, 0.9246, 0.1049, 0.6526],
[0.8664, 0.1777, 0.3215, 0.1685, 0.7183]])
Node[user] feature [feat_1] is saved to ./ondisk_dataset_heterograph/node-user-feat-1.pt
Part of node[item] feature [feat_0]: [[0.82501829 0.5511699 0.33496954 0.93225313 0.17313141]
[0.48575943 0.934857 0.24872737 0.64498749 0.65814625]
[0.69842364 0.61399079 0.55889684 0.44384196 0.27768782]]
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.4064, 0.7765, 0.5344, 0.8053, 0.6391],
[0.0567, 0.6032, 0.2770, 0.3316, 0.8770],
[0.1608, 0.5711, 0.1632, 0.6035, 0.8523]])
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.61305503 0.69651482 0.90111325 0.58352666 0.87573678]
[0.39876912 0.3588054 0.4625756 0.60254909 0.1731448 ]
[0.66573048 0.75067958 0.93619772 0.8262041 0.48321238]]
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.7856, 0.2664, 0.7186, 0.0242, 0.4661],
[0.4616, 0.2145, 0.0750, 0.2403, 0.2233],
[0.5720, 0.0754, 0.7088, 0.4481, 0.0894]])
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.56231698 0.91691189 0.69534038 0.79830117 0.91226659]
[0.72250761 0.09701607 0.2682809 0.70145602 0.39633588]
[0.12785761 0.94495565 0.21210217 0.99687304 0.81101336]]
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.2135, 0.2350, 0.0046, 0.9191, 0.0832],
[0.9834, 0.9362, 0.1808, 0.7956, 0.2092],
[0.3884, 0.1709, 0.7203, 0.0615, 0.6199]])
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: [ 72 421 576]
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, 8, 2])
NC train labels[user] are saved to ./ondisk_dataset_heterograph/nc-train-user-labels.pt
Part of train ids[item] for node classification: [846 464 583]
NC train ids[item] are saved to ./ondisk_dataset_heterograph/nc-train-item-ids.npy
Part of train labels[item] for node classification: tensor([7, 4, 2])
NC train labels[item] are saved to ./ondisk_dataset_heterograph/nc-train-item-labels.pt
Part of val ids[user] for node classification: [546 947 663]
NC val ids[user] are saved to ./ondisk_dataset_heterograph/nc-val-user-ids.npy
Part of val labels[user] for node classification: tensor([7, 6, 6])
NC val labels[user] are saved to ./ondisk_dataset_heterograph/nc-val-user-labels.pt
Part of val ids[item] for node classification: [505 599 22]
NC val ids[item] are saved to ./ondisk_dataset_heterograph/nc-val-item-ids.npy
Part of val labels[item] for node classification: tensor([2, 1, 8])
NC val labels[item] are saved to ./ondisk_dataset_heterograph/nc-val-item-labels.pt
Part of test ids[user] for node classification: [324 533 737]
NC test ids[user] are saved to ./ondisk_dataset_heterograph/nc-test-user-ids.npy
Part of test labels[user] for node classification: tensor([1, 9, 4])
NC test labels[user] are saved to ./ondisk_dataset_heterograph/nc-test-user-labels.pt
Part of test ids[item] for node classification: [307 47 829]
NC test ids[item] are saved to ./ondisk_dataset_heterograph/nc-test-item-ids.npy
Part of test labels[item] for node classification: tensor([5, 5, 1])
NC test labels[item] are saved to ./ondisk_dataset_heterograph/nc-test-item-labels.pt
Link Prediction Taskο
For link prediction task, we need seeds or corresponding labels and indexes which representing the pos/neg property and group of the seeds 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 seeds for user:like:item.
lp_train_like_seeds_path = os.path.join(base_dir, "lp-train-like-seeds.npy")
lp_train_like_seeds = like_edges[:num_trains, :]
print(f"Part of train seeds[user:like:item] for link prediction: {lp_train_like_seeds[:3]}")
np.save(lp_train_like_seeds_path, lp_train_like_seeds)
print(f"LP train seeds[user:like:item] are saved to {lp_train_like_seeds_path}\n")
# Train seeds for user:follow:user.
lp_train_follow_seeds_path = os.path.join(base_dir, "lp-train-follow-seeds.npy")
lp_train_follow_seeds = follow_edges[:num_trains, :]
print(f"Part of train seeds[user:follow:user] for link prediction: {lp_train_follow_seeds[:3]}")
np.save(lp_train_follow_seeds_path, lp_train_follow_seeds)
print(f"LP train seeds[user:follow:user] are saved to {lp_train_follow_seeds_path}\n")
# Val seeds for user:like:item.
lp_val_like_seeds_path = os.path.join(base_dir, "lp-val-like-seeds.npy")
lp_val_like_seeds = like_edges[num_trains:num_trains+num_vals, :]
lp_val_like_neg_dsts = np.random.randint(0, num_nodes, (num_vals, 10)).reshape(-1)
lp_val_like_neg_srcs = np.repeat(lp_val_like_seeds[:,0], 10)
lp_val_like_neg_seeds = np.concatenate((lp_val_like_neg_srcs, lp_val_like_neg_dsts)).reshape(2,-1).T
lp_val_like_seeds = np.concatenate((lp_val_like_seeds, lp_val_like_neg_seeds))
print(f"Part of val seeds[user:like:item] for link prediction: {lp_val_like_seeds[:3]}")
np.save(lp_val_like_seeds_path, lp_val_like_seeds)
print(f"LP val seeds[user:like:item] are saved to {lp_val_like_seeds_path}\n")
# Val labels for user:like:item.
lp_val_like_labels_path = os.path.join(base_dir, "lp-val-like-labels.npy")
lp_val_like_labels = np.empty(num_vals * (10 + 1))
lp_val_like_labels[:num_vals] = 1
lp_val_like_labels[num_vals:] = 0
print(f"Part of val labels[user:like:item] for link prediction: {lp_val_like_labels[:3]}")
np.save(lp_val_like_labels_path, lp_val_like_labels)
print(f"LP val labels[user:like:item] are saved to {lp_val_like_labels_path}\n")
# Val indexes for user:like:item.
lp_val_like_indexes_path = os.path.join(base_dir, "lp-val-like-indexes.npy")
lp_val_like_indexes = np.arange(0, num_vals)
lp_val_like_neg_indexes = np.repeat(lp_val_like_indexes, 10)
lp_val_like_indexes = np.concatenate([lp_val_like_indexes, lp_val_like_neg_indexes])
print(f"Part of val indexes[user:like:item] for link prediction: {lp_val_like_indexes[:3]}")
np.save(lp_val_like_indexes_path, lp_val_like_indexes)
print(f"LP val indexes[user:like:item] are saved to {lp_val_like_indexes_path}\n")
# Val seeds for user:follow:item.
lp_val_follow_seeds_path = os.path.join(base_dir, "lp-val-follow-seeds.npy")
lp_val_follow_seeds = follow_edges[num_trains:num_trains+num_vals, :]
lp_val_follow_neg_dsts = np.random.randint(0, num_nodes, (num_vals, 10)).reshape(-1)
lp_val_follow_neg_srcs = np.repeat(lp_val_follow_seeds[:,0], 10)
lp_val_follow_neg_seeds = np.concatenate((lp_val_follow_neg_srcs, lp_val_follow_neg_dsts)).reshape(2,-1).T
lp_val_follow_seeds = np.concatenate((lp_val_follow_seeds, lp_val_follow_neg_seeds))
print(f"Part of val seeds[user:follow:item] for link prediction: {lp_val_follow_seeds[:3]}")
np.save(lp_val_follow_seeds_path, lp_val_follow_seeds)
print(f"LP val seeds[user:follow:item] are saved to {lp_val_follow_seeds_path}\n")
# Val labels for user:follow:item.
lp_val_follow_labels_path = os.path.join(base_dir, "lp-val-follow-labels.npy")
lp_val_follow_labels = np.empty(num_vals * (10 + 1))
lp_val_follow_labels[:num_vals] = 1
lp_val_follow_labels[num_vals:] = 0
print(f"Part of val labels[user:follow:item] for link prediction: {lp_val_follow_labels[:3]}")
np.save(lp_val_follow_labels_path, lp_val_follow_labels)
print(f"LP val labels[user:follow:item] are saved to {lp_val_follow_labels_path}\n")
# Val indexes for user:follow:item.
lp_val_follow_indexes_path = os.path.join(base_dir, "lp-val-follow-indexes.npy")
lp_val_follow_indexes = np.arange(0, num_vals)
lp_val_follow_neg_indexes = np.repeat(lp_val_follow_indexes, 10)
lp_val_follow_indexes = np.concatenate([lp_val_follow_indexes, lp_val_follow_neg_indexes])
print(f"Part of val indexes[user:follow:item] for link prediction: {lp_val_follow_indexes[:3]}")
np.save(lp_val_follow_indexes_path, lp_val_follow_indexes)
print(f"LP val indexes[user:follow:item] are saved to {lp_val_follow_indexes_path}\n")
# Test seeds for user:like:item.
lp_test_like_seeds_path = os.path.join(base_dir, "lp-test-like-seeds.npy")
lp_test_like_seeds = like_edges[-num_tests:, :]
lp_test_like_neg_dsts = np.random.randint(0, num_nodes, (num_tests, 10)).reshape(-1)
lp_test_like_neg_srcs = np.repeat(lp_test_like_seeds[:,0], 10)
lp_test_like_neg_seeds = np.concatenate((lp_test_like_neg_srcs, lp_test_like_neg_dsts)).reshape(2,-1).T
lp_test_like_seeds = np.concatenate((lp_test_like_seeds, lp_test_like_neg_seeds))
print(f"Part of test seeds[user:like:item] for link prediction: {lp_test_like_seeds[:3]}")
np.save(lp_test_like_seeds_path, lp_test_like_seeds)
print(f"LP test seeds[user:like:item] are saved to {lp_test_like_seeds_path}\n")
# Test labels for user:like:item.
lp_test_like_labels_path = os.path.join(base_dir, "lp-test-like-labels.npy")
lp_test_like_labels = np.empty(num_tests * (10 + 1))
lp_test_like_labels[:num_tests] = 1
lp_test_like_labels[num_tests:] = 0
print(f"Part of test labels[user:like:item] for link prediction: {lp_test_like_labels[:3]}")
np.save(lp_test_like_labels_path, lp_test_like_labels)
print(f"LP test labels[user:like:item] are saved to {lp_test_like_labels_path}\n")
# Test indexes for user:like:item.
lp_test_like_indexes_path = os.path.join(base_dir, "lp-test-like-indexes.npy")
lp_test_like_indexes = np.arange(0, num_tests)
lp_test_like_neg_indexes = np.repeat(lp_test_like_indexes, 10)
lp_test_like_indexes = np.concatenate([lp_test_like_indexes, lp_test_like_neg_indexes])
print(f"Part of test indexes[user:like:item] for link prediction: {lp_test_like_indexes[:3]}")
np.save(lp_test_like_indexes_path, lp_test_like_indexes)
print(f"LP test indexes[user:like:item] are saved to {lp_test_like_indexes_path}\n")
# Test seeds for user:follow:item.
lp_test_follow_seeds_path = os.path.join(base_dir, "lp-test-follow-seeds.npy")
lp_test_follow_seeds = follow_edges[-num_tests:, :]
lp_test_follow_neg_dsts = np.random.randint(0, num_nodes, (num_tests, 10)).reshape(-1)
lp_test_follow_neg_srcs = np.repeat(lp_test_follow_seeds[:,0], 10)
lp_test_follow_neg_seeds = np.concatenate((lp_test_follow_neg_srcs, lp_test_follow_neg_dsts)).reshape(2,-1).T
lp_test_follow_seeds = np.concatenate((lp_test_follow_seeds, lp_test_follow_neg_seeds))
print(f"Part of test seeds[user:follow:item] for link prediction: {lp_test_follow_seeds[:3]}")
np.save(lp_test_follow_seeds_path, lp_test_follow_seeds)
print(f"LP test seeds[user:follow:item] are saved to {lp_test_follow_seeds_path}\n")
# Test labels for user:follow:item.
lp_test_follow_labels_path = os.path.join(base_dir, "lp-test-follow-labels.npy")
lp_test_follow_labels = np.empty(num_tests * (10 + 1))
lp_test_follow_labels[:num_tests] = 1
lp_test_follow_labels[num_tests:] = 0
print(f"Part of test labels[user:follow:item] for link prediction: {lp_test_follow_labels[:3]}")
np.save(lp_test_follow_labels_path, lp_test_follow_labels)
print(f"LP test labels[user:follow:item] are saved to {lp_test_follow_labels_path}\n")
# Test indexes for user:follow:item.
lp_test_follow_indexes_path = os.path.join(base_dir, "lp-test-follow-indexes.npy")
lp_test_follow_indexes = np.arange(0, num_tests)
lp_test_follow_neg_indexes = np.repeat(lp_test_follow_indexes, 10)
lp_test_follow_indexes = np.concatenate([lp_test_follow_indexes, lp_test_follow_neg_indexes])
print(f"Part of test indexes[user:follow:item] for link prediction: {lp_test_follow_indexes[:3]}")
np.save(lp_test_follow_indexes_path, lp_test_follow_indexes)
print(f"LP test indexes[user:follow:item] are saved to {lp_test_follow_indexes_path}\n")
Part of train seeds[user:like:item] for link prediction: [[685 6]
[461 656]
[385 516]]
LP train seeds[user:like:item] are saved to ./ondisk_dataset_heterograph/lp-train-like-seeds.npy
Part of train seeds[user:follow:user] for link prediction: [[497 148]
[922 403]
[975 178]]
LP train seeds[user:follow:user] are saved to ./ondisk_dataset_heterograph/lp-train-follow-seeds.npy
Part of val seeds[user:like:item] for link prediction: [[ 32 623]
[590 773]
[939 825]]
LP val seeds[user:like:item] are saved to ./ondisk_dataset_heterograph/lp-val-like-seeds.npy
Part of val labels[user:like:item] for link prediction: [1. 1. 1.]
LP val labels[user:like:item] are saved to ./ondisk_dataset_heterograph/lp-val-like-labels.npy
Part of val indexes[user:like:item] for link prediction: [0 1 2]
LP val indexes[user:like:item] are saved to ./ondisk_dataset_heterograph/lp-val-like-indexes.npy
Part of val seeds[user:follow:item] for link prediction: [[472 775]
[478 475]
[ 1 33]]
LP val seeds[user:follow:item] are saved to ./ondisk_dataset_heterograph/lp-val-follow-seeds.npy
Part of val labels[user:follow:item] for link prediction: [1. 1. 1.]
LP val labels[user:follow:item] are saved to ./ondisk_dataset_heterograph/lp-val-follow-labels.npy
Part of val indexes[user:follow:item] for link prediction: [0 1 2]
LP val indexes[user:follow:item] are saved to ./ondisk_dataset_heterograph/lp-val-follow-indexes.npy
Part of test seeds[user:like:item] for link prediction: [[720 330]
[397 528]
[662 272]]
LP test seeds[user:like:item] are saved to ./ondisk_dataset_heterograph/lp-test-like-seeds.npy
Part of test labels[user:like:item] for link prediction: [1. 1. 1.]
LP test labels[user:like:item] are saved to ./ondisk_dataset_heterograph/lp-test-like-labels.npy
Part of test indexes[user:like:item] for link prediction: [0 1 2]
LP test indexes[user:like:item] are saved to ./ondisk_dataset_heterograph/lp-test-like-indexes.npy
Part of test seeds[user:follow:item] for link prediction: [[880 24]
[950 968]
[544 356]]
LP test seeds[user:follow:item] are saved to ./ondisk_dataset_heterograph/lp-test-follow-seeds.npy
Part of test labels[user:follow:item] for link prediction: [1. 1. 1.]
LP test labels[user:follow:item] are saved to ./ondisk_dataset_heterograph/lp-test-follow-labels.npy
Part of test indexes[user:follow:item] for link prediction: [0 1 2]
LP test indexes[user:follow:item] are saved to ./ondisk_dataset_heterograph/lp-test-follow-indexes.npy
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: seeds
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: seeds
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: seeds
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: seeds
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: seeds
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: seeds
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: seeds
format: numpy
path: {os.path.basename(lp_train_like_seeds_path)}
- type: "user:follow:user"
data:
- name: seeds
format: numpy
path: {os.path.basename(lp_train_follow_seeds_path)}
validation_set:
- type: "user:like:item"
data:
- name: seeds
format: numpy
path: {os.path.basename(lp_val_like_seeds_path)}
- name: labels
format: numpy
path: {os.path.basename(lp_val_like_labels_path)}
- name: indexes
format: numpy
path: {os.path.basename(lp_val_like_indexes_path)}
- type: "user:follow:user"
data:
- name: seeds
format: numpy
path: {os.path.basename(lp_val_follow_seeds_path)}
- name: labels
format: numpy
path: {os.path.basename(lp_val_follow_labels_path)}
- name: indexes
format: numpy
path: {os.path.basename(lp_val_follow_indexes_path)}
test_set:
- type: "user:like:item"
data:
- name: seeds
format: numpy
path: {os.path.basename(lp_test_like_seeds_path)}
- name: labels
format: numpy
path: {os.path.basename(lp_test_like_labels_path)}
- name: indexes
format: numpy
path: {os.path.basename(lp_test_like_indexes_path)}
- type: "user:follow:user"
data:
- name: seeds
format: numpy
path: {os.path.basename(lp_test_follow_seeds_path)}
- name: labels
format: numpy
path: {os.path.basename(lp_test_follow_labels_path)}
- name: indexes
format: numpy
path: {os.path.basename(lp_test_follow_indexes_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, 21, ..., 19980, 19991, 20000], dtype=torch.int32),
indices=tensor([1258, 1738, 1059, ..., 1460, 1316, 1482], 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.8691, 0.2245, 0.1611, 0.0615, 0.8925],
[0.8944, 0.2094, 0.7331, 0.7254, 0.2943],
[0.5133, 0.2265, 0.5146, 0.6124, 0.3897],
...,
[0.8444, 0.5023, 0.2789, 0.6417, 0.4854],
[0.9976, 0.0913, 0.0329, 0.5871, 0.6779],
[0.4315, 0.0731, 0.9402, 0.6187, 0.0771]], dtype=torch.float64),
metadata={},
), (<OnDiskFeatureDataDomain.NODE: 'node'>, 'user', 'feat_1'): TorchBasedFeature(
feature=tensor([[0.4559, 0.8980, 0.7473, 0.9186, 0.9245],
[0.0291, 0.2997, 0.9246, 0.1049, 0.6526],
[0.8664, 0.1777, 0.3215, 0.1685, 0.7183],
...,
[0.5207, 0.7304, 0.4002, 0.0458, 0.8754],
[0.1779, 0.8250, 0.9581, 0.2867, 0.0564],
[0.0048, 0.7929, 0.1181, 0.2107, 0.2316]]),
metadata={},
), (<OnDiskFeatureDataDomain.NODE: 'node'>, 'item', 'feat_0'): TorchBasedFeature(
feature=tensor([[0.8250, 0.5512, 0.3350, 0.9323, 0.1731],
[0.4858, 0.9349, 0.2487, 0.6450, 0.6581],
[0.6984, 0.6140, 0.5589, 0.4438, 0.2777],
...,
[0.0766, 0.6293, 0.1475, 0.3933, 0.6173],
[0.4713, 0.0429, 0.7887, 0.5173, 0.3710],
[0.8998, 0.2486, 0.2813, 0.9543, 0.1248]], dtype=torch.float64),
metadata={},
), (<OnDiskFeatureDataDomain.NODE: 'node'>, 'item', 'feat_1'): TorchBasedFeature(
feature=tensor([[0.4064, 0.7765, 0.5344, 0.8053, 0.6391],
[0.0567, 0.6032, 0.2770, 0.3316, 0.8770],
[0.1608, 0.5711, 0.1632, 0.6035, 0.8523],
...,
[0.8370, 0.3751, 0.5207, 0.7504, 0.0614],
[0.3124, 0.3196, 0.7348, 0.1305, 0.8755],
[0.2051, 0.0429, 0.9514, 0.9498, 0.8262]]),
metadata={},
), (<OnDiskFeatureDataDomain.EDGE: 'edge'>, 'user:like:item', 'feat_0'): TorchBasedFeature(
feature=tensor([[0.6131, 0.6965, 0.9011, 0.5835, 0.8757],
[0.3988, 0.3588, 0.4626, 0.6025, 0.1731],
[0.6657, 0.7507, 0.9362, 0.8262, 0.4832],
...,
[0.7079, 0.2602, 0.5731, 0.8050, 0.4570],
[0.4963, 0.1483, 0.2632, 0.6353, 0.8826],
[0.3732, 0.5583, 0.8297, 0.4435, 0.3581]], dtype=torch.float64),
metadata={},
), (<OnDiskFeatureDataDomain.EDGE: 'edge'>, 'user:like:item', 'feat_1'): TorchBasedFeature(
feature=tensor([[0.7856, 0.2664, 0.7186, 0.0242, 0.4661],
[0.4616, 0.2145, 0.0750, 0.2403, 0.2233],
[0.5720, 0.0754, 0.7088, 0.4481, 0.0894],
...,
[0.6195, 0.7165, 0.6441, 0.3705, 0.8296],
[0.3988, 0.1395, 0.1914, 0.6335, 0.4798],
[0.7330, 0.7939, 0.5868, 0.2156, 0.1063]]),
metadata={},
), (<OnDiskFeatureDataDomain.EDGE: 'edge'>, 'user:follow:user', 'feat_0'): TorchBasedFeature(
feature=tensor([[0.5623, 0.9169, 0.6953, 0.7983, 0.9123],
[0.7225, 0.0970, 0.2683, 0.7015, 0.3963],
[0.1279, 0.9450, 0.2121, 0.9969, 0.8110],
...,
[0.4599, 0.0916, 0.5696, 0.7490, 0.1860],
[0.8317, 0.7600, 0.9730, 0.6864, 0.3589],
[0.5851, 0.1640, 0.3265, 0.6279, 0.0141]], dtype=torch.float64),
metadata={},
), (<OnDiskFeatureDataDomain.EDGE: 'edge'>, 'user:follow:user', 'feat_1'): TorchBasedFeature(
feature=tensor([[0.2135, 0.2350, 0.0046, 0.9191, 0.0832],
[0.9834, 0.9362, 0.1808, 0.7956, 0.2092],
[0.3884, 0.1709, 0.7203, 0.0615, 0.6199],
...,
[0.6442, 0.4146, 0.4188, 0.1389, 0.4795],
[0.8472, 0.9896, 0.4260, 0.0385, 0.0201],
[0.9927, 0.0435, 0.4297, 0.7032, 0.2777]]),
metadata={},
)}
)
Loaded node classification task: OnDiskTask(validation_set=ItemSetDict(
itemsets={'user': ItemSet(
items=(tensor([546, 947, 663, 148, 500, 838, 420, 442, 792, 55, 109, 962, 824, 70,
218, 997, 451, 922, 124, 94, 219, 453, 369, 412, 803, 270, 104, 816,
161, 590, 326, 503, 340, 594, 498, 518, 39, 832, 613, 948, 574, 959,
377, 404, 755, 20, 509, 255, 638, 674, 868, 151, 998, 656, 402, 272,
624, 365, 75, 343, 433, 162, 302, 281, 629, 801, 548, 183, 639, 808,
174, 241, 968, 566, 371, 490, 283, 769, 783, 592, 486, 957, 744, 634,
600, 761, 882, 950, 113, 682, 649, 710, 378, 274, 893, 827, 510, 73,
964, 766, 897, 36, 598, 602, 614, 856, 695, 698, 686, 225, 332, 443,
872, 642, 880, 142, 883, 965, 501, 494, 610, 714, 154, 821, 535, 341,
892, 901, 764, 703, 409, 763, 476, 98, 253, 936, 784, 648, 31, 140,
874, 2, 339, 941, 169, 961, 944, 879, 245, 752, 992, 919, 765, 189,
903, 304, 669, 102, 428, 426, 491, 994, 823, 258, 700, 672, 822, 280,
659, 406, 195, 226, 850, 440, 251, 299, 955, 499, 306, 234, 117, 347,
927, 333, 249, 489, 560, 806, 830, 550, 103, 413, 676, 481, 619, 971,
543, 584, 27, 25], dtype=torch.int32), tensor([7, 6, 6, 7, 3, 5, 7, 9, 8, 8, 2, 7, 4, 6, 5, 3, 7, 9, 0, 6, 3, 5, 1, 8,
0, 8, 4, 0, 5, 5, 4, 4, 6, 3, 5, 7, 8, 0, 4, 5, 7, 7, 9, 9, 8, 5, 4, 0,
8, 4, 8, 5, 8, 5, 8, 9, 7, 0, 3, 5, 5, 8, 4, 5, 8, 1, 3, 8, 8, 8, 8, 2,
3, 5, 8, 2, 1, 2, 8, 0, 3, 8, 3, 3, 6, 6, 8, 0, 1, 8, 3, 9, 5, 3, 4, 3,
7, 9, 4, 4, 2, 8, 3, 2, 9, 6, 2, 2, 9, 0, 7, 4, 6, 5, 0, 6, 6, 7, 5, 4,
7, 0, 3, 3, 4, 8, 2, 7, 4, 7, 0, 5, 1, 6, 9, 0, 6, 0, 1, 4, 9, 5, 6, 6,
1, 7, 1, 3, 0, 9, 9, 2, 1, 0, 7, 6, 8, 2, 8, 3, 6, 0, 1, 8, 4, 3, 2, 6,
0, 7, 9, 4, 2, 8, 0, 6, 8, 1, 0, 2, 4, 8, 9, 2, 1, 3, 7, 1, 9, 8, 7, 0,
9, 4, 6, 8, 2, 8, 3, 8])),
names=('seeds', 'labels'),
), 'item': ItemSet(
items=(tensor([505, 599, 22, 834, 218, 570, 835, 115, 645, 508, 699, 797, 755, 701,
913, 906, 295, 175, 964, 650, 210, 552, 296, 621, 961, 102, 804, 100,
397, 155, 734, 304, 957, 970, 597, 948, 928, 158, 169, 554, 19, 72,
435, 130, 558, 332, 819, 512, 739, 402, 461, 449, 916, 308, 120, 738,
823, 468, 5, 741, 260, 521, 643, 114, 709, 950, 28, 862, 146, 15,
671, 721, 910, 356, 119, 49, 896, 634, 39, 611, 237, 170, 482, 469,
926, 942, 860, 769, 422, 865, 845, 921, 536, 147, 885, 427, 70, 783,
677, 813, 40, 897, 824, 851, 486, 509, 548, 215, 809, 790, 911, 252,
430, 683, 956, 540, 869, 986, 559, 446, 429, 157, 894, 450, 21, 855,
246, 201, 900, 432, 837, 581, 843, 14, 375, 32, 163, 872, 428, 314,
639, 293, 506, 209, 562, 382, 794, 626, 578, 407, 359, 922, 86, 965,
702, 640, 827, 95, 282, 406, 801, 9, 56, 724, 204, 141, 309, 593,
213, 770, 202, 410, 320, 352, 463, 526, 197, 503, 345, 968, 383, 82,
776, 878, 612, 573, 490, 543, 126, 264, 989, 720, 904, 520, 636, 537,
664, 366, 179, 622], dtype=torch.int32), tensor([2, 1, 8, 3, 7, 6, 8, 7, 9, 8, 2, 2, 0, 7, 7, 4, 8, 5, 3, 0, 7, 6, 4, 1,
6, 4, 5, 2, 6, 8, 1, 5, 9, 5, 4, 9, 8, 4, 2, 8, 4, 8, 5, 3, 6, 7, 2, 0,
6, 4, 0, 5, 2, 8, 4, 2, 7, 8, 1, 2, 7, 7, 2, 0, 5, 9, 7, 9, 9, 6, 4, 5,
7, 1, 9, 0, 5, 1, 7, 6, 0, 5, 4, 9, 8, 2, 8, 8, 9, 5, 4, 8, 4, 9, 9, 1,
0, 6, 3, 8, 6, 6, 7, 3, 4, 6, 2, 3, 4, 4, 7, 8, 2, 6, 8, 9, 2, 4, 8, 7,
5, 3, 5, 0, 1, 0, 2, 1, 0, 1, 1, 5, 6, 8, 2, 9, 0, 4, 2, 0, 8, 4, 3, 9,
9, 6, 5, 4, 0, 2, 5, 7, 7, 0, 8, 1, 0, 8, 7, 0, 7, 3, 8, 0, 4, 3, 8, 1,
3, 8, 5, 0, 3, 2, 4, 7, 8, 3, 7, 1, 1, 2, 4, 9, 8, 0, 3, 2, 9, 0, 3, 5,
7, 2, 5, 8, 4, 0, 7, 1])),
names=('seeds', 'labels'),
)},
names=('seeds', 'labels'),
),
train_set=ItemSetDict(
itemsets={'user': ItemSet(
items=(tensor([ 72, 421, 576, 69, 582, 321, 973, 670, 890, 34, 429, 38, 963, 376,
6, 861, 336, 106, 796, 96, 733, 544, 230, 221, 5, 261, 4, 756,
811, 372, 815, 521, 417, 30, 268, 730, 271, 215, 867, 385, 277, 370,
177, 928, 843, 650, 146, 583, 147, 22, 570, 279, 505, 836, 364, 716,
857, 862, 877, 575, 353, 519, 734, 718, 938, 577, 127, 483, 471, 291,
275, 160, 989, 899, 683, 360, 798, 334, 775, 331, 176, 317, 912, 122,
18, 469, 884, 691, 159, 164, 727, 530, 172, 853, 643, 349, 654, 900,
977, 578, 924, 799, 960, 144, 794, 408, 363, 199, 407, 303, 918, 346,
187, 745, 118, 978, 949, 108, 29, 14, 313, 318, 212, 621, 749, 666,
351, 373, 805, 933, 452, 322, 201, 651, 285, 658, 635, 462, 870, 640,
616, 390, 787, 661, 384, 591, 742, 762, 474, 368, 330, 50, 739, 24,
436, 839, 202, 564, 675, 894, 772, 286, 972, 181, 905, 782, 777, 627,
37, 523, 522, 615, 294, 66, 572, 975, 97, 981, 485, 68, 466, 568,
328, 840, 709, 400, 262, 626, 506, 214, 917, 508, 149, 155, 10, 67,
618, 705, 632, 192, 524, 266, 398, 464, 921, 141, 612, 881, 913, 310,
625, 362, 12, 470, 681, 63, 208, 134, 942, 477, 937, 456, 427, 240,
315, 223, 415, 204, 925, 64, 358, 514, 236, 655, 493, 797, 391, 902,
309, 327, 641, 345, 13, 976, 637, 416, 929, 606, 835, 800, 817, 593,
222, 502, 479, 694, 57, 273, 290, 182, 207, 753, 711, 776, 685, 26,
781, 21, 435, 138, 430, 586, 833, 571, 293, 539, 723, 759, 79, 1,
515, 869, 403, 239, 468, 636, 985, 397, 719, 157, 866, 76, 979, 559,
609, 988, 388, 633, 439, 551, 463, 210, 329, 298, 660, 465, 125, 74,
352, 930, 194, 478, 653, 820, 380, 729, 885, 411, 126, 728, 237, 849,
301, 206, 16, 45, 425, 366, 597, 316, 906, 488, 387, 90, 706, 82,
325, 507, 773, 348, 52, 191, 980, 43, 923, 974, 735, 335, 995, 496,
211, 81, 837, 858, 101, 812, 813, 631, 297, 525, 946, 573, 993, 818,
873, 774, 65, 53, 692, 859, 623, 205, 693, 810, 665, 945, 93, 418,
276, 724, 825, 459, 196, 537, 396, 135, 267, 780, 677, 999, 910, 678,
907, 492, 170, 243, 504, 136, 446, 758, 846, 105, 545, 438, 558, 129,
622, 259, 84, 684, 92, 133, 48, 754, 542, 828, 722, 171, 355, 984,
788, 475, 344, 186, 860, 608, 180, 888, 314, 667, 712, 56, 554, 100,
855, 826, 982, 450, 915, 802, 256, 909, 78, 841, 991, 779, 41, 374,
47, 123, 15, 819, 131, 250, 845, 145, 23, 62, 110, 337, 242, 367,
292, 405, 257, 356, 227, 652, 704, 844, 601, 673, 552, 232, 473, 852,
736, 603, 91, 305, 200, 604, 231, 224, 441, 480, 646, 163, 198, 184,
549, 746, 19, 934, 595, 707, 381, 153, 217, 484, 896, 875, 472, 116,
516, 726, 898, 690, 513, 432, 567, 750, 889, 338, 891, 229, 886, 263,
289, 831, 579, 768, 86, 11, 60, 448, 528, 662, 89, 708, 128, 419,
32, 9, 555, 495, 269, 178, 956, 878, 216, 876, 209, 983, 120, 680,
587, 203, 699, 233, 51, 487, 795, 715, 424, 392, 375, 152, 562, 307,
410, 967, 854, 323, 359, 467, 423, 158, 228, 611, 966, 244, 83, 399,
130, 497, 300, 44, 95, 394, 863, 547, 511, 46, 865, 193, 520, 969,
748, 42, 911, 71, 431, 940, 517, 165, 970, 958, 721, 864],
dtype=torch.int32), tensor([1, 8, 2, 9, 8, 6, 7, 2, 0, 0, 5, 5, 5, 7, 9, 5, 3, 2, 1, 5, 3, 5, 3, 0,
2, 4, 2, 2, 5, 9, 8, 0, 9, 8, 7, 2, 9, 8, 2, 4, 0, 5, 2, 0, 6, 5, 4, 7,
0, 6, 4, 7, 2, 4, 1, 7, 0, 2, 2, 3, 9, 2, 4, 2, 0, 5, 5, 6, 0, 7, 0, 3,
2, 4, 9, 0, 9, 2, 7, 9, 4, 2, 3, 9, 8, 7, 0, 9, 3, 7, 8, 5, 8, 9, 9, 8,
1, 4, 7, 3, 5, 7, 4, 9, 9, 3, 6, 4, 2, 7, 3, 7, 5, 9, 8, 7, 9, 7, 5, 3,
0, 8, 4, 1, 4, 2, 3, 9, 9, 3, 7, 8, 5, 1, 5, 6, 8, 1, 3, 2, 4, 2, 4, 4,
7, 3, 3, 6, 9, 0, 2, 7, 5, 4, 2, 1, 0, 1, 7, 5, 7, 8, 0, 5, 3, 8, 7, 6,
5, 8, 8, 5, 8, 2, 2, 5, 3, 0, 9, 4, 7, 7, 8, 0, 7, 3, 7, 5, 8, 7, 6, 6,
2, 5, 8, 4, 2, 5, 2, 4, 3, 8, 6, 5, 0, 4, 2, 1, 2, 1, 9, 6, 8, 1, 5, 6,
7, 0, 8, 6, 3, 1, 4, 8, 0, 5, 3, 1, 1, 6, 3, 8, 9, 7, 8, 2, 2, 5, 5, 0,
4, 1, 3, 5, 9, 4, 5, 8, 8, 7, 6, 9, 2, 0, 4, 4, 4, 2, 9, 2, 1, 3, 3, 0,
5, 0, 8, 7, 8, 6, 5, 0, 7, 6, 1, 2, 5, 9, 9, 2, 7, 1, 0, 3, 3, 4, 1, 6,
8, 1, 3, 7, 6, 7, 5, 5, 0, 6, 9, 1, 2, 6, 3, 1, 5, 1, 0, 6, 9, 2, 8, 0,
1, 4, 4, 0, 3, 0, 1, 1, 7, 1, 9, 7, 2, 8, 2, 8, 3, 8, 6, 8, 8, 4, 2, 7,
3, 5, 5, 2, 4, 7, 4, 0, 0, 3, 2, 1, 0, 9, 4, 5, 9, 6, 2, 8, 4, 4, 7, 7,
1, 4, 3, 3, 5, 1, 6, 6, 1, 0, 0, 7, 7, 2, 0, 4, 4, 8, 0, 6, 3, 9, 4, 3,
8, 2, 7, 6, 4, 6, 1, 5, 1, 2, 1, 6, 1, 5, 3, 1, 4, 9, 3, 3, 2, 9, 7, 6,
9, 0, 5, 0, 2, 1, 7, 9, 2, 5, 6, 9, 5, 1, 1, 0, 3, 7, 7, 7, 6, 1, 7, 4,
5, 4, 0, 8, 1, 7, 6, 2, 3, 1, 4, 1, 0, 9, 0, 8, 6, 3, 0, 5, 7, 7, 5, 6,
0, 8, 9, 8, 6, 3, 0, 4, 1, 6, 7, 8, 9, 5, 4, 8, 1, 5, 4, 6, 9, 2, 7, 9,
9, 7, 1, 4, 0, 9, 4, 8, 8, 7, 7, 5, 0, 5, 2, 6, 9, 4, 5, 5, 2, 2, 1, 6,
9, 8, 6, 9, 0, 4, 2, 2, 0, 2, 6, 1, 9, 5, 2, 7, 1, 0, 9, 2, 2, 0, 7, 3,
4, 0, 2, 0, 2, 7, 5, 1, 4, 8, 9, 8, 2, 0, 6, 7, 4, 2, 4, 1, 8, 4, 0, 2,
9, 3, 6, 2, 6, 1, 3, 1, 9, 6, 5, 3, 2, 1, 0, 0, 1, 3, 4, 9, 1, 4, 2, 4,
1, 5, 5, 3, 6, 5, 4, 1, 0, 6, 7, 6, 6, 4, 1, 4, 6, 6, 4, 6, 5, 4, 5, 6])),
names=('seeds', 'labels'),
), 'item': ItemSet(
items=(tensor([846, 464, 583, 939, 300, 206, 949, 125, 697, 73, 273, 931, 856, 92,
261, 747, 580, 969, 418, 181, 632, 274, 310, 808, 269, 258, 31, 726,
67, 248, 881, 184, 278, 386, 267, 85, 814, 551, 704, 877, 144, 992,
451, 154, 342, 45, 918, 937, 227, 441, 754, 329, 731, 784, 544, 859,
291, 453, 723, 547, 748, 298, 98, 339, 625, 826, 758, 588, 614, 239,
498, 412, 744, 24, 772, 440, 893, 563, 333, 775, 596, 617, 641, 395,
753, 365, 763, 708, 780, 362, 628, 26, 97, 113, 530, 454, 54, 514,
34, 472, 510, 137, 945, 623, 663, 883, 988, 467, 433, 288, 346, 488,
816, 481, 630, 485, 925, 69, 895, 495, 978, 727, 496, 8, 99, 853,
493, 828, 924, 504, 694, 438, 364, 414, 973, 584, 341, 151, 334, 78,
479, 656, 270, 749, 953, 489, 831, 25, 574, 796, 185, 653, 854, 698,
631, 654, 299, 787, 118, 675, 620, 729, 36, 166, 618, 426, 788, 991,
122, 757, 220, 370, 538, 644, 145, 994, 613, 674, 29, 533, 91, 661,
121, 715, 303, 687, 358, 712, 648, 79, 52, 933, 200, 802, 550, 192,
249, 774, 870, 361, 379, 531, 857, 483, 830, 196, 80, 458, 760, 915,
903, 800, 234, 882, 153, 301, 873, 791, 981, 413, 33, 75, 124, 136,
595, 437, 263, 662, 605, 610, 250, 251, 416, 217, 880, 519, 637, 535,
590, 62, 394, 344, 424, 182, 756, 919, 389, 884, 759, 940, 917, 405,
728, 275, 560, 491, 89, 601, 315, 160, 629, 319, 914, 832, 203, 518,
839, 742, 999, 848, 556, 710, 909, 445, 401, 793, 889, 604, 888, 294,
162, 542, 259, 331, 243, 396, 392, 256, 254, 353, 191, 3, 223, 891,
285, 205, 53, 511, 707, 187, 10, 152, 963, 0, 598, 592, 557, 50,
355, 680, 952, 140, 875, 447, 695, 582, 448, 609, 927, 318, 106, 998,
676, 750, 87, 810, 135, 199, 591, 2, 528, 417, 35, 795, 195, 619,
30, 577, 905, 177, 977, 425, 555, 778, 138, 350, 349, 534, 979, 866,
842, 946, 81, 972, 594, 990, 736, 685, 646, 722, 960, 923, 779, 183,
439, 500, 608, 805, 11, 470, 658, 820, 850, 391, 289, 692, 235, 357,
844, 317, 257, 785, 229, 792, 659, 713, 955, 635, 279, 944, 103, 681,
908, 189, 109, 302, 627, 971, 351, 139, 328, 668, 487, 789, 705, 730,
806, 501, 684, 751, 706, 4, 42, 455, 522, 245, 545, 985, 962, 606,
777, 180, 858, 368, 515, 348, 221, 159, 938, 133, 161, 607, 718, 852,
116, 513, 984, 717, 980, 18, 890, 934, 460, 861, 198, 655, 110, 649,
68, 478, 947, 887, 398, 462, 255, 740, 7, 297, 108, 277, 111, 13,
88, 997, 283, 208, 932, 686, 651, 142, 847, 638, 867, 803, 403, 150,
228, 74, 143, 242, 214, 335, 691, 174, 117, 752, 967, 657, 678, 371,
517, 326, 23, 494, 190, 807, 65, 387, 292, 633, 421, 172, 233, 241,
771, 6, 240, 20, 372, 211, 423, 176, 164, 212, 262, 38, 502, 838,
996, 457, 886, 733, 12, 431, 863, 982, 436, 253, 525, 993, 473, 786,
381, 226, 541, 390, 954, 194, 465, 466, 929, 798, 822, 615, 64, 849,
642, 393, 672, 286, 660, 767, 566, 380, 669, 587, 384, 374, 951, 688,
313, 516, 48, 549, 107, 652, 898, 96, 564, 576, 571, 127, 761, 773,
561, 148, 415, 976, 732, 864, 935, 287, 343, 207, 83, 149, 474, 105,
123, 336, 899, 725, 714, 224, 974, 59, 337, 943, 817, 735],
dtype=torch.int32), tensor([7, 4, 2, 0, 6, 8, 6, 6, 0, 4, 5, 6, 5, 7, 3, 7, 4, 5, 6, 6, 4, 1, 4, 5,
8, 3, 5, 4, 2, 3, 3, 1, 1, 9, 7, 2, 4, 6, 8, 1, 0, 7, 4, 7, 6, 8, 4, 3,
6, 5, 9, 2, 0, 9, 8, 8, 6, 3, 2, 7, 0, 6, 3, 6, 4, 0, 1, 4, 3, 9, 2, 6,
6, 8, 5, 5, 1, 8, 6, 0, 6, 6, 2, 1, 2, 3, 8, 2, 5, 4, 1, 3, 9, 9, 2, 6,
6, 5, 6, 4, 9, 5, 0, 5, 7, 6, 5, 1, 5, 5, 7, 8, 0, 8, 4, 4, 2, 1, 1, 8,
6, 3, 1, 6, 6, 1, 5, 5, 7, 2, 1, 2, 4, 4, 1, 4, 8, 2, 0, 5, 4, 8, 6, 4,
2, 7, 9, 5, 0, 3, 5, 4, 9, 0, 6, 0, 9, 9, 5, 3, 0, 1, 5, 2, 2, 2, 2, 3,
4, 0, 7, 4, 6, 6, 0, 5, 1, 8, 8, 6, 2, 9, 9, 1, 2, 0, 7, 2, 6, 8, 2, 8,
4, 1, 5, 1, 6, 7, 5, 2, 7, 7, 3, 0, 4, 8, 4, 5, 9, 1, 4, 6, 2, 4, 8, 9,
5, 8, 6, 2, 9, 2, 7, 8, 0, 8, 8, 4, 5, 9, 1, 8, 2, 1, 6, 4, 3, 8, 5, 6,
2, 7, 6, 8, 9, 4, 3, 7, 4, 1, 8, 2, 2, 5, 5, 8, 0, 0, 5, 7, 8, 8, 1, 2,
7, 1, 0, 7, 8, 0, 5, 6, 6, 9, 6, 4, 1, 5, 5, 7, 7, 7, 9, 7, 5, 0, 3, 2,
7, 0, 1, 8, 8, 8, 1, 3, 2, 0, 0, 0, 5, 5, 0, 9, 6, 3, 7, 5, 0, 5, 4, 9,
1, 4, 2, 4, 3, 4, 4, 6, 2, 7, 0, 4, 2, 3, 6, 1, 0, 6, 5, 7, 4, 5, 7, 2,
3, 9, 1, 9, 7, 0, 1, 5, 6, 5, 9, 4, 4, 5, 8, 5, 8, 3, 4, 4, 9, 4, 4, 5,
0, 5, 5, 4, 1, 4, 0, 3, 6, 6, 0, 3, 7, 7, 4, 6, 5, 1, 5, 2, 8, 6, 9, 8,
5, 6, 6, 7, 5, 4, 5, 9, 1, 7, 3, 1, 5, 8, 6, 9, 2, 2, 8, 2, 3, 6, 0, 6,
0, 9, 8, 5, 7, 8, 3, 2, 9, 5, 3, 7, 2, 0, 8, 8, 0, 1, 9, 7, 6, 8, 1, 7,
6, 8, 6, 8, 3, 3, 5, 1, 7, 6, 3, 9, 6, 1, 1, 9, 2, 9, 9, 5, 5, 1, 0, 1,
8, 1, 6, 8, 4, 5, 2, 1, 7, 1, 6, 6, 4, 5, 9, 1, 3, 0, 1, 1, 6, 9, 7, 5,
5, 8, 6, 5, 4, 9, 1, 0, 5, 8, 5, 5, 3, 4, 2, 3, 9, 9, 3, 7, 8, 1, 6, 1,
3, 6, 9, 2, 5, 2, 5, 4, 8, 2, 9, 5, 4, 7, 0, 7, 5, 2, 2, 1, 5, 5, 6, 9,
2, 7, 7, 7, 5, 6, 5, 6, 8, 0, 0, 9, 3, 1, 9, 5, 4, 4, 7, 3, 8, 3, 4, 4,
7, 2, 7, 0, 7, 0, 0, 0, 0, 3, 8, 9, 0, 5, 2, 4, 4, 1, 9, 9, 1, 1, 0, 4,
6, 0, 3, 9, 8, 2, 1, 1, 2, 0, 2, 2, 0, 8, 4, 5, 2, 0, 4, 8, 1, 8, 7, 0])),
names=('seeds', 'labels'),
)},
names=('seeds', 'labels'),
),
test_set=ItemSetDict(
itemsets={'user': ItemSet(
items=(tensor([324, 533, 737, 156, 620, 296, 260, 932, 248, 671, 238, 536, 954, 747,
107, 247, 738, 914, 7, 657, 527, 887, 987, 990, 538, 760, 235, 540,
701, 943, 287, 740, 895, 556, 49, 541, 393, 791, 607, 751, 320, 455,
112, 88, 931, 28, 395, 785, 80, 986, 588, 137, 605, 58, 851, 916,
871, 173, 842, 731, 319, 908, 482, 40, 354, 767, 175, 789, 939, 585,
115, 61, 996, 350, 804, 132, 920, 557, 295, 0, 457, 284, 265, 757,
311, 793, 288, 449, 741, 87, 166, 688, 143, 617, 664, 197, 628, 563,
414, 220, 696, 630, 904, 770, 687, 809, 461, 679, 645, 720, 444, 77,
246, 121, 702, 213, 526, 454, 814, 951, 33, 534, 111, 668, 3, 254,
596, 264, 561, 179, 139, 647, 829, 386, 437, 689, 282, 725, 589, 447,
59, 926, 54, 382, 17, 778, 644, 460, 847, 952, 565, 953, 732, 422,
697, 786, 379, 383, 771, 599, 278, 531, 848, 252, 529, 119, 185, 553,
512, 569, 717, 935, 790, 361, 581, 713, 532, 8, 743, 401, 168, 580,
35, 434, 114, 85, 389, 188, 308, 167, 807, 342, 99, 445, 150, 357,
190, 834, 458, 312], dtype=torch.int32), tensor([1, 9, 4, 5, 8, 2, 0, 5, 7, 5, 8, 3, 1, 0, 3, 2, 0, 8, 7, 3, 0, 7, 1, 8,
2, 6, 6, 0, 5, 9, 4, 9, 0, 1, 0, 8, 3, 0, 1, 4, 9, 7, 6, 5, 6, 7, 0, 0,
1, 4, 1, 0, 1, 1, 9, 0, 4, 8, 4, 1, 0, 7, 3, 1, 3, 3, 3, 8, 4, 7, 8, 6,
5, 2, 6, 6, 8, 4, 2, 7, 1, 3, 9, 3, 5, 3, 2, 1, 3, 7, 1, 1, 4, 6, 1, 8,
7, 2, 7, 8, 0, 5, 0, 3, 2, 6, 9, 1, 0, 5, 0, 1, 7, 3, 2, 4, 6, 4, 9, 8,
6, 9, 7, 3, 3, 2, 7, 7, 9, 7, 2, 0, 4, 9, 2, 0, 7, 1, 6, 5, 2, 8, 7, 3,
4, 2, 5, 9, 4, 9, 4, 8, 0, 6, 5, 9, 8, 5, 3, 3, 9, 9, 0, 9, 2, 5, 4, 2,
6, 4, 4, 0, 5, 2, 6, 8, 8, 8, 7, 7, 0, 4, 7, 9, 9, 2, 0, 2, 5, 3, 2, 5,
9, 0, 1, 1, 0, 0, 0, 3])),
names=('seeds', 'labels'),
), 'item': ItemSet(
items=(tensor([307, 47, 829, 271, 983, 276, 821, 347, 219, 222, 902, 104, 325, 936,
323, 129, 178, 51, 16, 57, 90, 527, 354, 624, 700, 471, 975, 408,
762, 499, 27, 480, 871, 987, 711, 193, 670, 539, 719, 377, 167, 290,
378, 324, 603, 442, 280, 647, 879, 376, 600, 338, 311, 876, 216, 812,
409, 134, 575, 811, 236, 186, 572, 43, 666, 281, 941, 244, 60, 231,
444, 589, 363, 568, 841, 840, 322, 388, 703, 272, 745, 825, 71, 419,
316, 37, 306, 523, 132, 66, 230, 340, 602, 17, 567, 616, 737, 188,
569, 920, 586, 112, 367, 484, 565, 673, 475, 907, 799, 966, 369, 165,
682, 456, 265, 420, 529, 477, 912, 579, 284, 743, 321, 459, 93, 173,
404, 156, 765, 553, 443, 507, 764, 77, 385, 874, 168, 399, 476, 585,
41, 61, 716, 532, 171, 492, 411, 268, 818, 930, 101, 679, 768, 524,
360, 995, 128, 781, 815, 238, 497, 452, 546, 693, 833, 400, 901, 58,
958, 959, 690, 836, 312, 746, 667, 305, 696, 782, 84, 55, 327, 131,
330, 44, 76, 247, 373, 766, 46, 232, 689, 225, 63, 665, 266, 868,
1, 434, 94, 892], dtype=torch.int32), tensor([5, 5, 1, 4, 2, 9, 9, 7, 7, 4, 8, 6, 2, 2, 0, 6, 4, 8, 1, 8, 8, 9, 5, 5,
5, 7, 3, 8, 1, 3, 6, 8, 1, 5, 8, 1, 6, 2, 5, 0, 3, 9, 5, 9, 5, 3, 8, 5,
8, 1, 9, 9, 1, 0, 2, 1, 1, 2, 3, 0, 1, 4, 6, 6, 4, 8, 6, 3, 8, 6, 2, 5,
4, 9, 4, 9, 5, 3, 3, 0, 6, 7, 9, 7, 4, 7, 3, 0, 8, 9, 6, 9, 1, 3, 9, 7,
6, 7, 9, 1, 7, 2, 9, 2, 5, 0, 0, 1, 4, 2, 6, 9, 2, 2, 0, 1, 6, 2, 1, 2,
0, 9, 5, 6, 7, 6, 7, 6, 5, 1, 7, 2, 4, 6, 1, 1, 9, 7, 1, 5, 5, 6, 1, 8,
6, 5, 8, 6, 4, 9, 9, 4, 6, 6, 3, 5, 5, 4, 1, 8, 6, 5, 8, 7, 7, 7, 0, 7,
9, 9, 9, 5, 5, 6, 6, 1, 3, 5, 0, 0, 6, 2, 6, 3, 5, 0, 5, 9, 9, 4, 6, 1,
6, 1, 2, 9, 3, 6, 7, 5])),
names=('seeds', 'labels'),
)},
names=('seeds', 'labels'),
),
metadata={'name': 'node_classification', 'num_classes': 10},)
Loaded link prediction task: OnDiskTask(validation_set=ItemSetDict(
itemsets={'user:like:item': ItemSet(
items=(tensor([[ 32, 623],
[590, 773],
[939, 825],
...,
[579, 51],
[579, 177],
[579, 502]], dtype=torch.int32), tensor([1., 1., 1., ..., 0., 0., 0.], dtype=torch.float64), tensor([ 0, 1, 2, ..., 1999, 1999, 1999])),
names=('seeds', 'labels', 'indexes'),
), 'user:follow:user': ItemSet(
items=(tensor([[472, 775],
[478, 475],
[ 1, 33],
...,
[535, 12],
[535, 871],
[535, 465]], dtype=torch.int32), tensor([1., 1., 1., ..., 0., 0., 0.], dtype=torch.float64), tensor([ 0, 1, 2, ..., 1999, 1999, 1999])),
names=('seeds', 'labels', 'indexes'),
)},
names=('seeds', 'labels', 'indexes'),
),
train_set=ItemSetDict(
itemsets={'user:like:item': ItemSet(
items=(tensor([[685, 6],
[461, 656],
[385, 516],
...,
[627, 991],
[179, 940],
[795, 4]], dtype=torch.int32),),
names=('seeds',),
), 'user:follow:user': ItemSet(
items=(tensor([[497, 148],
[922, 403],
[975, 178],
...,
[482, 537],
[388, 50],
[332, 69]], dtype=torch.int32),),
names=('seeds',),
)},
names=('seeds',),
),
test_set=ItemSetDict(
itemsets={'user:like:item': ItemSet(
items=(tensor([[720, 330],
[397, 528],
[662, 272],
...,
[230, 337],
[230, 402],
[230, 190]], dtype=torch.int32), tensor([1., 1., 1., ..., 0., 0., 0.], dtype=torch.float64), tensor([ 0, 1, 2, ..., 1999, 1999, 1999])),
names=('seeds', 'labels', 'indexes'),
), 'user:follow:user': ItemSet(
items=(tensor([[880, 24],
[950, 968],
[544, 356],
...,
[166, 312],
[166, 270],
[166, 792]], dtype=torch.int32), tensor([1., 1., 1., ..., 0., 0., 0.], dtype=torch.float64), tensor([ 0, 1, 2, ..., 1999, 1999, 1999])),
names=('seeds', 'labels', 'indexes'),
)},
names=('seeds', 'labels', 'indexes'),
),
metadata={'name': 'link_prediction', 'num_classes': 10},)
/home/ubuntu/prod-doc/readthedocs.org/user_builds/dgl/envs/2.2.x/lib/python3.8/site-packages/dgl-2.2.1-py3.8-linux-x86_64.egg/dgl/graphbolt/impl/ondisk_dataset.py:460: DGLWarning: Edge feature is stored, but edge IDs are not saved.
dgl_warning("Edge feature is stored, but edge IDs are not saved.")