Skip to content

Add Support for HeteroGraphSAINTSampler in Heterogeneous GraphSAINT #10151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Gauravp2104 opened this issue Mar 29, 2025 · 0 comments
Open
Labels

Comments

@Gauravp2104
Copy link

Gauravp2104 commented Mar 29, 2025

🚀 The feature, motivation and pitch

Hi PyTorch Geometric Team,

We're using the torch_geometric.loader module extensively in our project for a Twitter bot detection task using Heterogeneous GNNs, and we would like to propose changes by adding a HeteroGraphSAINTSampler class in the loader, along with an extended addition of a HeteroGraphSAINTNodeSampler subclass.

Features

  • Uses edge connectivity to determine valid node samples for each node type
  • Reducing redundancy in the sampled nodes using torch.unique()

Key Considerations

  • The sampler first collects source nodes based on adjacency matrices before applying any selection criteria.
  • If no nodes are found for a specific type, it prevents unnecessary computations and avoids errors.

Potential API

from torch_geometric.loader import HeteroGraphSAINTNodeSampler
train_loader = HeteroGraphSAINTNodeSampler(
    data,
    batch_size={"user": 100, "tweet": 200, "list": 100},
    num_steps=1,
    sample_coverage=10,
    num_workers=0,
)

Motivation

  • Improve efficiency by only selecting nodes relevant to the task, avoiding unnecessary computations.
  • Ensures that training samples are well-distributed and diverse across the graph structure.

We are interested in discussing this further and contributing to testing to evaluate the feasibility of this feature. Looking forward to hearing from your team soon!

Alternatives

No response

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant