Used in ML to smooth training curves, monitor model metrics, and detect drift in production.
MA[i] = mean(values[i : i+k])moving_average([1,2,3,4,5], k=3) → [2.0, 3.0, 4.0]
Round to **5 decimal places**.
Test Cases (2 visible · 2 hidden)
Case 1: Basic window=3
Input: moving_average([1,2,3,4,5],3)
Expected: [2.0, 3.0, 4.0]
Case 2: Constant sequence
Input: moving_average([1,1,1,1],2)
Expected: [1.0, 1.0, 1.0]
⌘↵ Run · ⌘⇧↵ Submit