[DO NOT MERGE] Add `compute_mrr_seeds`.
Description
Add compute_mrr_seeds to link_prediction examples. This function will be used after the modification of the datasets.
The time is longer than original due to len(dataloader_seeds) > len(dataloader_original) as neg_dst are flattend in new dataset.
Also RetrievalMRR() provided by torchmetrics will cost longer time compared with original implementation.
Dataset
original:
node_pairs: [[1,2], [3,4], [5,6], [7,8]] neg_dst: [[1,2,3,4,5], [11,12,13,14,15], [21,22,23,24,25], [31,32,33,34,35]]
seeds:
seeds: [[1,2], [3,4], [5,6], [7,8], [1,1], [1,2], [1,3], [1,4], [1,5], [3,11], … , [7,34], [7,35]] labels: [1, 1, 1, 1, 0, 0, … , 0, 0] indexes: [0, 1, 2, 3, 0, 0, 0, 0, 0, 1, 1, … , 3, 3]
Performance
| original | seeds | |
|---|---|---|
| Training | 17.96 it/s ; 55:05 min | 18.45 it/s ; 53:37 min |
| Node embedding inference | 223.89 / 212.75 / 215.00 it/s ; 12 /13 /13 (s) | 209.67 / 197.59 / 195.86 it/s ; 13 / 14 / 14 (s) |
| evaluation | 37 s | 66 s |
| validation MRR | 0.7983 | 0.7949 |
| test MRR | 0.7987 | 0.7943 |
Checklist
Please feel free to remove inapplicable items for your PR.
- [ ] The PR title starts with [$CATEGORY] (such as [NN], [Model], [Doc], [Feature]])
- [ ] I've leverage the tools to beautify the python and c++ code.
- [ ] The PR is complete and small, read the Google eng practice (CL equals to PR) to understand more about small PR. In DGL, we consider PRs with less than 200 lines of core code change are small (example, test and documentation could be exempted).
- [ ] All changes have test coverage
- [ ] Code is well-documented
- [ ] To the best of my knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change
- [ ] Related issue is referred in this PR
- [ ] If the PR is for a new model/paper, I've updated the example index here.
Changes
To trigger regression tests:
-
@dgl-bot run [instance-type] [which tests] [compare-with-branch]; For example:@dgl-bot run g4dn.4xlarge all dmlc/masteror@dgl-bot run c5.9xlarge kernel,api dmlc/master
Let's leave this as draft, and merge it once the end to end code is ready to clean up.