New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ratio adjustment in RandomLinkSplit
when not enough negative edges exist
#5642
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5642 +/- ##
=======================================
Coverage 83.87% 83.87%
=======================================
Files 349 349
Lines 19207 19213 +6
=======================================
+ Hits 16109 16115 +6
Misses 3098 3098
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
assert len(train_data.neg_edge_label) != 0 | ||
assert len(val_data.neg_edge_label) != 0 | ||
assert len(test_data.neg_edge_label) != 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we check here for the actual returned number of edges? I guess it may be
assert len(train_data.neg_edge_label) == 1
assert len(val_data.neg_edge_label) == 1
assert len(test_data.neg_edge_label) == 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They're all non-zero, but yes we can check the exact size, I'll add that.
Co-authored-by: Matthias Fey <matthias.fey@tu-dortmund.de>
Co-authored-by: Matthias Fey <matthias.fey@tu-dortmund.de>
e16ec3a
to
259e6ce
Compare
…ges exist (pyg-team#5642) * add handling for not enough negative edges in random link split * add readme * Update torch_geometric/transforms/random_link_split.py Co-authored-by: Matthias Fey <matthias.fey@tu-dortmund.de> * Update torch_geometric/transforms/random_link_split.py Co-authored-by: Matthias Fey <matthias.fey@tu-dortmund.de> * update tests * typos * typo Co-authored-by: Matthias Fey <matthias.fey@tu-dortmund.de>
This change addresses #5581
The problem being solved is that it is possible for there to not be enough negative edges available to satisfy the requested sampling ratio.
This change makes it so that in this case the ratio assigned to each split should reflect the desired ratio between the splits. I.e, the % assigned to each of train, test and validation is the same as requested.