[Question] --has_edge_importance
ccvalley opened this issue · 1 comments
ccvalley commented
When using the --has_edge_importance argument in the dglke_train function, is a higher edge importance score weighted as more important than a lower edge importance score? Or vice versa?
Based on the get_total_loss
function, it seems that a lower edge weight would be more favorable in the loss calculation.
dgl-ke/python/dglke/models/pytorch/loss.py
Lines 69 to 77 in b4e5701
Thank you.
def get_total_loss(self, pos_score, neg_score, edge_weight=None):
log = {}
if edge_weight is None:
edge_weight = 1
if self.pairwise:
pos_score = pos_score.unsqueeze(-1)
loss = th.mean(self.loss_criterion((pos_score - neg_score), 1) * edge_weight)
log['loss'] = get_scalar(loss)
return loss, log
classicsong commented
The higher edge_weight, it means it will contribute more to the loss.
Usually you can assign higher weight to low frequency relations, to handle the data imbalance problem.