pytorch_geometric
pytorch_geometric copied to clipboard
How to get new node's embedding
❓ Questions & Help
GraphSAGE is a inductive methods,Can I use trained model to get new node's embedding,how to do?
I am not sure if I fully understand your question. If you have a trained model, you can of course apply it to unseen graphs.
@rusty1s What's the difference between SAGEConv
and GraphSAGE
? based on the provided example I expected that the output of GraphSAGE
would be the same as SAGEConv
which is a dictionary of key: x_dict
and value: the embeddings calculated for them. However I found out that the output is tuple of [sourceEdge, type, targetEdge]
.
Is there any way to extend the provided example with GraphSAGE
for link prediction?
SAGEConv
is the GNN operator which performs a single round of message passing. GraphSAGE
refers to the full model that stacks the SAGEConv
building blocks into a neural network architecture.
As such, the output of the encoder is indeed a dictionary that holds the node's embedding for every node type. Let me know if this clarifies things for you.
Sorry but I'm confused a little bit.
Are these two model the same?(num_layers
is confusing)
# first
GraphSAGE(in_channels=(-1, -1), hidden_channels=32, num_layers=2, out_channels=32)
# second
SAGEConv((-1, -1), 32)
SAGEConv((-1, -1), 32)
Nearly, the first one will also use a non-linearity between the two GNN layers.