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

CS224W: Added filtered evaluation setting to KGEModel #8644

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

ananjan-nandi-9
Copy link

The original implementation of KGEModel simply calculates the rank of the gold tail for any given query by considering all entities in the dataset as the candidate tail set. However, most Knowledge Graph Completion literature Bordes et al, 2013 performs evaluation in a filtered setting. For any query (h,r,?), we first filter out all t from the candidate tail set such that (h,r,t) is present in the training, validation, or test split, with the exception of the gold answer to the query. The rank is then calculated on this filtered candidate set.

This PR introduces an option to turn on this mode of evaluation. If the 'filtered' argument is set to True, and a list of tails present in the training, validation, or test set for any (head,relation) pair is passed in the 'neighbors' argument, the evaluation is performed in the filtered setting. Specifically, if (h,r,t) is present in the dataset, t is present in neighbors[h][r].

Copy link

codecov bot commented Dec 20, 2023

Codecov Report

Attention: 8 lines in your changes are missing coverage. Please review.

Comparison is base (ef13fd3) 89.87% compared to head (bf0c40b) 89.18%.
Report is 3 commits behind head on master.

Files Patch % Lines
torch_geometric/nn/kge/base.py 33.33% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8644      +/-   ##
==========================================
- Coverage   89.87%   89.18%   -0.69%     
==========================================
  Files         481      481              
  Lines       30745    30750       +5     
==========================================
- Hits        27631    27425     -206     
- Misses       3114     3325     +211     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants