Skip to content

FixedPoints

FixedPoints(num: int, replace: bool = True, allow_duplicates: bool = False)

Bases: BaseTransform

Samples a fixed number of points (nodes) from a point cloud, with all their node-level attributes (with mx.random). Edges are left unchanged, as in PyG.

Parameters:

Name Type Description Default
num int

The number of points to sample.

required
replace bool

If True, samples with replacement. Default: True

True
allow_duplicates bool

Without replacement, whether to repeat points when num is larger than the number of points. Default: False

False

Example:

from mlx_graphs.transforms import FixedPoints

graph = FixedPoints(1024, replace=False)(graph)
Source code in mlx_graphs/transforms/point_cloud.py
def __init__(self, num: int, replace: bool = True, allow_duplicates: bool = False):
    self.num = num
    self.replace = replace
    self.allow_duplicates = allow_duplicates

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