GCL.augmentors¶
Available Augmentors¶
|
|
|
Base class for graph augmentors. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Structure Augmentors¶
Attribute Augmentors¶
Functional Interface¶
- class AdaptivelyAugmentTopologyAttributes(edge_weights, feature_weights, pe=0.5, pf=0.5, threshold=0.7)¶
- class AugmentTopologyAttributes(pe=0.5, pf=0.5)¶
- add_edge(edge_index, ratio)¶
- Return type
Tensor
- coalesce_edge_index(edge_index, edge_weights=None)¶
- Return type
(<class ‘torch.Tensor’>, <class ‘torch.FloatTensor’>)
- compute_markov_diffusion(edge_index, edge_weight=None, alpha=0.1, degree=10, sp_eps=0.001, add_self_loop=True)¶
- compute_ppr(edge_index, edge_weight=None, alpha=0.2, eps=0.1, ignore_edge_attr=True, add_self_loop=True)¶
- drop_edge_by_weight(edge_index, weights, drop_prob, threshold=0.7)¶
- drop_feature(x, drop_prob)¶
- Return type
Tensor
- drop_feature_by_weight(x, weights, drop_prob, threshold=0.7)¶
- drop_node(edge_index, edge_weight=None, keep_prob=0.5)¶
- Return type
(<class ‘torch.Tensor’>, typing.Union[torch.Tensor, NoneType])
- dropout_feature(x, drop_prob)¶
- Return type
FloatTensor
- get_degree_weights(data)¶
- get_eigenvector_weights(data)¶
- get_feature_weights(x, centrality, sparse=True)¶
- get_mixup_idx(x)¶
Generate node IDs randomly for mixup; avoid mixup the same node.
- Parameters
x (
Tensor
) – The latent embedding or node feature.- Returns
Random node IDs.
- Return type
torch.Tensor
- get_pagerank_weights(data, aggr='sink', k=10)¶
- get_sparse_adj(edge_index, edge_weight=None, add_self_loop=True)¶
- Return type
Tensor
- get_subgraph(x, edge_index, idx)¶
- mixup(x, alpha)¶
Randomly mixup node embeddings or features with other nodes’.
- Parameters
x (
Tensor
) – The latent embedding or node feature.alpha (
float
) – The hyperparameter controlling the mixup coefficient.
- Returns
Embeddings or features resulting from mixup.
- Return type
torch.Tensor
- multiinstance_mixup(x1, x2, alpha, shuffle=False)¶
Randomly mixup node embeddings or features with nodes from other views.
- Parameters
x1 (
Tensor
) – The latent embedding or node feature from one view.x2 (
Tensor
) – The latent embedding or node feature from the other view.alpha (
float
) – The mixup coefficient lambda follows Beta(lpha, lpha).shuffle – Whether to use fixed negative samples.
- Returns
Spurious positive samples and the mixup coefficient.
- Return type
(torch.Tensor, torch.Tensor)
- permute(x)¶
Randomly permute node embeddings or features.
- Parameters
x (
Tensor
) – The latent embedding or node feature.- Returns
Embeddings or features resulting from permutation.
- Return type
torch.Tensor
- random_walk_subgraph(edge_index, edge_weight=None, batch_size=1000, length=10)¶
- sample_nodes(x, edge_index, sample_size)¶