-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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 mean reciprocal rank (MRR) computation in KGEModel
#8298
Conversation
for more information, see https://pre-commit.ci
Are there any additional variables for the evaluation metrics? I couldn't understand why I faced this error after add
|
Looks like you didn't install the package with your corresponding changes? |
KGEModel
Thank you for editing! At that time, that error was evoked in the local debugging process. Now I confirmed the changes and know how it works. Again, thank you for your support :) |
@rusty1s Greetings, I'd like to ask a question about this job. When I downloaded # Reference: kge_fb15k_237.py
@torch.no_grad()
def test(data):
model_opt = model.to(device)
model_opt.load_state_dict(torch.load('checkpoint.pt', map_location=device))
model_opt.eval()
return model_opt.test(
head_index=data.edge_type_index[0],
rel_type=data.edge_type,
tail_index=data.edge_type_index[1],
batch_size=20000,
k=10
)
num_epochs = 10
train(num_epochs)
rank, mrr, hits_at_10 = test(test_data)
print(f'Test Mean Rank: {rank:.2f}, Test MRR: {mrr:.4f}, Test Hits@10: {hits_at_10:.4f}') Regards |
Which error are you seeing? What does import torch_geometric
print(torch_geometric.__version__) return? |
The error is as below:
and |
It looks like you have both PyG and
repeatedly, and then install via |
Sorry for the late reply. I fixed it. Thank you so much! |
Greetings, thank you for confirming this request.
I tried to add mean reciprocal rank (MRR) in the torch_geometric/nn/kge/base.py and examples/kge_fb15k_237.py.
(Please see the related discussion in here)
If there are any problems, please forgive me and freely edit the code.
Thanks!