I’m following this tutotorial: 6.3 Training GNN for Link Prediction with Neighborhood Sampling — DGL 0.7.2 documentation
I have train and test splits, but not sure how to use during the training loop.
I guess I should use the training graph like this:
dataloader = dgl.dataloading.EdgeDataLoader( train_g, train_eid_dict, sampler, negative_sampler=dgl.dataloading.negative_sampler.Uniform(5), batch_size=1024, shuffle=True, drop_last=False, num_workers=4)
However, I’m not sure of how to use the test one. I would like to use eval AUC to evaluate the model in this graph. Should I create another dataloader for this test graph in order to generate pos and neg evaluations scores during the loop?
Also, since my graphs are heterographs, I would need to adapt this AUC function:
def compute_auc(pos_score, neg_score): scores = torch.cat([pos_score, neg_score]).numpy() labels = torch.cat( [torch.ones(pos_score.shape), torch.zeros(neg_score.shape)]).numpy() return roc_auc_score(labels, scores)
Could I concatenate a the pos_score and neg_score for the different etypes in order to have just one tensor of scores, and then create another tensor with 1s and 0s? Or should I evaluate every etype separately?
Thank you so much.