class maze.core.wrappers.observation_normalization.observation_normalization_wrapper.ObservationNormalizationWrapper(*args, **kwds)

An observation normalization wrapper. It provides functionality for:

  • normalizing observations according to specified normalization strategies

  • clipping observations according to specified min and max values

  • estimating normalization statistics from observations collecting by interacting with the environment

  • manually overwriting the observation normalization parameters

The current implementation assumes that observation space is always a Dict (even if just a Dict-wrapped Box).

  • env – Environment/wrapper to wrap.

  • default_strategy – The default observation normalization strategy.

  • default_statistics – Manual default normalization statistics.

  • statistics_dump – Path to a pickle file dump of normalization statistics.

  • sampling_policy – The sampling policy for estimating the statistics.

  • exclude – List of observation keys to exclude from normalization.

  • manual_config – Additional manual configuration options.

clone_from(env: maze.core.wrappers.observation_normalization.observation_normalization_wrapper.ObservationNormalizationWrapper)None

(overrides SimulatedEnvMixin)

implementation of SimulatedEnvMixin.


Dump statistics to file.


Estimates and sets the observation statistics from collected observations.

get_statistics() → Dict[str, Dict[str, Union[numpy.ndarray, float, int, Iterable[Union[float, int]]]]]

Returns the normalization statistics of the respective normalization strategy. :return: The normalization statistics for all sub steps and all dictionary observations.

observation(observation: Any) → Any

(overrides ObservationWrapper)

Collect observations for statistics computation or normalize them.

param observation

The observation to be normalized.


The normalized observation.

classmethod register_new_observation_normalization_strategy(containing_submodule: Any)

Registers a new observation normalization strategy.


containing_submodule – Add all classes implementing ObservationNormalizationStrategy by walking the module recursively.

seed(seed: int)None

(overrides StructuredEnv)

Apply seed to wrappers rng, and pass the seed forward to the env

set_normalization_statistics(stats: Dict[str, Dict[str, Union[numpy.ndarray, float, int, Iterable[Union[float, int]]]]])None

Apply existing normalization statistics.


stats – The statistics dict

set_observation_collection(status: bool)None

Activate / deactivate observation collection.


status – If True observations are collected for statistics computation. If False observations are normalized with the provided statistics