-
I have Data that looks like this (it is a toy example with 50 users and 123 features) I'm looking to train a GCN with batches and add in the Graphsage idea of neighbor sampling. So, I used NeighborLoader. The result you get from NeighborLoader looks something like this. `0: Data(x=[32, 123], edge_index=[2, 220], edge_attr=[220], pos_edge_labels=[2, 358], neg_edge_labels=[2, 358], n_id=[32], e_id=[220], input_id=[16], batch_size=16) 1: Data(x=[36, 123], edge_index=[2, 190], edge_attr=[190], pos_edge_labels=[2, 358], neg_edge_labels=[2, 358], n_id=[36], e_id=[190], input_id=[16], batch_size=16) 2: Data(x=[37, 123], edge_index=[2, 215], edge_attr=[215], pos_edge_labels=[2, 358], neg_edge_labels=[2, 358], n_id=[37], e_id=[215], input_id=[16], batch_size=16) 3: Data(x=[25, 123], edge_index=[2, 55], edge_attr=[55], pos_edge_labels=[2, 358], neg_edge_labels=[2, 358], n_id=[25], e_id=[55], input_id=[2], batch_size=2)` The thing is, I'm having a bit of trouble with those pos_edge_labels and neg_edge_labels, especially when messing around with the recon_loss function in the autoencoder module. Right now, I'm sort of manually going through the tensor, checking if I spot that ID in the data.edge_index. But, you know, I'm kind of hoping for something more general. Do you believe it would be beneficial to incorporate a checker (e.g., self.pos_neg: bool = None) into the class and extend the functionality to update positive and negative edges in a manner analogous to edge_index? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
What does |
Beta Was this translation helpful? Give feedback.
-
Thanks for your reply. Similar to GraphSage, my objective is to be close to positive pairs while being away from negative pairs. The way I generated them is as follows. For instance, consider node 1; nodes reachable within 6 walk lengths (using random walk) are considered positive pairs, whereas nodes beyond this walk length are considered negative. I applied negative sampling as I did not want to consider all negative nodes. NeighborLoader picks the exact number of nodes (uniform number of nodes in each batch), whereas LinkNeighborLoader picks the exact number of edges (uniform number of edges in each batch). Since |
Beta Was this translation helpful? Give feedback.
What does
pos_edge_labels
andneg_edge_labels
mean? Positive and negative links for supervision? I would assume you instead want them to input asedge_label_index
inLinkNeighborLoader
. Would that fit your use-case?