The Learning Library
Contents

Module 00 — Orientation: Why HMMs Survived the Deep-Learning Era

Part I · Foundations & the Inference Engine · Status: Draft v0.1 Scope: Curriculum map, domain verdicts, and what HMMs are not · Prerequisites: none

Overview

A Hidden Markov Model is a probabilistic model of a system that moves through hidden states and emits observations you can see. You never observe the state directly. You infer it from the observation sequence.

Survival here has a concrete meaning. HMMs survived where small data, structured sequences, and interpretable states dominate, and they faded where abundant labels let neural models win. This module shows you exactly which domains fall on each side.

This topic teaches you the full HMM stack in four parts. You start with the inference engine in Part I. You then learn verified Python tooling, survey where HMMs still run in production, and finish with honest regime testing for markets.

Your finance-adjacent goal shapes everything here. Every trading-flavored claim in this curriculum is a hypothesis under test, never a proven edge. Mechanics you can trust; profitability you must validate out of sample and net of costs.

You also learn one shared toy problem deeply instead of many datasets shallowly. Part I reuses a two-state weather model in every module, so each new algorithm lands on familiar numbers. When you reach real return series in Part III, your engine and your judgment are both ready.

How It Works

The curriculum follows one pipeline. You learn the model and its three canonical problems first. You then implement the engine from scratch before touching any library.

How to read this: boxes are the four parts in study order, and arrows show the dependency flow from mechanics to practice.

flowchart TD
    P1[Part I Foundations] --> P2[Part II Tooling]
    P2 --> P3[Part III Domains]
    P3 --> P4[Part IV Finance regimes]
    P1 --> P4
    P2 --> P4

Part I (Modules 00–06) covers the model, forward and Viterbi decoding, Baum-Welch training, scaling and log-space numerics, Gaussian emissions, and model selection. Part II (Modules 07–10) covers verified libraries and diagnostics. Part III (Modules 11–14) surveys production use across domains. Part IV (Modules 15–18) applies HMM regimes to markets under strict causal and cost gates.

Inside Part I the dependency chain is strict. Module 01 defines the model and the three canonical problems on one shared toy. Module 02 rebuilds the engine from scratch with honest numerics. Modules 03 through 06 then extend that engine to Gaussian emissions, practical training, degenerate solutions, and state-count selection. You never meet a new dataset until the shared toy has taught you everything it can.

[!IMPORTANT] Finance modules require causal states only. You evaluate signals on completed bars and report every number net of costs.

The Domain Verdicts

The table below previews where HMMs stand in the 2020s. You will verify each verdict against primary sources in Part III. The verdict labels are fixed by this curriculum and used unchanged in every domain module.

Domain Verdict One-line reason
Bioinformatics thriving Profile HMM tooling backs production databases
Speech and audio legacy-but-alive Neural ASR won; forced alignment survives
NLP sequence labeling historical Teaching device; production moved on
Finance econometrics alive Regime-switching models remain standard infra
Finance trading hypothesis-under-test No accepted edge evidence; test honestly
Ecology and telemetry thriving Movement-model packages in active use

You should notice the asymmetry. HMMs thrive where data is scarce, sequences are structured, and interpretability matters. They faded where labeled data is abundant and neural models dominate. Your job in Part III is to learn the structural reason behind each verdict, not just memorize it.

Every verdict above rests on a primary-source pass with retrieval dates in September 2026. A project site, official documentation, peer-reviewed paper, or institution publication backs each claim. If a later retrieval contradicts a verdict, the verdict changes and the module records why.

[!NOTE] Epidemiology, cybersecurity, music alignment, and meteorology are unverified in this curriculum. Formulations exist, but no primary-source pass is complete, so no verdict is asserted.

What HMMs Are Not

Modern structured state-space models such as S4 and Mamba are deterministic linear recurrences trained by gradient descent. You do not get posterior state probabilities or an EM training loop from them. They are a different model family that happens to share the words “state” and “space”.

An HMM is a probabilistic latent-variable model. You maintain beliefs over hidden states, compute likelihoods, and train with expectation-maximization. If a source calls S4 or Mamba an “HMM variant”, treat that as loose language, not a technical claim.

The practical test is simple. Ask whether the model produces posterior state probabilities and trains with EM. HMMs answer yes to both, while S4 and Mamba answer no to both. That two-question test settles nearly every conflation you will meet in blog posts.

This distinction matters for your tooling choices. Gradient-trained sequence models scale with data and GPUs. HMMs shine on small data with two or three interpretable states and streaming updates. You will pick the right tool once you see the structural difference clearly.

Suggested Study Paths

You do not need to read all eighteen modules in order. Your goal picks your path, and every path starts here. The table below maps three reader goals to module sequences.

