class maze.core.wrappers.observation_normalization.normalization_strategies.base.ObservationNormalizationStrategy(observation_space: gym.spaces.Box, clip_range: Tuple[Union[float, int], Union[float, int]], axis: Optional[Union[int, Tuple[int], List[int]]])

Abstract base class for normalization strategies.

Provides functionality for:
  • normalizing gym.Box observations as well as for normalizing the originally defined observation space.

  • setting and getting the currently employed normalization statistics.

  • interface definition for estimating the normalization statistics from a list of observations

  • interface definition for normalizing a given gym.Box (np.ndarray) observation

  • observation_space – The observations space to be normalized.

  • clip_range – The minimum and maximum value allowed for an observation.

  • axis – Defines the axis along which to compute normalization statistics

abstract estimate_stats(observations: List[numpy.ndarray]) → Dict[str, Union[numpy.ndarray, float, int, Iterable[Union[float, int]]]]

Estimate observation statistics from collected observations.


observations – A lists of observations.

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

Get normalization statistics.


The normalization statistics.


Checks if the normalization strategy is fully initialized.


True if fully initialized and ready to normalize; else False.

normalize_and_process_value(value: numpy.ndarray)numpy.ndarray

Normalizes and post-processes the actual observation (see also: normalize_value).


value – Observation value to be normalized.


Normalized and processed observation.

abstract normalize_value(value: numpy.ndarray)numpy.ndarray

Normalizes the actual observation value with provided statistics. The type and shape of value and statistics have to match.


value – Observation to be normalized.


Normalized observation.

normalized_space() → gym.spaces.Box

Normalizes extrema (low and high) in the observation space with respect to the given statistics. (e.g. it sets the maximum value of a Box space to the maximum in the respective observation)


Observation space with extrema adjusted w.r.t. statistics and normalization strategy.

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

Set normalization statistics.


stats – A dictionary containing the respective observation normalization statistics.