Skip to content

RandomScale

RandomScale(scales: Tuple[float, float])

Bases: BaseTransform

Scales the node positions pos by a random factor sampled uniformly from scales (with mx.random).

Parameters:

Name Type Description Default
scales Tuple[float, float]

The (min, max) scaling factors.

required

Example:

from mlx_graphs.transforms import RandomScale

graph = RandomScale((0.9, 1.1))(graph)
Source code in mlx_graphs/transforms/point_cloud.py
def __init__(self, scales: Tuple[float, float]):
    if not isinstance(scales, (tuple, list)) or len(scales) != 2:
        raise ValueError("scales must be a (min, max) tuple")
    self.scales = tuple(scales)

from mlx_graphs.transforms import RandomScale · mlx_graphs/transforms/point_cloud.py