Open HanChen-HUST opened 2 years ago
You can concatenate the two node embeddings and train an MLP to predict link existence, like how the node2vec paper does.
Hi Doc.Zhang ,I am using a unsupervised learning algorithm to get the node embedding to do the link prediction downstream task.z is the node embedding which I get,I want to test the whole dataset to get the AUC score,so the negative sampling I set num_val=0. and num_test=0. By the code above,do you think is a proper way to do this,and what is the proper rate to the positive edge and negative edge?For unsupervised algorithm,is it proper to test all the dataset?I am quited confused,much apperciate!bottom is my code,can you figure out whether is it correct?
from sklearn.metrics import roc_auc_score from torch_geometric import transforms as T split = T.RandomLinkSplit(num_val=0., num_test=0., is_undirected=True, add_negative_train_samples=True)
data_z = split(z)[0] src = z[data_z.edge_label_index[0]] dst = z[data_z.edge_label_index[1]] out = (src * dst).sum(dim=-1).view(-1).sigmoid() result = roc_auc_score(data_z.edge_label.cpu().numpy(), out.cpu().numpy()) print(result)
Hi,professor zhang,I can't find the Seal code to do the task link prediction.If i use a model to get the graph embedding by a unsupervised learning algorithm,what is the proper way to do the downstream task link prediction,much apperciate!