How to implement KAN for graphs effectively
mainBased on experimental observations, GraphKAN should be implemented in the latent feature space rather than applying KAN layers directly to input features.
Critical Requirement: You must use a nn.Linear layer to project input features into a low-dimensional latent space before passing them to the KAN layer. If you skip this linear projection and apply KANLayer directly to input features, the model will fail to receive any training signal.
Recommended Pattern:
- Use
nn.Linear(in_feat, hidden_feat)for initial projection. - Use
KANLayeron the resulting latent features.
# RECOMMENDED: Project to latent space first
self.lin_in = nn.Linear(in_feat, hidden_feat, bias=use_bias)
# ... then use KAN on the output of self.lin_in
# NOT RECOMMENDED: Direct KAN on input features (will lack training signal)
# self.lin_in = KANLayer(in_feat, hidden_feat, grid_feat, addbias=use_bias)