L2Normalizer

Note

This page is a reference documentation. It only explains the class signature, and not how to use it. Please refer to the Habitat Guide and Python API guide (v2.0) for usage.

class L2Normalizer[source]

Bases: object

Scale each row (voxel / supervoxel) to unit Euclidean length.

After this step clustering compares feature directions, not magnitudes. A zero-length row stays zero. There are no training statistics: fit only records the column count so a later schema change is rejected.

__init__() → None[source]
property spec: Spec

Return the algorithm specification.

fit(block: DataFrame) → Dict[str, Any][source]

Record the feature width.

Parameters:

block – Unit-by-feature matrix to learn from.

Returns:

State to pass to transform().

transform(block: DataFrame, state: Mapping[str, Any]) → DataFrame[source]

Apply per-row L2 normalisation.

Parameters:
  • block – Matrix to transform.

  • state – State from fit().

Returns:

The row-normalised matrix.