cynricfu / MAGNN

Metapath Aggregated Graph Neural Network for Heterogeneous Graph Embedding
388 stars 68 forks source link

A question about etype list in link predition #32

Closed HEI-MENGZHE closed 2 years ago

HEI-MENGZHE commented 2 years ago

I have a question about etype list in run_LastFM.py.

etypes_lists = [[[0, 1], [0, 2, 3, 1], [None]],
                [[1, 0], [2, 3], [1, None, 0]]]

expected_metapaths = [
    [(0, 1, 0), (0, 1, 2, 1, 0), (0, 0)],
    [(1, 0, 1), (1, 2, 1), (1, 0, 0, 1)]
]

Why is the etype of the (0,0) is None? Is it because the link of the same type of node is not important? If the node type is the same for the two end nodes of the links I want to predict, should I assign a type to (0,0)?

cynricfu commented 2 years ago

etypes_lists is used for the relational rotation metapath instance encoder, which is inspired by the RotatE knowledge graph embedding model. If a relation is symmetric (like the user-user friend relation in Last.fm), then the relation vector between them should contain only 1 or -1. I think 1 would be appropriate, then this just means I don’t need to have relation vectors to do any complex space rotation. So I use None here to indicate symmetric relation (edge type).

HEI-MENGZHE commented 2 years ago

Thanks, I may need to get a better understanding of the RotatE knowledge graph embedding model.