Refactor the Link prediction decoder and loss function design.
- Dominant language
- Python
- Stars
- 452
- Forks
- 76
- PR merge metrics
- No merged PRs in 30d
Description
Currently, the implementation of computing losses for link prediction training (in GSgnnLinkPredictionModel.forward) is not friendly to loss functions like contrastive loss and triple loss which requires that a positive edge is grouped with its corresponding negative edges.
The current implementation is tricky. the LinkPredictContrastiveDotDecoder and LinkPredictContrastiveDistMultDecoder is implemented based on the assumption that the same decoder.forward will be called twice with a positive graph and negative graph respectively. And the positive and negative graphs are compatible. We can simply sort the edges in postive and negative graphs to create pairs. This implementation makes strong assumption of the correlation between the Dataloader, Decoder and the Loss function. We should find a better implementation.
Contributor guide
Research direction
Start with GSgnnLinkPredictionModel.forward and trace how LinkPredictContrastiveDotDecoder and LinkPredictContrastiveDistMultDecoder receive positive and negative graphs. Compare that flow with the grouping requirements of contrastive and triple losses. Done means the decoder, dataloader, and loss interfaces no longer depend on implicit edge ordering or calling the decoder twice.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- machine-learning
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100