Base Normalizer
Base Normalizer¤
neojax.data.normalizers.base_normalizer.BaseNormalizer
¤
Base class for all normalizers.
All normalizers should inherit from BaseNormalizer.
Following the "Abstract or Final" pattern, this class contains no
logic and only defines the interface. Subclasses should be marked
as final.
Normalizer methods follow the naming conventions of major
libraries, where transform is the forward operation
and inverse_transform the inverse.
Internal Attributes
These fields store the internal state of the normalizer.
- stats (
PyTree): A PyTree containing the normalization statistics (e.g. mean, std).
compute_stats(data: Float[Array, ...]) -> BaseNormalizer
¤
Computes statistics from the provided data.
This function should set the stats attribute.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Float[Array, ...]
|
The data to compute statistics from. |
required |
Returns:
| Type | Description |
|---|---|
BaseNormalizer
|
A new BaseNormalizer instance with updated |
transform(x: Float[Array, ...]) -> Float[Array, ...]
¤
Applies the forward normalization transform.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Float[Array, ...]
|
The input array to transform. |
required |
Returns:
| Type | Description |
|---|---|
Float[Array, ...]
|
The transformed array. |
inverse_transform(x: Float[Array, ...]) -> Float[Array, ...]
¤
Applies the inverse normalization transform.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Float[Array, ...]
|
The transformed array to revert. |
required |
Returns:
| Type | Description |
|---|---|
Float[Array, ...]
|
The array in its original scale |