-
-
Notifications
You must be signed in to change notification settings - Fork 201
🌯 🌪️ Encapsulate inverse relations #752
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
base: master
Are you sure you want to change the base?
Conversation
What's the roadmap for this PR? I think that it's fine to keep |
if dataset_instance.create_inverse_triples and not create_inverse_triples: | ||
assert dataset_instance.training.num_relations % 2 == 0 | ||
dataset_instance.training.num_relations //= 2 |
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.
We might need to keep that, if we want to be able to load from old cache files.
@@ -112,18 +115,18 @@ def __init__( | |||
else: | |||
self.loss = loss_resolver.make(loss, pos_kwargs=loss_kwargs) | |||
|
|||
self.use_inverse_triples = triples_factory.create_inverse_triples | |||
self.use_inverse_triples = create_inverse_triples |
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.
Maybe we should agree on some consistent naming
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.
let's do that in a follow-up PR, since the diff is already so big
tests/cases.py
Outdated
@@ -1083,6 +1084,7 @@ def test_score_r(self) -> None: | |||
self._test_score( | |||
score=self.instance.score_r, | |||
columns=[0, 2], | |||
# switch to effective_num_relations? |
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.
TODO - either switch to self.instance.effective_num_relations
or update the tests to new have parameters
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.
in 3104af9 I witched it to self.instance.effective_num_relations
and this made the tests pass again, except inductive GNN nodepiece
|
||
# FIXME do these need to get passed the relation inverter? or how should | ||
# this math get updated | ||
inverse_edge_index = edge_index.flip(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.
@mberr I also tracked down some issues in GNN - do you have an idea how to update the CompGCN layer to work better with the new way of doing inverses?
Fixes #749
Tasks:
inverse_triples
flags fromTriplesFactory
andDatasets
.Dependencies
New Structure
score_hrt(h, r, t)
score_h(r, t, slice_size)
score_r(h, t, slice_size)
score_t(h, r, slice_size)
score_hrt_extended(h, r, t, invert_relation)
score_h_extended(r, t, slice_size, invert_relation)
score_r_extended(h, t, slice_size, invert_relation)
score_t_extended(h, r, slice_size, invert_relation)
score_h
):predict_hrt(h, r, t, invert_relation)
predict_h(r, t, slice_size, invert_relation)
predict_r(h, t, slice_size, invert_relation)
predict_t(h, r, slice_size, invert_relation)
score_{hrt,h,t}_inverse
-> move to prediction workflows?