awslabs / dgl-ke

High performance, easy-to-use, and scalable package for learning large-scale knowledge graph embeddings.
https://dglke.dgl.ai/doc/
Apache License 2.0
1.25k stars 194 forks source link

Adding node features and edge weights in TransE Embeddings #251

Closed Maristela-de-Jesus closed 2 years ago

Maristela-de-Jesus commented 2 years ago

Hi, I am following this tutorial https://github.com/awslabs/dgl-ke/blob/master/notebook-examples/kge_wikimedia.ipynb to create Knowledge Graph Embeddings with my data. As the tutorial example, I implemented TransE with my dataset head, relation, and tail. However, my graph also has nodes features and edge weights. Is there a way to add the nodes' features and edge weights to my graph?

Thanks!

thomasthomasth commented 2 years ago

@Maristela-de-Jesus

Please take a look at the parameter _has_edge_importance_ here:

https://aws-dglke.readthedocs.io/en/latest/train.html

I think this answers your question about edge weights.

Regarding your other question - my guess is that you need to split up your graph and turn your node features into multiple nodes.

Say, if a node represents a city and the node feature is 'is_capital_of" then the node feature points to a country. Maybe it will be computationally expensive to come up with this graph that I am proposing but the advantage is that this country will be represented by a single entity only.

Maristela-de-Jesus commented 2 years ago

Thank you @thomasthomasth