xiangyue9607 / BioNEV

Graph Embedding Evaluation / Code and Datasets for "Graph Embedding on Biomedical Networks: Methods, Applications, and Evaluations" (Bioinformatics 2020)
MIT License
226 stars 77 forks source link

Use pre-trained model to compute embedding in test graph #10

Closed akastrin closed 5 years ago

akastrin commented 5 years ago

Hi,

Suppose that we have two graphs, namely training and a test graph. I wonder (1) how to train the node2vec (or any other method) model on the training graph and (2) later use this model for computing embeddings from the test graph.

The important code chunk goes as follows:

from bionev.OpenNE import node2vec
model = node2vec.Node2vec(graph=g_train, path_length=64, num_paths=32, dim=128, p=1, q=1)

Regards, Andrej

xiangyue9607 commented 5 years ago

I'm a little confused about "training graph" and "testing graph". If you were saying the two graphs are different, then none of the embedding methods included in this package can handle such cases. You need to rerun the method on the "testing graph". If you just want to train the model and then use it to compute the embedding for "unseen nodes". Then, you should refer to some "inductive graph embedding methods". E.g, [1] Revisiting Semi-Supervised Learning with Graph Embeddings [2] Inductive Representation Learning on Large Graphs

Thanks, Xiang