What (One-liner)
Rolling window mean, None value filter. Library-level primitive.
How to use
python
from services.algo.statistics import rolling_mean
rolling_mean([1, 2, 3, 4, 5], window=3)
# → [None, None, 2.0, 3.0, 4.0]Core formulas
out_t = mean([s for s in series[t-w+1..t] if s is not None]) if valid >= 1 else NoneAssumptions & applicability
Assumptions: Left-aligned + None filter + w<=n.
Applicability: macro smoothing, rolling baseline, simple denoising.
Not Applicable: weighted (use EMA), streaming.
Known limitations
- Left-aligned hardcoded
- None filter (no forward-fill)
- window=3 default
References
Brockwell & Davis (2016) Time Series Forecasting.
Golden Test
tests/golden/fixtures/tier1/rolling_mean/, 1e-12, 2026-04-20 passing.
Changelog
- 1.0.0 (2026-04-20) — First Active

