Winsorizing

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 Winsorizing(winsor_limits: Tuple[float, float] = (0.05, 0.05), across_features: bool = False)[source]

Bases: object

Clip extreme values at tail quantiles instead of discarding them.

Typically the FIRST step of a voxel-level chain: MRI intensity outliers (motion, susceptibility artefacts, a few necrotic voxels) would otherwise dominate the min-max range that follows and squash the informative middle of the distribution.

Parameters:
  • winsor_limits – Lower and upper tail fractions to clip, each in [0, 0.5).

  • across_features – Pool statistics across feature columns.

__init__(winsor_limits: Tuple[float, float] = (0.05, 0.05), across_features: bool = False) → None[source]
property spec: Spec

Return the algorithm specification.

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

Learn the clipping bounds.

Parameters:

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

Returns:

State to pass to transform().

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

Clip the matrix at the learned bounds.

Parameters:
  • block – Matrix to transform.

  • state – State from fit().

Returns:

The clipped matrix.

Examples using habit.feature_preprocessing.Winsorizing

Preprocessing voxel texture before clustering

Preprocessing voxel texture before clustering

Preprocessing features before clustering

Preprocessing features before clustering