Graph Convolution Network (GCN) Layer
Representation Learning, Advanced Theory & Miscellaneous DS practice problem on Onlearn.
Difficulty: medium.
Topics: Graph Convolution Network (GCN) Layer, Adjacency Matrix Normalization, Laplacian Smoothing, Weight Matrix Transformation, Non-linear Activation Functions, Feature Propagation, Graph Theory, Linear Algebra, Deep Learning, Spectral Analysis, Statistical Learning, Message Passing, Matrix Factorization, Neural Network Architectures, Eigenvalue Decomposition, Regularization Techniques.
Task: Implement a Graph Convolution Network (GCN) Layer Your task is to implement the forward pass of a single Graph Convolutional Network (GCN) layer as introduced by Kipf & Welling (2017). A GCN layer aggregates information from a node's neighbors in a graph and transforms it using a learnable weight matrix, followed by a ReLU activation. Write a function gcn layer(A, X, W) that takes: A: An adjacency matrix of shape (N, N) representing the graph structure, where N is the number of nodes. A[i][j] = 1 means there is an edge between node i and node j. X: A node feature matrix of shape (N, F in) where F in is the input feature dimension. W: A weight matrix of shape (F in, F out) where F out is the output feature dimension. The function should return the output node feature matrix of shape (N, F out) after applying: 1. Self loop augmentation of the adjacency matrix 2. Symmetric degree normalization of the augmented adjacency matrix 3. Neighborhood aggregation combined with the linear transformation 4. ReLU activation All inputs will be numpy arrays with float values.