ObservationNormalizationStrategy¶
-
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
- 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, Union[numpy.ndarray, float, int, Iterable[Union[float, int]]]]¶ Estimate observation statistics from collected observations.
- Parameters
observations – A lists of observations.
-
get_statistics
() → Dict[str, Union[numpy.ndarray, float, int, Iterable[Union[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
() → 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)
- Returns
Observation space with extrema adjusted w.r.t. statistics and normalization strategy.