Skip to content

Unit Gaussian Normalizer

Unit Gaussian Normalizer¤

neojax.data.normalizers.unit_gaussian_normalizer.UnitGaussianNormalizer ¤

Normalizes data to be mean zero and unit std.

Parameters:

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

Optional initial mean if known. Default is 0.0.

0.0
std float | Float[Array, ...]

Optional initial standard deviation if known. Default is unit 1.0.

1.0
Internal Attributes

These fields store the internal state of the normalizer.

  • stats (dict[str, Float[Array, ...] | None]): Dict of mean and std.
mean property ¤

Accessor for the mean stored in stats.

std property ¤

Accessor for the std stored in stats.

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

Computes mean and std from diven data.

To normalize per-channel for input (c, d1, ..., dN), pass axis=tuple(range(1, data.ndim)). To normalize across all axes, pass axis=None.

Parameters:

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

The input array.

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

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

None

Returns:

Type Description
UnitGaussianNormalizer

A new UnitGaussianNormalizer instance with updated mean and std.

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

Standardizes input using stored mean and std.

Parameters:

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

The input array to transform.

required

Returns:

Type Description
Float[Array, ...]

The standardized array.

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

Reverts standardization.

Parameters:

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

The standardized array to revert.

required

Returns:

Type Description
Float[Array, ...]

The de-standardized array.

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

Standardizes input using stored mean and std.

Parameters:

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

Input array.

required

Returns:

Type Description
Float[Array, ...]

Standardized input array.