Used everywhere in ML: Adam optimizer (EMA of gradients), batch norm (EMA of statistics), model EMA for stable training.
EMA[0] = values[0]EMA[i] = α × values[i] + (1-α) × EMA[i-1]ema([1.0, 2.0, 3.0, 4.0], alpha=0.5) → [1.0, 1.5, 2.25, 3.125]
Round to **5 decimal places**.
Similar Problems
Test Cases (2 visible · 2 hidden)
Case 1: alpha=0.5
Input: ema([1.0,2.0,3.0,4.0],0.5)
Expected: [1.0, 1.5, 2.25, 3.125]
Case 2: Constant series
Input: ema([5.0,5.0,5.0],0.3)
Expected: [5.0, 5.0, 5.0]
⌘↵ Run · ⌘⇧↵ Submit