ObservationNormalizationWrapper

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).

Parameters
  • 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()None

Dump statistics to file.

estimate_statistics()None

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.

return

The normalized observation.

classmethod register_new_observation_normalization_strategy(containing_submodule: Any)

Registers a new observation normalization strategy.

Parameters

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.

Parameters

stats – The statistics dict

set_observation_collection(status: bool)None

Activate / deactivate observation collection.

Parameters

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