Graph network spatial convolution description 2: GraphSAGE

Paper address: Inductive Representation Learning on Large Graphs

1. The core idea

GraphSAGE believes that convolution = sampling + information aggregation (sample+aggregate).
The convolution operation is completed by sampling and information aggregation, and the difference from the GNN viewpoint is that the aggregation function has nothing to do with the order of the input, that is, the nodes in the neighborhood are out of order.

2. Implementation steps

1. Obtain a fixed number of neighborhood nodes through sampling;
2. Use aggregation functions to obtain the aggregation information of the neighborhood nodes, and obtain the embedding or features of the target point;
3. Use the aggregation information of the neighborhood nodes to aggregate to predict the target node Content or label.
Insert picture description here

Sampling method : GraphSAGE uses Uniform Sampling to sample a fixed number of neighborhood nodes. That is, uniform sampling can be repeated on the first-order connected nodes to obtain a fixed number of nodes as neighbors.

Aggregation mode :
1. Mean Aggregator: hvk ← σ (W ⋅ MEAN ({hvk − 1} ∪ {huk − 1, ∀ u ∈ N (v)}) h^k_v ← σ(W · MEAN( \{h^{k−1}_v\} ∪ \{h^{k−1}_u, ∀u ∈ N(v)\})hvkσ ( W MEAN({ hvk1}{ huk1,uN ( v ) } )
2. LSTM Aggregator (LSTM aggregation):
Compared with mean aggregation, it has stronger expressive power, but when using LSTM, it is necessary to randomly sort the neighboring nodes and input them into LSTM for aggregation.
3. Pooling aggregator (maximum value aggregation):AGGREGATE kpool = max ({σ (W poolhuik + b), ∀ ui ∈ N (v)}) AGGREGATE^{pool}_k = max(\{σ (W_{pool} h^k_{u_i} + b), ∀u_i ∈ N(v)\})AGGREGATEkpool=max({ σ(Wpoolhuik+b),uiN ( v ) } )

Implement pseudo code :
Insert picture description here

Three, contrast

Insert picture description here
Compared with GNN and traditional CNN that need to define the order of neighborhood nodes, the author of GraphSAGE believes that graph convolution neighborhood nodes are disordered .

Compared with each node in GNN having different convolution kernel parameters, all nodes in the neighborhood of each layer of GraphSAGE share the same convolution kernel parameters .

GNN selects the probability distribution of random walks for neighborhood construction, and GraphSAGE constructs neighborhoods through uniform sampling .

Four, for example

Insert picture description here

Guess you like

Origin blog.csdn.net/qq_41214679/article/details/109962451