snap-stanford / ogb

Benchmark datasets, data loaders, and evaluators for graph machine learning
https://ogb.stanford.edu
MIT License
1.89k stars 397 forks source link

Question: Confused about NeighborSampler in nodeproppred task #415

Closed ObsisMc closed 1 year ago

ObsisMc commented 1 year ago

Does NeighborSampler sample duplicate nodes in different batches? If so, maybe some nodes will get more than one result or some nodes never be sampled?

For example, in examples/products/graph_saint.py, when testing, the model uses a subgraph loader (NeighborSampler) to get testing data.

Subgraph loader is: https://github.com/snap-stanford/ogb/blob/d37cffa2e2cde531ca7b7e75800d331ed1e738a6/examples/nodeproppred/products/graph_saint.py#L167-L168

Testing code of model: https://github.com/snap-stanford/ogb/blob/d37cffa2e2cde531ca7b7e75800d331ed1e738a6/examples/nodeproppred/products/graph_saint.py#L41-L58

rusty1s commented 1 year ago

Yes, for GraphSAINT, there exists no notion of an epoch. We randomly sample nodes for every optimization step. For NeighborSampler and Cluster-GCN, every seed node is only sampled once per epoch.

ObsisMc commented 1 year ago

Yes, for GraphSAINT, there exists no notion of an epoch. We randomly sample nodes for every optimization step. For NeighborSampler and Cluster-GCN, every seed node is only sampled once per epoch.

Thanks.