Running mean / std observation normalization
How a running mean and variance turn observations with very different scales (a joint velocity of several rad/s, a gravity component near −0.98) into comparable, roughly zero-mean unit-variance inputs, and what happens if the data shift after the statistics are frozen.
What it demonstrates
How a running mean and variance turn observations with very different scales (a joint velocity of several rad/s, a gravity component near −0.98) into comparable, roughly zero-mean unit-variance inputs, and what happens if the data shift after the statistics are frozen.
How it works
Two synthetic channels are streamed at 50 Hz. Each new sample is merged into the running statistics with the parallel mean/variance update, then normalized as (x − mean)/√(var + ε) and clipped. Freezing the statistics mimics deployment, where the normalizer saved with the policy is applied unchanged.
Adjustable parameters
- Raw offset (−8 to 8 rad/s)
- Raw spread (0.2–10 rad/s)
- Clip (±1 to ±10)
- Freeze statistics
- Reset statistics
Known limitations
- Menlo documents that observation normalization is enabled; the exact implementation, clip value and whether statistics are frozen at deployment are not stated.
- The input signals are synthetic.
Equations
Core update rule
updateRunningStats(stats, [raw]); // skipped when frozen
const z = normalize(stats, raw, clip); // (x - mean) / sqrt(var + 1e-8), clippedExplained in Chapter 8: Locomotion Policy