LogTransform

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

Bases: _ScopedMethod

Compress right-skewed features with log(x - min + 1).

The shift by the learned minimum keeps the argument positive for every value seen at fit time, so no hand-tuned offset is needed.

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

Learn the shift offsets.

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 log transform.

Parameters:
  • block – Matrix to transform.

  • state – State from fit().

Returns:

The log-transformed matrix.