Implementation:Google deepmind Dm control Variation Noises
| Knowledge Sources | |
|---|---|
| Domains | Reinforcement_Learning, Domain_Randomization |
| Last Updated | 2026-02-15 04:00 GMT |
Overview
Meta-variation classes that modify existing attribute values by adding (Additive) or multiplying (Multiplicative) noise generated by another variation, with optional cumulative drift behavior.
Description
The noises module provides two meta-variation classes that apply noise relative to an existing value rather than generating absolute values. Additive takes a value generated by an inner variation and adds it to a base value, while Multiplicative multiplies the base value by the inner variation's output.
Both classes support a cumulative flag that controls which base value is used. When cumulative=False (the default), the noise is applied relative to the fixed initial_value of the attribute. This means each evaluation produces a perturbation around the original value. When cumulative=True, the noise is applied relative to the current_value, which is the result of the previous evaluation. This enables drift-like behavior where perturbations accumulate over successive applications.
The inner variation can be any Variation object, including distributions, constants, or composed expressions. Both classes use variation_values.evaluate to resolve the inner variation before combining it with the base value, enabling nested variation compositions.
Usage
Use Additive when you want to perturb a parameter by adding noise (e.g., position jitter around a baseline). Use Multiplicative when perturbations should scale with the base value (e.g., mass randomization as a percentage of the original). Enable cumulative=True for time-varying drift effects where successive randomizations build on each other.
Code Reference
Source Location
- Repository: Google_deepmind_Dm_control
- File: dm_control/composer/variation/noises.py
- Lines: 1-88
Signature
class Additive(base.Variation):
def __init__(self, variation, cumulative=False):
...
class Multiplicative(base.Variation):
def __init__(self, variation, cumulative=False):
...
Import
from dm_control.composer.variation import noises
from dm_control.composer.variation.noises import Additive, Multiplicative
I/O Contract
Inputs (Additive)
| Name | Type | Required | Description |
|---|---|---|---|
| variation | Variation | Yes | The inner variation that generates the noise value to add |
| cumulative | bool | No | If True, add to current_value; if False (default), add to initial_value
|
Inputs (Multiplicative)
| Name | Type | Required | Description |
|---|---|---|---|
| variation | Variation | Yes | The inner variation that generates the scale factor |
| cumulative | bool | No | If True, multiply current_value; if False (default), multiply initial_value
|
Outputs
| Name | Type | Description |
|---|---|---|
| Additive return | same as base value type | base_value + noise
|
| Multiplicative return | same as base value type | base_value * factor
|
Usage Examples
from dm_control.composer.variation import noises
from dm_control.composer.variation import distributions
import numpy as np
rng = np.random.RandomState(42)
# Add Gaussian noise to an initial position
additive_noise = noises.Additive(
distributions.Normal(loc=0.0, scale=0.01)
)
initial_pos = np.array([1.0, 2.0, 3.0])
noisy_pos = additive_noise(
initial_value=initial_pos, current_value=initial_pos, random_state=rng
)
# noisy_pos is approximately [1.0, 2.0, 3.0] with small perturbations
# Scale mass by a uniform factor
multiplicative_noise = noises.Multiplicative(
distributions.Uniform(low=0.8, high=1.2)
)
initial_mass = 5.0
random_mass = multiplicative_noise(
initial_value=initial_mass, current_value=initial_mass, random_state=rng
)
# random_mass is between 4.0 and 6.0
# Cumulative additive drift
cumulative_drift = noises.Additive(
distributions.Normal(loc=0.0, scale=0.1),
cumulative=True
)
# Each call adds noise to the current (previously modified) value
val = cumulative_drift(initial_value=0.0, current_value=0.0, random_state=rng)
val = cumulative_drift(initial_value=0.0, current_value=val, random_state=rng)
# val accumulates noise over successive calls