BUPT-GAMMA / OpenHGNN

This is an open-source toolkit for Heterogeneous Graph Neural Network(OpenHGNN) based on DGL.
Apache License 2.0
816 stars 139 forks source link

Obtaining metapaths and attention scores #213

Closed almas2019 closed 4 months ago

almas2019 commented 5 months ago

❓ Questions and Help

Hi I noticed in the FastGTN paper that they point out the top metapaths. My question is, how do you extract these specific metapaths? I have data where I want to find the best metapaths but I don't know the metapaths before hand (ex. I don't know author-paper-author is a metapath), can I specify a dataset without metapaths and have the model produce metapaths. I don't see a function for this. Also, I am assuming that the attention scores in the model is the A_hat. If not, how do we get the attention scores?

Thanks in advance

lazishu2000 commented 4 months ago

The original article indeed contains the description: "transform an original graph into new graphs that preclude noisy connections and include useful multi-hop connections (e.g., meta-paths)." In our implementation, we followed the design of the paper's source code, specifically, to "Extract a graph list where every graph just contains a relation." The function that accomplishes this task is "transform_relation_graph_list," located at "OpenHGNN/openhgnn/utils/utils.py." The attention scores you mentioned should be found within the GTLayer. For specific details, you can refer to the README.md of that model.