Skip to content
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

🔮〰️ Update Prediction Filtering #1048

Merged
merged 20 commits into from
Aug 2, 2022
Merged

Conversation

mberr
Copy link
Member

@mberr mberr commented Aug 1, 2022

This (draft) PR introduces support for more complex prediction filtering, e.g., with multiple filter triples sets.

It does not (yet) expose this functionality to public.

related to #1040

tests/test_prediction.py Outdated Show resolved Hide resolved
@mberr mberr marked this pull request as ready for review August 2, 2022 11:44
@mberr mberr requested a review from cthoyt August 2, 2022 12:13
@mberr mberr changed the title Update Prediction Filtering 🔮〰️ Update Prediction Filtering Aug 2, 2022
src/pykeen/models/predict.py Outdated Show resolved Hide resolved

def filter(self, df: pd.DataFrame) -> pd.DataFrame:
"""
Filter out known triples.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should mention in docstring this is not an in-place operation, maybe should give the possibility for both ways?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

c3ac29f

So far, we do not have a use-case for in-place operations, so I would defer the implementation until then 😉

src/pykeen/models/predict.py Outdated Show resolved Hide resolved
src/pykeen/models/predict.py Outdated Show resolved Hide resolved
),
test_elements=mapped_triples,
)
.cpu()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe better to return the torch tensor then just cpu().numpy() in the place where it gets used?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, we need cpu().numpy() everytime we call this function, so I would leave it as it is for now.

@cthoyt
Copy link
Member

cthoyt commented Aug 2, 2022

Besides minor code comments I think this is fine, if it matches existing functionality then great. Will you later add some more high-level documentation when you're ready to expose to the public?

@mberr mberr requested a review from cthoyt August 2, 2022 14:10
@mberr mberr enabled auto-merge (squash) August 2, 2022 14:14
@mberr mberr marked this pull request as draft August 2, 2022 14:38
auto-merge was automatically disabled August 2, 2022 14:38

Pull request was converted to draft

@mberr mberr marked this pull request as ready for review August 2, 2022 14:38
@mberr mberr merged commit 372e7b6 into master Aug 2, 2022
@mberr mberr deleted the update-prediction-filtering branch August 2, 2022 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants