dgn.toy_dgn

class pydgn.model.dgn.toy_dgn.ToyDGN(*args: Any, **kwargs: Any)

Bases: pydgn.model.interface.ModelInterface

A toy Deep Graph Network used to test the library

forward(data: torch_geometric.data.Batch) Tuple[torch.Tensor, Optional[torch.Tensor], Optional[List[object]]]

Implements an Toy DGN with some SAGE graph convolutional layers.

Parameters

data (torch_geometric.data.Batch) – a batch of graphs

Returns

the output depends on the readout passed to the model as argument.

class pydgn.model.dgn.toy_dgn.ToyDGNTemporal(*args: Any, **kwargs: Any)

Bases: pydgn.model.interface.ModelInterface

Simple Temporal Deep Graph Network that can be used to test the library

forward(snapshot: Union[torch_geometric.data.Data, torch_geometric.data.Batch], prev_state=None)

Implements an Toy Temporal DGN with some DCRNN graph convolutional layers.

Parameters
  • snapshot (Union[Data, Batch]) – a graph or batch of graphs at timestep t

  • prev_state (torch.Tensor) – hidden state of the model (previous time step)

Returns

the output depends on the readout passed to the model as argument.

dgn.toy_mlp

class pydgn.model.dgn.toy_mlp.ToyMLP(*args: Any, **kwargs: Any)

Bases: pydgn.model.interface.ModelInterface

A toy MLP model used to test the library. Technically, a DGN that ignores the adjacency matrix.

forward(data: torch_geometric.data.Batch) Tuple[torch.Tensor, Optional[torch.Tensor], Optional[List[object]]]

Implements an MLP (structure agnostic baseline)

Parameters

data (torch_geometric.data.Batch) – a batch of graphs

Returns

a tuple (output, node_embedddings)