Skip to content

Robust Normalizer

Robust Normalizer¤

neojax.data.normalizers.robust_normalizer.RobustNormalizer ¤

Normalizes data using median and interquartile range.

This normalizer is robust to outliers as it uses the median and the interquartile range (IQR).

Parameters:

Name Type Description Default
median float | Float[Array, ...] | None

Optional median for dynamical scaling. Default is None, i.e., use learned median from self.stats.

None
scale float | Float[Array, ...] | None

Optional interquartile range for dynamical scaling. Default is None, i.e., use learned iqr from self.stats.

None
quantile_range tuple[float, float]
(25.0, 75.0)
Internal Attributes

These fields store the internal state of the normalizer.

  • quantile_range (tuple[float, float]): The lower and upper quantile bounds.
  • stats (dict[str, Float[Array, ...] | None]): Dict containing 'median' and 'scale' (iqr).
median property ¤

Accessor for the median stored in stats.

scale property ¤

Accessor for the scale stored in stats.

compute_stats(data: Float[Array, 'c ...'], axis: int | tuple[int, ...] | None = None) -> RobustNormalizer ¤

Computes median and quantile range from given data.

Parameters:

Name Type Description Default
data Float[Array, 'c ...']

The input array to compute statistics from.

required
axis int | tuple[int, ...] | None

Axis or axes along which the statistics are computed. The default (None) computes the global statistics.

None

Returns:

Type Description
RobustNormalizer

A new RobustNormalizer instance with updated statistics.

transform(x: Float[Array, ...]) -> Float[Array, ...] ¤

Normalizes input using median and quantile range.

Parameters:

Name Type Description Default
x Float[Array, ...]

The input array to transform.

required

Returns:

Type Description
Float[Array, ...]

The normalized array.

inverse_transform(x: Float[Array, ...]) -> Float[Array, ...] ¤

Reverts robust normalization.

Parameters:

Name Type Description Default
x Float[Array, ...]

The transformed array to revert.

required

Returns:

Type Description
Float[Array, ...]

The de-normalized array.

__call__(x: Float[Array, ...]) -> Float[Array, ...] ¤

Standardizes input using median and quantile range.

Parameters:

Name Type Description Default
x Float[Array, ...]

Input array.

required

Returns:

Type Description
Float[Array, ...]

Normalied input array.