pyagc.transforms.RandomMaskFeat

class RandomMaskFeat(p: float = 0.5, node_attrs: Optional[List[str]] = ['x'], edge_attrs: Optional[List[str]] = [], inplace: bool = False)[source]

Bases: BaseTransform

Randomly masks columns of node and/or edge feature tensors (functional name: random_mask_feat), as described in the “Graph Contrastive Learning with Augmentations” paper.

Parameters:
  • p (float, optional) – The probability of masking a feature column. Default is 0.5.

  • node_attrs (List[str], optional) – The names of node features to mask. Default is ["x"].

  • edge_attrs (List[str], optional) – The names of edge features to mask. Default is [].

  • inplace (bool, optional) – If set to False, will clone the input data object and feature tensors before applying the transform. Default is False.

__init__(p: float = 0.5, node_attrs: Optional[List[str]] = ['x'], edge_attrs: Optional[List[str]] = [], inplace: bool = False)[source]

Methods

__init__([p, node_attrs, edge_attrs, inplace])

forward(data)

Applies random feature masking to node and edge features.

forward(data: Union[Data, HeteroData]) Union[Data, HeteroData][source]

Applies random feature masking to node and edge features.

Return type:

Union[Data, HeteroData]