GOOD.networks.models.CIGAGNN
Implementation of the CIGA algorithm from “Learning Causally Invariant Representations for Out-of-Distribution Generalization on Graphs” paper
Copied from https://github.com/LFhase/GOOD.
Functions
|
|
|
|
|
|
|
Adopt from <https://github.com/rusty1s/pytorch_scatter/issues/48>_. |
|
|
|
|
|
- GOOD.networks.models.CIGAGNN.sparse_sort(src: Tensor, index: Tensor, dim=0, descending=False, eps=1e-12)[source]
Adopt from <https://github.com/rusty1s/pytorch_scatter/issues/48>_.
- GOOD.networks.models.CIGAGNN.sparse_topk(src: Tensor, index: Tensor, ratio: float, dim=0, descending=False, eps=1e-12)[source]
Classes
|
|
|
|
|
|
|
using a simple GNN to encode spurious subgraph |
|
- class GOOD.networks.models.CIGAGNN.CIGAGIN(config: Union[CommonArgs, Munch])[source]
Bases:
GNNBasic
- forward(*args, **kwargs)[source]
The CIGA model implementation.
- Parameters
*args (list) – argument list for the use of arguments_read. Refer to
arguments_read
**kwargs (dict) – key word arguments for the use of arguments_read. Refer to
arguments_read
- Returns (Tensor):
label predictions
- class GOOD.networks.models.CIGAGNN.CIGAvGIN(config: Union[CommonArgs, Munch])[source]
Bases:
CIGAGIN
- class GOOD.networks.models.CIGAGNN.CIGAvGINNB(config: Union[CommonArgs, Munch])[source]
Bases:
CIGAGIN
- class GOOD.networks.models.CIGAGNN.CIGAvGINNC(config: Union[CommonArgs, Munch])[source]
Bases:
CIGAGIN
using a simple GNN to encode spurious subgraph
- class GOOD.networks.models.CIGAGNN.GAEAttNet(causal_ratio, config, **kwargs)[source]
Bases:
Module
- forward(*args, **kwargs)[source]
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.