-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
About GraphSAGE sampling on weighted graph #1961
Comments
Currently, |
Can we use sparse matrix for the edge weights? |
Do you mean using the adj_t = SparseTensor(row=row, col=col, value=edge_weight, sparse_sizes=(N, N)) |
This means we need one dense tensor storing edge weights initially. Right? I don't want to do that as that dense tensor is taking up too much GPU memory. |
Thank you for your reply.!! It was very helpful. Can I ask one more question? |
loader = NeighborSampler(edge_index, ...)
for batch_size, n_id, adjs:
for edge_index, e_id, size in adjs:
sampled_edge_weight = edge_weight[e_id] |
This comment has been minimized.
This comment has been minimized.
Can you give me a short example to illustrate this issue? |
Im sorry I found that my work example]
(In graphsage_unsupervised example code, I just replaced SAGEConv into GraphConv here)
|
You need to index select the edge weights coming from def forward(self, x, adjs, edge_weight):
for i, (edge_index, e_id, size) in enumerate(adjs):
x_target = x[:size[1]] # Target nodes are always placed first.
x = self.convs[i]((x, x_target), edge_index, edge_weight[e_id])
if i != self.num_layers - 1:
x = x.relu()
x = F.dropout(x, p=0.5, training=self.training)
for batch_size, n_id, adjs in train_loader:
...
model(x[n_id], adjs, data.edge_weight) |
For the inductive case it seems |
|
Works fine now, thanks! The documentation of |
|
I have a question about,How to generate positive and negative samples by using in this code |
We do not have support for biased/weighted sampling of random walks yet, I am sorry. |
Hi, |
Hi, @rusty1s If I just need to take an one step neighbor, can I directly select the TOP neighbor with the largest edge_weight in the current batch for each node as a positive sample? Do you think it will work? |
There is an open PR for this out, see rusty1s/pytorch_cluster#140. Maybe you can check it out to see if it fits your need. |
❓ Questions & Help
Hello.
I really appreciate for you to share such a implementation examples of GNN, However, I have a 1 short question.
I'm wondering what happens when I put weighted graph into GraphSAGE example.
Does NeighborhoodSampling consider It as unweighted(binary edge) graph?
or weight of edges affect the sampling process?
The text was updated successfully, but these errors were encountered: