Trying to understand how nodeNeighborhood loader works #4216
Replies: 1 comment 2 replies
-
You are right that the implementation does that change much when swapping out The Note that GAT does not need all nodes to learn the correct weight matrix. Attention is computed across the neighborhood (and not all nodes), while parameters are shared for each node. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
After looking through the code and implementing the loader myself I am still a little confused as to how the loader works. If I am trying to utilize the loader on a 2 layer GAT that utilizes all of the neighbors then I would give [-1,-1] to the num_neighbors param in the loader. My understanding is that for each node sampled, this would create a two-hop subgraph that starts from the sampled node and move up to its parents. As such, for each sampled node, all the needed information is propagated down to create its representation. Moreover, if we optimized only after running through the entire loader versus if we optimized over the entire graph, then the update should be very similar.
If this is how the loader works then, for GAT, when passing in each batch from the loader we should be passing in all the nodes within the overall graph, not just the nodes related to that batch. Looking through the code it seems like each batch only considers the nodes being sampled and their 2-hop neighborhood. Doesn't GAT need all the nodes in the overall graph to learn the correct weight matrix? When comparing a GAT trained using a node neighborhood loader and a GAT trained over the entire graph at once and the GAT that considers the entire graph provides much better performance. Even increasing the batch size does not improve the performance of the GAT trained on the node neighborhood loader. Most of the examples provided in the Pytorch geometric github related to node neighborhood loader utilize the SAGEconv when creating the network. Looking through the code for SAGEConv there doesn't seem to be anything special that would be needed to be added to the GAT layer to make it work with the loader. However, given the negative results, I am beginning to think I don't understand how the loader is implemented.
Beta Was this translation helpful? Give feedback.
All reactions