-
Hi everyone, I am new to this field, and I am trying to implement HAN on my own dataset without any labels. I noticed this official PyG example, but I have two questions regarding the implementation. Firstly, my dataset has four different kinds of relation between same two type of nodes, meaning that: Node type A - Link type 1- Node type A, Node type A - Link type 2- Node type A, Node type A - Link type 3- Node type A, and Node type A - Link type 4- Node type A. In this case, how shall I edit the methpaths? Secondly, can anyone give me an example on how to adjust the codes to the unsupervised link prediction tasks? Thank you all very much! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hey, sorry for late reply. In general, it is not straightforward to apply metapaths in your case, and I don't think it is particularly useful if you only have a single node type. In this case, using something like There also exists an example for link prediction via R-GCN: https://github.com/pyg-team/pytorch_geometric/blob/master/examples/rgcn_link_pred.py |
Beta Was this translation helpful? Give feedback.
I see, in this case R-GCN is still applicable but need some more work to make it work. In particular, you need to ensure that your input features are projected into a shared embedding space. This could look something like this:
where
x_dict
is coming fromHeteroData.x_dict
andedge_index
andedge_type
are coming fromHeteroData.to_homogeneous()
.