Skip to content

Cartesian

Cartesian(
    norm: bool = True,
    max_value: Optional[float] = None,
    cat: bool = True,
    interval: Tuple[float, float] = (0.0, 1.0),
)

Bases: BaseTransform

Saves the relative Cartesian coordinates of linked nodes in its edge features: \(\mathbf{p}_{\text{src}} - \mathbf{p}_{\text{dst}}\) for each edge, as in PyG.

Parameters:

Name Type Description Default
norm bool

If True, normalizes the coordinates to interval. Default: True

True
max_value Optional[float]

If set and norm is True, normalizes with this value instead of the largest absolute coordinate. Default: None

None
cat bool

If False, replaces the existing edge features instead of concatenating. Default: True

True
interval Tuple[float, float]

The interval of the normalized coordinates. Default: (0.0, 1.0)

(0.0, 1.0)

Example:

from mlx_graphs.transforms import Cartesian

graph = Cartesian()(graph)  # pseudo-coordinates for SplineConv
Source code in mlx_graphs/transforms/point_cloud.py
def __init__(
    self,
    norm: bool = True,
    max_value: Optional[float] = None,
    cat: bool = True,
    interval: Tuple[float, float] = (0.0, 1.0),
):
    self.norm = norm
    self.max = max_value
    self.cat = cat
    self.interval = interval

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