ArticleslgStudy

science

Hidden Markov model

Hidden Markov model is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Hidden Markov model rather than just read about it. In short: In probability theory, a hidden Markov model (HMM) is a Markov model in which the observations are dependent on a latent (or hidden) Markov process (referred to as X). An HMM requires that there be an observable process Y whose outcomes depend on the outcomes of X in a known way.

Hidden Markov model — main illustration
Hidden Markov model — illustration

Key takeaways

  • Hidden Markov model belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Hidden Markov model to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Hidden Markov model from memory before moving on to harder problems.

Reference excerpt

In probability theory, a hidden Markov model (HMM) is a Markov model in which the observations are dependent on a latent (or hidden) Markov process (referred to as X). An HMM requires that there be an observable process Y whose outcomes depend on the outcomes of X in a known way. Since X cannot be observed directly, the goal is to learn about state of X by observing Y. By definition of being a Markov model, an HMM has an additional requirement that the outcome of Y at time t=t0 must be "influenced" exclusively by the outcome of X at t=t0 and that the outcomes of X and Y at t<t0 must be conditionally independent of Y at t=t0 given X at time t=t0. Estimation of the parameters in an HMM can be performed using maximum likelihood estimation. For linear chain HMMs, the Baum–Welch algorithm can be used to estimate parameters. Hidden Markov models are known for their applications to thermodynamics, statistical mechanics, physics, chemistry, economics, finance, signal processing, information theory, pattern recognition—such as speech recognition, handwriting recognition, gesture recognition, part-of-speech tagging, musical score following, partial discharges and bioinformatics.

Definition Let Xn and Yn be discrete-time stochastic processes and n≥1. The pair (Xn,Yn) is a hidden Markov model if

Xn is a Markov process whose behavior is not directly observable ("hidden"); 𝐏⁡(Yn∈A | X1=x1,…,Xn=xn)=𝐏⁡(Yn∈A | Xn=xn), for every n≥1, x1,…,xn, and every Borel set A. Let Xt and Yt be continuous-time stochastic processes. The pair (Xt,Yt) is a hidden Markov model if

Xt is a Markov process whose behavior is not directly observable ("hidden"); 𝐏⁡(Yt0∈A∣{Xt∈Bt}t≤t0)=𝐏⁡(Yt0∈A∣Xt0∈Bt0), for every t0, every Borel set A, and every family of Borel sets {Bt}t≤t0.

Terminology The states of the process Xn (resp. Xt) are called hidden states, and 𝐏⁡(Yn∈A∣Xn=xn) (resp. 𝐏⁡(Yt∈A∣Xt∈Bt)) is called emission probability or output probability.

Examples

Drawing balls from hidden urns

In its discrete form, a hidden Markov process can be visualized as a generalization of the urn problem with replacement (where each item from the urn is returned to the original urn before the next step).

Consider this example In a room that is not visible to an observer there is a genie. The room contains urns X1, X2, X3, ... each of which contains a known mix of balls, with each ball having a unique label y1, y2, y3, ... . The genie chooses an urn in that room and randomly draws a ball from that urn. It then puts the ball onto a conveyor belt, where the observer can observe the sequence of the balls but not the sequence of urns from which they were drawn. The genie has some procedure to choose urns:

The choice of the urn for the n-th ball depends only upon a random number and the choice of the urn for the (n − 1)-th ball. The choice of urn does not directly depend on the urns chosen before this single previous urn. Therefore, this is called a Markov process. It can be described by the upper part of Figure 1.

Markov process The Markov process cannot be observed, only the sequence of labeled balls, thus this arrangement is called a hidden Markov process. This is illustrated by the lower part of the diagram shown in Figure 1, where one can see that balls y1, y2, y3, y4 can be drawn at each state. Even if the observer knows the composition of the urns and has just observed a sequence of three balls, e.g. y1, y2 and y3 on the conveyor belt, the observer still cannot be sure which urn (i.e., at which state) the genie has drawn the third ball from. However, the observer can work out other information, such as the likelihood that the third ball came from each of the urns.

