mlx_graphs.transforms.FeaturesNormalizedTransform

mlx_graphs.transforms.FeaturesNormalizedTransform#

class mlx_graphs.transforms.FeaturesNormalizedTransform(attributes: List[str] = ['node_features'])[source]#

Bases: BaseTransform

Methods

process(data)

Normalizes the attributes given in the attributes to sum up to one

process(data: GraphData | GraphDataBatch) GraphData | GraphDataBatch[source]#

Normalizes the attributes given in the attributes to sum up to one

Parameters:

data (Union[GraphData, GraphDataBatch]) – A GraphData object with node/edge features

Return type:

Union[GraphData, GraphDataBatch]

Returns:

A GraphData object with normalized features (either edges/node features unless specified in the transform)

Example:

from mlx_graphs.datasets import EllipticBitcoinDataset
from mlx_graphs.transforms import FeaturesNormalizedTransform

dataset = EllipticBitcoinDataset(transform=FeaturesNormalizedTransform())
# All the node features (if present) for this graph are normalized