Transforms¶
Each transformation class inherits from
BaseTransformprovided by PyTorch Geometric.
AddNormalizedRandomWalkPE¶
Bases: BaseTransform
Adds the random walk positional encoding from the Graph Neural Networks with Learnable Structural and Positional Representations paper to the given graph. This is an adaptation from the original Pytorch Geometric implementation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
walk_length
|
int
|
The number of random walk steps. |
required |
attr_name
|
str
|
The attribute name of the data object to add
positional encodings to. If set to :obj: |
'random_walk_pe'
|
Source code in gridfm_graphkit/datasets/transforms.py
AddEdgeWeights¶
Bases: BaseTransform
Computes and adds edge weight as the magnitude of complex admittance.
The magnitude is computed from the G and B components in data.edge_attr and stored in data.edge_weight.
Source code in gridfm_graphkit/datasets/transforms.py
AddIdentityMask¶
Bases: BaseTransform
Creates an identity mask, and adds it as a mask attribute.
The mask is generated such that every entry is False, so no masking is actually applied
Source code in gridfm_graphkit/datasets/transforms.py
AddRandomMask¶
Bases: BaseTransform
Creates a random mask, and adds it as a mask attribute.
The mask is generated such that each entry is True with probability
mask_ratio and False otherwise.
Source code in gridfm_graphkit/datasets/transforms.py
AddPFMask¶
Bases: BaseTransform
Creates a mask according to the power flow problem and assigns it as a mask attribute.
Source code in gridfm_graphkit/datasets/transforms.py
AddOPFMask¶
Bases: BaseTransform
Creates a mask according to the optimal power flow problem and assigns it as a mask attribute.