-
Hi everyone. Recently I've been dealing a lot with GNN link prediction models, and one of the very first steps to do is to partition the data into train, validation and testing; you know, the usual stuff. from torch_geometric.datasets import FakeDataset
from torch_geometric.transforms import RandomLinkSplit
from torch_geometric.utils import is_undirected
dataset = FakeDataset(
num_graphs=1,
avg_num_nodes=100,
num_node_types=1,
edge_dim=20,
is_undirected=True
)
transform = RandomLinkSplit(is_undirected=True)
splits = transform(dataset[0]) What I'm currently not grasping is the reason beneath providing the supervision edge index ( print(is_undirected(splits[0].edge_index)) # True
print(is_undirected(splits[0].edge_label_index)) # False Is this intended behaviour? If so, what am I currently missing? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
This is intended behavior since an undirected |
Beta Was this translation helpful? Give feedback.
This is intended behavior since an undirected
edge_label_index
would just blow up the amounts of labels artificially since one usually uses a symmetric encoder to predict the links in this scenario. If you still want to incorporate both directions as part of your labels, you can simply flip the matrix and use it for supervision as well. WDYT?