Probability & Statistics

Hidden Markov Model

Visualize state transitions, emitted observations, and probability inference in a Hidden Markov Model.

Hidden Markov Model (HMM)

Concept Overview

A Hidden Markov Model is a statistical model in which the system being modeled is assumed to be a Markov process with unobservable (hidden) states. In a regular Markov model, the state is directly visible to the observer, and therefore the state transition probabilities are the only parameters. In an HMM, the state is not directly visible, but variables influenced by the state are visible.

Mathematical Definition

An HMM can be defined by the following elements: A set of hidden states S, a set of possible observations O, a state transition probability matrix A, an emission probability matrix B, and an initial state distribution π.

S = {s1, s2, ..., sN}
O = {o1, o2, ..., oM}

A = [aij]
where aij = P(xt+1 = sj | xt = si)

B = [bi(k)]
where bi(k) = P(zt = ok | xt = si)

π = [πi]
where πi = P(x1 = si)

Key Concepts

Markov Property

The probability of transitioning to any particular state depends solely on the current state, and not on the sequence of states that preceded it. This is often referred to as "memorylessness".

Hidden States

The actual states of the system (e.g., whether a person is healthy or sick, or whether the underlying weather is sunny or rainy) are hidden from the observer.

Observations (Emissions)

At each time step, the hidden state "emits" an observable output according to a probability distribution conditional on the state. For example, a person's visible symptom (like coughing or sneezing) is the observation, while their true health condition is the hidden state.

Historical Context

Hidden Markov Models were first described in a series of statistical papers by Leonard E. Baum and other authors in the late 1960s. One of the first applications of HMMs was speech recognition, starting in the mid-1970s. Since then, they have become an indispensable tool in bioinformatics, natural language processing, and economics.

Real-world Applications

  • Speech Recognition: Modeling the hidden phonemes that produce spoken sound waves.
  • Bioinformatics: Identifying genes and other functional elements in DNA sequences.
  • Finance: Modeling market regimes (e.g., bull vs. bear markets) where the underlying state is hidden but affects observable stock prices.
  • Natural Language Processing: Part-of-speech tagging and machine translation.

Related Concepts

  • Markov Chain Monte Carlo — A broader class of sampling methods relying on Markov Chains.
  • Bayes' Theorem — Fundamental to the inference tasks (like the Forward-Backward algorithm) in HMMs.

Experience it interactively

Adjust parameters, observe in real time, and build deep intuition with Riano’s interactive Hidden Markov Model module.

Try Hidden Markov Model on Riano →

More in Probability & Statistics