GOOD.networks.models.DANNGCNs

GCN implementation of the DANN algorithm from “Domain-Adversarial Training of Neural Networks” paper

Classes

DANN_GCN(config)

The Graph Neural Network modified from the "Domain-Adversarial Training of Neural Networks" paper and "Semi-supervised Classification with Graph Convolutional Networks" paper.

GradientReverseLayerF(*args, **kwargs)

Gradient reverse layer for DANN algorithm.

class GOOD.networks.models.DANNGCNs.DANN_GCN(config: Union[CommonArgs, Munch])[source]

Bases: GNNBasic

The Graph Neural Network modified from the “Domain-Adversarial Training of Neural Networks” paper and “Semi-supervised Classification with Graph Convolutional Networks” paper.

Parameters

config (Union[CommonArgs, Munch]) – munchified dictionary of args (config.model.dim_hidden, config.model.model_layer, config.dataset.dim_node, config.dataset.num_classes, config.dataset.num_envs)

forward(*args, **kwargs) Tuple[Tensor, Tensor][source]

The DANN-GCN 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, domain predictions]

class GOOD.networks.models.DANNGCNs.GradientReverseLayerF(*args, **kwargs)[source]

Bases: Function

Gradient reverse layer for DANN algorithm.

static backward(ctx, grad_output)[source]

gradient backpropagation step

Parameters
  • ctx (object) – object of the GradientReverseLayerF class

  • grad_output (Tensor) – raw backpropagation gradient

Returns (Tensor):

backpropagation gradient

static forward(ctx, x, alpha)[source]

gradient forward propagation

Parameters
  • ctx (object) – object of the GradientReverseLayerF class

  • x (Tensor) – feature representations

  • alpha (float) – the GRL learning rate

Returns (Tensor):

feature representations