add_attr_noises
- class add_attr_noises(dataset: Dataset, mode: str, noise_ratio: float, gids: int | List[int] | Tuple[int, ...] | None = None, seed: int | None = None, inplace: bool = False)[source]
Bases:
Add attribute noise to graphs in a PlanetAlign dataset by perturbing node attributes.
- Parameters:
dataset (PyG dataset) – The input dataset containing graphs.
mode (str) – The mode of noise to add. Options are ‘flip’ or ‘gaussian’.
noise_ratio (float) – The ratio of attributes to flip in each graph.
gids (int, list of int, or tuple of int) – The graph IDs to perturb. If None, all graphs will be perturbed.
seed (int, optional) – Random seed for reproducibility.
inplace (bool, optional) – If True, modify the dataset in place. Otherwise, return a new dataset.
- Returns:
The dataset with perturbed attributes.
- Return type:
PyG dataset