The difference between NeighborSampler and NeighborLoader during training of the model #7861
-
I'm currently studying GraphSAGE, and I've noticed that there are two types of samplers for sampling: NeighborSampler and NeighborLoader. However, they return iterators with different data types. The way I pass parameters for each SAGE layer in the model's forward function is also different, and there are differences in the train function as well. I'm not sure what the difference is between these two approaches.
Additionally, I'd like to know if the number of SAGE layers in a GNN model is the same as the depth K in the GraphSAGE algorithm. Does the number of SAGE layers represent the hop of aggregated neighbors? How should I understand the num_neighbors in the NeighborLoader? How are these depth, layer, and hop related? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
NeighborSampler was deprecated so that you could use NeighborLoader. |
Beta Was this translation helpful? Give feedback.
NeighborSampler was deprecated so that you could use NeighborLoader.
Yes, the number of SAGE layers in a GNN model is the same as the depth K in the GraphSAGE algorithm.
num_neighbors [25,10] means, first hop, the target node will sample 25 neighbors of it, and then these nodes(<=26) will sample 10 neighbors of them. So one mini-batch ( aka one subgraph) will have <=260 nodes.