Goal Path Why this order
Fit and trust an HMM 00, 01, 02, 04, 05, 07, 10 Mechanics, training, tooling, diagnostics
Judge if HMMs still matter 00, 11, 12, 13, 14, 17 Verdicts first, validation honesty last
Use HMMs for market regimes 00, 03, 07, 15, 16, 17, 18 All of Part IV is mandatory

If you teach or onboard others, you read the full canonical order without skipping. Modules 05 and 06 are the two most-skipped and most-costly modules in the curriculum. Degenerate solutions and state-count pitfalls cause more production failures than any other topic here.

Budget your effort by path. The fit-and-trust path is the heaviest, because Modules 04 and 05 demand real implementation work. The judge-first path reads quickly but leaves you unable to fit a model. The markets path is the longest, and you must not shortcut its validation modules.

[!TIP] Finance readers take the markets path but still complete Modules 01 and 02 first. You cannot evaluate a regime router honestly if you cannot implement a forward pass.

Testing Your Implementation

You verify your curriculum map from scratch with a runnable check. The snippet below encodes the six verdicts from the table and asserts the exact labels this module promises. You run it before moving on.

import numpy as np

# Verdict labels are curriculum constants, so we pin them here.
verdicts = {
    "bioinformatics": "thriving",
    "speech": "legacy-but-alive",
    "nlp": "historical",
    "finance-econometrics": "alive",
    "finance-trading": "hypothesis-under-test",
    "ecology": "thriving",
}
expected_count = 6
actual_count = len(verdicts)
print("domains:", actual_count)
assert actual_count == expected_count
assert verdicts["finance-trading"] == "hypothesis-under-test"
assert verdicts["finance-econometrics"] == "alive"
assert verdicts["bioinformatics"] == "thriving"
print("verdict table checks out")

The expected output prints domains: 6 followed by the confirmation line. If any verdict string drifts in a later edit, the assertion fails loudly. That is the point: your map stays consistent across all eighteen modules.

You should also check that every finance-adjacent verdict carries its honesty qualifier. The script below asserts the two finance labels explicitly, because those are the verdicts a careless reader is most likely to inflate. You run both checks together before moving on.

Hands-On Project

Build a one-page HMM field guide for yourself. List the four parts, the six domain verdicts, and the S4 and Mamba distinction in your own words. Your reproduction card records no data source and no library version, because this module uses none.

Your card still records three fields explicitly. You note the verdict retrieval month of September 2026, the curriculum version Draft v0.1, and the checkable output of the verdict script. A future reader then knows exactly what your page asserted and when.

Your acceptance check is simple. A colleague reads your page and can state which domains are thriving and why trading claims need out-of-sample net-of-cost proof. If they cannot, your page is too vague and you rewrite it.

Your second acceptance check covers the S4 and Mamba distinction. Your colleague must be able to explain why a gradient-trained recurrence is not an HMM variant. One correct sentence about posteriors and EM passes; vague talk about “state” fails.

Your third acceptance check is a date check. Your page states the September 2026 retrieval month next to every verdict. Stale verdicts without dates mislead future readers, so undated verdicts fail review.

[!TIP] Revisit this page after Part III. You will upgrade each verdict from a memorized label to a primary-source-backed judgment.

Key Takeaways

  • HMMs model hidden states through visible observations, and you infer beliefs over states.
  • The curriculum runs mechanics first, tooling second, domains third, finance practice last.
  • Bioinformatics and ecology are thriving; speech is legacy-but-alive; NLP tagging is historical.
  • Finance econometrics is alive, while finance trading stays a hypothesis under test.
  • S4 and Mamba are deterministic recurrences, not probabilistic HMM variants.
  • Unverified domains get no verdict until a primary-source pass completes.
  • Every trading number you report later must be causal, net of costs, and validated out of sample.
  • Your field guide and verdict script keep the whole curriculum consistent.

References

  • Mechanics: L. R. Rabiner, “A tutorial on hidden Markov models,” Proc. IEEE 77(2), doi:10.1109/5.18626 — https://courses.physics.illinois.edu/ece417/fa2017/rabiner89.pdf, retrieved 2026-09-17.
  • Background: J. A. Bilmes and colleagues, structured state-space versus HMM relation discussion, arXiv:2601.13357 — https://arxiv.org/abs/2601.13357, retrieved 2026-09-17.
  • Survey: domain verdict evidence (HMMER project site, Montreal Forced Aligner docs, FRED RECPROUSM156N series, moveHMM CRAN page) — URLs and retrieval dates recorded per verdict in Part III, retrieved 2026-09-17.
  • Exclusion: practitioner blog posts claiming modern SSMs are “HMM variants” were excluded as background only, because they cannot ground the probabilistic-versus-deterministic distinction.