ZScoreScaling

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 ZScoreScaling(across_features: bool = False)[source]

Bases: _ScopedMethod

Standardise features to zero mean and unit variance.

Preferred over min-max when the downstream algorithm assumes roughly Gaussian inputs, since it does not let a single extreme value compress everything else into a narrow band.

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

Learn the mean and standard deviation.

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 the learned standardisation.

Parameters:
  • block – Matrix to transform.

  • state – State from fit().

Returns:

The standardised matrix.

Examples using habit.feature_preprocessing.ZScoreScaling

Custom features

Custom features

Preprocessing voxel texture before clustering

Preprocessing voxel texture before clustering