1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//! Exponentially weighted smoothing: the training-curve idiom.
/// The debiased exponentially weighted moving average of `values` at
/// smoothing factor `alpha` in `[0, 1)` — TensorBoard's scalar smoothing:
/// `state = alpha * state + (1 - alpha) * value`, divided by `1 - alpha^t` so
/// early outputs are unbiased instead of dragged toward zero. `alpha = 0` is
/// the identity; `0.97` is the familiar heavy smoothing.
///
/// A gap (`NaN`) stays a gap in the output and leaves the smoothing state
/// untouched, so the average resumes after it rather than absorbing it. A
/// scan over the ordered series — a batch transform, deliberately not a
/// mergeable accumulator (its value depends on every prior element in
/// order).
///
/// # Panics
///
/// Panics when `alpha` is not in `[0, 1)`.