Final link prediction on all data using EdgeDataloader (heterogeneous graph)

Hi everyone,

I am building a heteregenous recommender system and using a EdgeDataloader when training the network. I have “m” users and “n” items, and would like to have a matrix with a size of “m*n” which contains the link probabilities. My idea is to use the embeddings such that the matrix could be constructed by the dot product. My questions is, how do we get the embeddings of all the users and items and not only a subset as we are using blocks?

Hi, are you trying to obtain the embeddings of all nodes in model::forward()? the blocks shown below is sampled from EdgeDataLoader.

def forward(self, positive_graph, negative_graph, blocks, x):
    x = self.rgcn(blocks, x)
    pos_score = self.pred(positive_graph, x)
    neg_score = self.pred(negative_graph, x)
    return pos_score, neg_score

Instead of using an EdgeDataloader to loop over edges, you can use a NodeDataLoader to iterate over all nodes as in this note. You may need to slightly modify the model class as well.

1 Like

Hi,
Yes, I am using this exact approach. Have extracted x as embeddings.
How would one extract embeddings of all nodes? Can only seem to generate blocks using the edgedataloader so I am a bit unsure what to feed the function.

Hi,

Should the NoteDataLoader be implemented in the training of the network, or only for the final predicion in order to obtain the embeddings for all the users in the network?

If you only need to make predictions between all pairs of user and item after you have trained a model, then only for the final prediction. Otherwise, it will be the other way.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.