MixupBase(in_dim, hid_dim, num_classes, num_layers=1, dropout=0.1, act=F.relu, rw_lmda=0.8, **kwargs)

Bases: Module

GNN mixup base model for graph data augmentation.

Parameters:
  • in_dim (int) –

    Input dimension of model

  • hid_dim (int) –

    Hidden dimension of model

  • num_classes (int) –

    Number of classes

  • num_layers (int, default: 1 ) –

    Total number of layers in model. Default: 1

  • dropout (float, default: 0.1 ) –

    Dropout rate. Default: 0.1

  • act (callable, default: relu ) –

    Activation function. Default: torch.nn.functional.relu

  • rw_lmda (float, default: 0.8 ) –

    Edge reweight hyperparameter. Default: 0.8

  • **kwargs (optional, default: {} ) –

    Additional parameters for the backbone

Notes

Architecture:

  • Multiple MixUpGCNConv layers
  • Intermediate feature mixing
  • Final classification layer
feat_bottleneck(x, edge_index, edge_index_b, lam, id_new_value_old, edge_weight)

Feature extraction and mixing through GNN layers.

Parameters:
  • x (Tensor) –

    Input node features

  • edge_index (Tensor) –

    Edge indices of original graph

  • edge_index_b (Tensor) –

    Edge indices of mixed graph

  • lam (float) –

    Mixup interpolation coefficient

  • id_new_value_old (Tensor) –

    Mapping between original and mixed node indices

  • edge_weight (Tensor) –

    Edge weights for graph convolution

Returns:
  • Tensor

    Mixed node features after GNN processing

Notes
  • Initial feature propagation (layers 0-1)
  • Feature mixing with interpolation
  • Additional layer processing (if num_layers > 2)
  • Dropout and activation at each step
feat_classifier(x)

Final classification layer.

Parameters:
  • x (Tensor) –

    Input features from bottleneck

Returns:
  • Tensor

    Classification logits for each node

Notes

Applies linear transformation to get class predictions

forward(x, edge_index, edge_index_b, lam, id_new_value_old, edge_weight)

Forward pass of the MixupBase model.

Parameters:
  • x (Tensor) –

    Input node features

  • edge_index (Tensor) –

    Edge indices of original graph

  • edge_index_b (Tensor) –

    Edge indices of mixed graph

  • lam (float) –

    Mixup interpolation coefficient

  • id_new_value_old (Tensor) –

    Mapping between original and mixed node indices

  • edge_weight (Tensor) –

    Edge weights for graph convolution

Returns:
  • Tensor

    Classification logits for each node