Noisy Wrappers#
This module provides wrappers that introduce noise into the agent’s interaction with the environment, either through action perturbations or observation corruption.
Descriptions#
NoisyActionWrapper: Adds noise to the actions. For discrete actions, actions may be randomly replaced. For continuous actions, Gaussian noise is added.
NoisyObservationWrapper: Adds Gaussian noise to observations. Supports both NumPy arrays and dictionaries.
Classes#
- class objectrl.utils.environment.noisy_wrappers.NoisyActionWrapper(env: Env, noise_act: float = 0.1)[source]#
Bases:
ActionWrapperA Gymnasium wrapper that injects noise into the agent’s actions. For discrete action spaces, the action is randomly replaced with another action with a given probability. For continuous action spaces, Gaussian noise is added.
- env#
The environment to wrap.
- Type:
gym.Env
- noise_act#
Noise level for the action. - For discrete spaces: probability of replacing the action. - For continuous spaces: standard deviation of Gaussian noise.
- Type:
float
- __init__(env: Env, noise_act: float = 0.1) None[source]#
Initialize the NoisyActionWrapper.
- Parameters:
env (gym.Env) – The environment to wrap.
noise_act (float) – Noise level for the action. - For discrete spaces: probability of replacing the action. - For continuous spaces: standard deviation of Gaussian noise.
- Returns:
None
- class objectrl.utils.environment.noisy_wrappers.NoisyObservationWrapper(env: Env, noise_obs: float = 0.1)[source]#
Bases:
ObservationWrapperA Gymnasium wrapper that injects noise into observations. Adds Gaussian noise to array-based observations or to values in dictionary observations.
- env#
The environment to wrap.
- Type:
gym.Env
- noise_obs#
Standard deviation of Gaussian noise added to observations.
- Type:
float