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

Implemented evaluator for link-prediction in retrieval setting #667

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

wangz10
Copy link
Collaborator

@wangz10 wangz10 commented Nov 27, 2023

Issue #, if available:

Description of changes:

  • This PR enables lp_infer.py to evaluate a trained link-prediction model in retrieval setting, where all nodes of the target type are used as negative samples. To perform this evaluation:
    • need to pass --eval-negative-sampler full to python3 -m graphstorm.run.gs_link_prediction --inference
    • need to provide trained model (--restore-model-path) and saved GNN embeddings (--restore-embed-path)
  • implementation details:
    • GSgnnLinkPredictionRetrievalDataLoader: a data loader yielding pos pairs only
    • load_gsgnn_embeddings util function to load GNN embeddings from disk
    • LinkPredictDotDecoder.calc_retrieval_scores: method to compute dot product scores with pos pairs and all embs as neg pairs

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@wangz10 wangz10 added the draft label only to be used by dev team - skips CI for small changes label Nov 27, 2023
@@ -872,6 +872,33 @@ def save_full_node_embeddings(g, save_embed_path,

save_shuffled_node_embeddings(shuffled_embs, save_embed_path, save_embed_format)

def load_gsgnn_embeddings(emb_path, g):
Copy link
Contributor

Choose a reason for hiding this comment

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

we didn't have a function to load GNN embeddings saved by GraphStorm? @classicsong

@classicsong classicsong added the ready able to trigger the CI label Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
draft label only to be used by dev team - skips CI for small changes ready able to trigger the CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants