GeometricFlux.jl icon indicating copy to clipboard operation
GeometricFlux.jl copied to clipboard

Question: Is differentiation w.r.t graph supported?

Open igor-krawczuk opened this issue 3 years ago • 5 comments

For a project involving sensitivity analysis, I'd like to take the gradient of a GNN w.r.t to its inputs. Is this currently supported in GeometricFlux? If not, what would be blockers to add it? (I assume it'd have to do with the interaction of LightGraphs, Zygote and any sparsity tricks used?)

igor-krawczuk avatar Mar 15 '21 13:03 igor-krawczuk

If the GNN model is support in GeometricFlux, you can get gradient by Zygote. To my curiosity, what GNN model do you want for your project specifically?

yuehhua avatar Mar 16 '21 00:03 yuehhua

I want to study the effect of modifying edge weights and adding/removing edges across different GNNs, for this I need the gradient w.r.t to edges. (i.e., I want to check $\nabla_A h_{l+1}=MLP(h_l)+MLP(AH_{l})$ )

igor-krawczuk avatar Mar 16 '21 09:03 igor-krawczuk

Unfortunately, GNN models in this repo are not that much. If you want to change the edge weight of a graph, you may want to try GCN. If you want to change the edge weight as a feature on edge, there is no GNN model supporting edge feature in this repo.

yuehhua avatar Mar 16 '21 15:03 yuehhua

thank your very much for the information. But to clarify, if I use a weighted graph with e.g. $A=[0 1 0.5; 1 0 0 ;0.5 0 0]$, I will be able to get the dependence of an output towards that edge? Or will the gradient be lost due to some operation not tracked by Zygote?

igor-krawczuk avatar Mar 18 '21 20:03 igor-krawczuk

If you already have a weighted graph and pertub the edge weight, it is possible to get the dependence of output. If the operation is not supported by Zygote, the gradient will not be generated.

yuehhua avatar Mar 19 '21 01:03 yuehhua