shapiq.graph¶
GraphSHAP-IQ: exact Shapley interactions of the nodes of graph neural networks.
The embedding of a node after L message passing layers depends only on the nodes within L
hops, its receptive field. GraphSHAPIQ exploits this for any game whose players are the
nodes of a graph: it evaluates the game only on subsets of the receptive fields and computes the
exact interactions from their Möbius coefficients [Muschalik et al., 2025].
GraphModelis the internal representation of a graph: its edges, nodes, node features, and the radius of the receptive fields.convert_graph()builds it from a graph oftorch_geometric.GraphBaselineImputeris theBaselineImputerof a graph: its players are the nodes, and absent nodes take the baseline node features. It calls the model as a function of node features, whichget_graph_predict_function()makes of atorchmodel.GraphSHAPIQcomputes the interactions of a game that is local on a graph.GraphExplainerexplains the graph-level output of a graph neural network with them.
Graphs and models of torch_geometric require torch and torch_geometric, which the
graph extra installs: pip install 'shapiq[graph]'. The rest needs neither.
Classes
The |
|
A graph as a graph neural network with |
|
A model as a function of the node features of masked copies of one graph. |
|
GraphSHAP-IQ computes the exact Shapley interactions of games that are local on a graph. |
Functions
Convert a graph into a |
|
Return the model as a function of the node features of masked copies of the graph. |