Pinsage how to add node features?

Hi - I know that the current implementation of pinsage doesn’t use the node features of the “user”. How could I adjust the model to make use of that?

Would this require a significant change to the model? I was thinking the loss function could potentially stay the same, I assume additionally we would learn node representations for the “user” as well as the “items”.

I think PinSage’s computation only involves item nodes and it is an item similarity model; user nodes only participate in sampling, i.e. connecting item nodes to other item nodes. Even if the user nodes have features, they are not involve in the computation in any way.

Yes, but I assume the computation could be altered to also include user features? Do you think the current DGL implementation of PinSAGE would limit such alteration?

Another question is also with certain tweaks - would the addition of another node - e.g. user, item, store - be possible on the PinSAGE model?

Thanks!

Hmm technically you could also apply the same methodology to compute user embeddings. Basically you can flip the role of item nodes and the user nodes. In this case you probably don’t need to change the model implementation - you might only need to flip things like item_ntype and user_ntype.

As per adding another node, since PinSAGE is only designed for bipartite graphs, I don’t think PinSAGE can work natively on e.g. tri-partite graphs. However, you could define your own sampler in sampler.py and replace it with your own metapaths involving users, items, and stores. Namely, you can replace PinSAGESampler in dgl/examples/pytorch/pinsage/sampler.py at master · dmlc/dgl · GitHub with dgl.sampling.RandomWalkNeighborSampler.

Yeah but for the user embeddings - unless we change the way loss is calculated I don’t think the model learns these embeddings?

I basically added another Linear projector to pass it through to get the embeddings (flipping things basically) however I’m not sure how user embeddings would be updated since the loss function is entirely based on item-item graphs etc. Do you think these would also have to be changed to user-item graphs? (the pos_graph and neg_graph etc.)

Yeah - in this case you probably do want to change the loss function to include both user and item terms, e.g. Bayesian Personalized Ranking.

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