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.28k stars 196 forks source link

[RFC] Support edge weight during training #148

Closed classicsong closed 3 years ago

classicsong commented 4 years ago

Allow user to define the importance (weight) of the positive edges during training. without importance

pos_score = self.predict_score(pos_g)

with importance

pos_score = self.predict_score(pos_g) * edge_importance
zheng-da commented 4 years ago

i think you need to adjust the score on negative edges as well.

classicsong commented 4 years ago

i think you need to adjust the score on negative edges as well.

How to define the score of negative edges?

karypis commented 4 years ago

The goal of assigning weights to the triplets is to give users the ability to specify the importance of some edges. Currently, the way that users can achieve that is by replicating the same triplet multiple times. By having weights on the triplets, we can achieve the same result without the additional memory and computational overhead. Given that, the score of the negative edges needs to be adjusted so that both approaches will give the same result. This should be done in a way that takes into account the block-based approach that DGL-KE uses to corrupt the edges.

AlexMRuch commented 4 years ago

Tagging on here to also agree that having this feature would be great not only for positive weights but also negative weights (e.g., "like" and "dislike" relations).

classicsong commented 4 years ago

Tagging on here to also agree that having this feature would be great not only for positive weights but also negative weights (e.g., "like" and "dislike" relations).

Is there any related work around this idea?

AlexMRuch commented 4 years ago

Tons: https://www.cs.cornell.edu/home/kleinber/networks-book/networks-book-ch05.pdf, https://www.microsoft.com/en-us/research/video/networks-with-positive-and-negative-ties/, etc.

AlexMRuch commented 3 years ago

I just noticed that there's an edge importance score for training data now (https://aws-dglke.readthedocs.io/en/latest/format_kg.html); however, I'm not sure if edge importance can be positive as well as negative (and am not sure if this issue still needs to be open given the edge importance score now exists).