acbull / pyHGT

Code for "Heterogeneous Graph Transformer" (WWW'20), which is based on pytorch_geometric
MIT License
775 stars 162 forks source link

Script for Meta Relation Hierarchy Tree #27

Closed kexinhuang12345 closed 3 years ago

kexinhuang12345 commented 3 years ago

Hi,

Thanks for the great work. I am wondering if you can provide more details about the meta relation tree (fig 5) generation? If possible, can you provide scripts to generate this tree? Thanks!

acbull commented 3 years ago

Hi,

In the code, I explicitly save the attention value for each forward pass https://github.com/acbull/pyHGT/blob/63aec910d563da4538f5e84ee2802627350541fe/pyHGT/conv.py#L108

, which you can plot for a given input.

For the tree, I just manually select top-K children with the highest normalized attention score for visualization. If you have further questions just ask me and I can see what I can help.

kexinhuang12345 commented 3 years ago

Hi, thanks for the prompt reply. I am using the DGL version, is it true it corresponds to this variable?

https://github.com/acbull/HGT-DGL/blob/182cc56a133454770a8c1043047cb44555f79853/model.py#L57

acbull commented 3 years ago

yes, that is the attention value.