Designing the graph convolutional layer
First, let’s talk about a problem we did not anticipate in the previous chapter. Unlike tabular or image data, nodes do not always have the same number of neighbors. For instance, in Figure 6.1, node has 3 neighbors while node only has 1:
Figure 6.1 – Simple graph where nodes have different numbers of neighbors
However, if we look at our GNN layer, we don’t take into account this difference in the number of neighbors. Our layer consists of a simple sum without any normalization coefficient. Here is how we calculated the embedding of a node, :
Imagine that node has 1,000 neighbors and node only has 1: the embedding will have much larger values than . This is an issue because we want to compare these embeddings. How are we supposed to make meaningful comparisons when their values are so vastly different?
Fortunately, there is a simple solution: dividing the embedding...