ObservationNormalizationStrategy¶
- class maze.core.wrappers.observation_normalization.normalization_strategies.base.ObservationNormalizationStrategy(observation_space: gymnasium.spaces.Box, clip_range: Tuple[float | int, float | int], axis: int | Tuple[int] | List[int] | None)¶
Abstract base class for normalization strategies.
- Provides functionality for:
normalizing gymnasium.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 gymnasium.Box (np.ndarray) observation
- Parameters:
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, numpy.ndarray | float | int | Iterable[float | int]]¶
Estimate observation statistics from collected observations.
- Parameters:
observations – A lists of observations.
- get_statistics() Dict[str, numpy.ndarray | float | int | Iterable[float | int]]¶
Get normalization statistics.
- Returns:
The normalization statistics.
- is_initialized() bool¶
Checks if the normalization strategy is fully initialized.
- Returns:
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).
- Parameters:
value – Observation value to be normalized.
- Returns:
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.
- Parameters:
value – Observation to be normalized.
- Returns:
Normalized observation.
- normalized_space() gymnasium.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)
- Returns:
Observation space with extrema adjusted w.r.t. statistics and normalization strategy.