Skip to content

Add finite-state quantized HMM filters and forecast-loss bounds - #59

Merged
Autoplectic merged 2 commits into
mainfrom
quantized-hmm-filter
Nov 15, 2026
Merged

Autoplectic merged 2 commits into
mainfrom
quantized-hmm-filter

Conversation

@Autoplectic

Copy link
Copy Markdown
Member

Summary

Add quantized_filter for known, positive-transition MooreHMMs, following Feng & Meng, Recursive memory for prediction and generation (arXiv:2611.13760, Theorems 3.1/4.3 and Appendix A.4).

  • Enumerate only the reachable log-odds-grid labels, retaining the exact initial belief and reporting full-grid/reachable counts and allocated memory bits.
  • Select precision for future-event log error, uniform-word log error, or total forward KL; all public loss budgets are in bits.
  • Separate event queries, recursively rounded unifilar generation, and posterior-initialized private-state simulation, reusing existing HMM sampling/word/YAML APIs.
  • Add documented examples, literature citations, static-IB/exact-MSP cross-references, and 55 focused regression tests.

Scope and numerical guarantees

The bounds are theorem-derived in real arithmetic, not formal interval certificates: bounds.rigorous is explicitly False, and unresolved float64 precision is rejected. Arbitrary edge-emitting Mealy HMMs are deliberately rejected; positivity of the summed transition matrix alone does not establish the required contraction. Zero emissions and nonstationary/boundary initial beliefs are supported.

This does not optimize the smallest state machine, change exact mixed-state enumeration, add a scalar-quantization solver, or conflate label capacity with statistical complexity/IB rate. Fixed total forecast loss is distinguished from a per-symbol allowance.

Validation

  • Full non-slow suite, Python 3.12: 2,345 passed, 19 skipped.
  • Focused new tests: 55 passed, 99% coverage of the new module.
  • Python 3.11 without SymPy: 115 passed across the new module and HMM/mixed-state/relative-entropy regressions.
  • Repository-wide ruff check . and ruff format --check .: pass.
  • Repository-wide ty check: exits 0 with existing warnings; targeted checks of the new module/tests are clean.
  • sphinx-build -q -W --keep-going -b html docs docs/_build/html: pass; the documented Python example was executed separately.
  • Reproduces Table 3's three log-grid state counts; checks Hilbert/event bounds on exhaustive short histories, total KL against the source-prefix chain rule, generated word probabilities/YAML round trips, private simulation, zero emissions, initial-law handling, and resource/numerical guards.

@Autoplectic
Autoplectic marked this pull request as ready for review November 15, 2026 00:56
Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	CHANGELOG.md
@Autoplectic
Autoplectic merged commit c3442a3 into main Nov 15, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant