What (One-liner)
Stability scoring based on Coefficient of Variation, range [0, 1]. Library-level primitive.
How to use
python
from services.algo.statistics import stability_score
stability_score([100, 100, 100, 100]) # 1.0 (extremely stable)
stability_score([100, 50, 150, 80]) # ~0.2 (unstable)Core formulas
mean = avg(series)
cv = std(series, ddof=0) / mean
stability = clip(1 - cv × 5, 0, 1)Assumptions & applicability
Assumptions: mean > 0 + coefficient 5 empirically reasonable + ddof=0.
Applicability: Revenue / Profit / ROE stability scoring.
Not applicable: mean ≈ 0, negative numbers, n<2.
Known limitations
- Coefficient 5 hardcoded
- Loses meaning when mean close to 0
- No robust variant
References
Pearson (1895) Coefficient of Variation + Pangura empirical heuristic.
Golden Test
tests/golden/fixtures/tier1/stability_score/, 1e-12, 2026-04-20 passing.
Changelog
- 1.0.0 (2026-04-20) — First Active