Weather guessing game Consider two friends, Alice and Bob, who live far apart from each other and who talk together daily over the telephone about what they did that day. Bob is only interested in three activities: walking in the park, shopping, and cleaning his apartment. The choice of what to do is determined exclusively by the weather on a given day. Alice has no definite information about the weather, but she knows general trends. Based on what Bob tells her he did each day, Alice tries to guess what the weather must have been like. Alice believes that the weather operates as a discrete Markov chain. There are two states, "Rainy" and "Sunny", but she cannot observe them directly, that is, they are hidden from her. On each day, there is a certain chance that Bob will perform one of the following activities, depending on the weather: "walk", "shop", or "clean". Since Bob tells Alice about his activities, those are the observations. The entire system is that of a hidden Markov model (HMM). Alice knows the general weather trends in the area, and what Bob likes to do on average. In other words, the parameters of the HMM are known. They can be represented as follows in Python:

In this piece of code, start_probability represents Alice's belief about which state the HMM is in when Bob first calls her (all she knows is that it tends to be rainy on average). The particular probability distribution used here is not the equilibrium one, which is (given the transition probabilities) approximately {'Rainy': 0.57, 'Sunny': 0.43}. The transition_probability represents the change of the weather in the underlying Markov chain. In this example, there is only a 30% chance that tomorrow will be sunny if today is rainy. The emission_probability represents how likely Bob is to perform a certain activity on each day. If it is rainy, there is a 50% chance that he is cleaning his apartment; if it is sunny, there is a 60% chance that he is outside for a walk.

A similar example is further elaborated in the Viterbi algorithm page.

… excerpt ends here. Continue reading the full article.

Illustrations

Hidden Markov model: Graphical representation of the given HMM
Graphical representation of the given HMM
Hidden Markov model: Temporal evolution of a hidden Markov model
Temporal evolution of a hidden Markov model
Hidden Markov model: The state transition and output probabilities of an HMM are indicated by the line opacity in the upper part of the diagram. Given that the output sequence is observed in the lower part of the diagram, interest occurs in the most likely sequence of states that could have produced it. Based on the arrows that are present in the diagram, the following state sequences are candidates:
5 3 2 5 3 2
4 3 2 5 3 2
3 1 2 5 3 2
The most likely sequence can be found by evaluating the joint probability of both the state sequence and the observations for each case (simply by multiplying the probability values, which here correspond to the opacities of the arrows involved). In general, this type of problem (i.e., finding the most likely explanation for an observation sequence) can be solved efficiently using the Viterbi algorithm.
The state transition and output probabilities of an HMM are indicated by the line opacity in the upper part of the diagram. Given that the output sequence is observed in the lower part of the diagram, interest occurs in the most likely sequence of states that could have produced it. Based on the arrows that are present in the diagram, the following state sequences are candidates: 5 3 2 5 3 2 4 3 2 5 3 2 3 1 2 5 3 2 The most likely sequence can be found by evaluating the joint probability of both the state sequence and the observations for each case (simply by multiplying the probability values, which here correspond to the opacities of the arrows involved). In general, this type of problem (i.e., finding the most likely explanation for an observation sequence) can be solved efficiently using the Viterbi algorithm.
Hidden Markov model: A profile HMM modelling a multiple sequence alignment of proteins in Pfam
A profile HMM modelling a multiple sequence alignment of proteins in Pfam
Hidden Markov model: The hidden part of a hidden Markov model, whose observable states is non-Markovian
The hidden part of a hidden Markov model, whose observable states is non-Markovian

Worked examples

Example 1 — a first encounter with Hidden Markov model

Start with the simplest possible case. Write down what Hidden Markov model claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Hidden Markov model before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Hidden Markov model ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Hidden Markov model

In research
Hidden Markov model appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Hidden Markov model in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Hidden Markov model is common in secondary-school and first-year university syllabi. It links to neighbouring topics Bioinformatics, Hidden Markov models, Markov models, so understanding it makes those chapters shorter.
In everyday life
Look for Hidden Markov model outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Hidden Markov model” →

How to study Hidden Markov model in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Hidden Markov model means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Hidden Markov model out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Hidden Markov model in simple terms?

In probability theory, a hidden Markov model (HMM) is a Markov model in which the observations are dependent on a latent (or hidden) Markov process (referred to as X). An HMM requires that there be an observable process Y whose outcomes depend on the outcomes of X in a known way.

Why does Hidden Markov model matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Hidden Markov model?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Hidden Markov model.

Tags

  • Bioinformatics
  • Hidden Markov models
  • Markov models

Keep exploring