Search code examples
matlabcomputer-visionhidden-markov-models

HMM - correct number of states


I'm new to HMM. I came cross an example in Wikipedia Baum–Welch_algorithm Example and I'm little bit confused. Hope someone can help me.

The example as follow: "Suppose we have a chicken from which we collect eggs at noon everyday. Now whether or not the chicken has laid eggs for collection depends on some unknown factors that are hidden. We can however (for simplicity) assume that there are only two states that determine whether the chicken lays eggs."

My questions here are:

  1. In the case that we do not know the states; How can we find the correct number of states. In the example above; they assume 2. But maybe 3 or 5 ... better represents the system.

  2. Is it necessary to give a meaning for each state in the system. In the example above; we have s1 and s2 but they are not given a meaning related to the application.


Solution

  • I you want to fit a HMM to your chicken example, you will assume successively that there are only 1 state, then 2 states, then 3 etc. governing this laying process. If you know a little about the chicken way of life, you may assume the number of state based on your knowledge.

    You can test, for example, a two states hypothesis thinking that the number of eggs a chicken may lay depends on the following states: (1) the chicken is awake, (2) the chicken is sleeping.

    You can then test a three states hypothesis with (1) the chicken is awake, (2) the chicken is sleeping, and (3) the chicken is in the nest.

    For each of the state you want to test, you have new parameters adding to your model. They tune the number of eggs laid in each state and of course transition probabilities between the states. Then you can choose a model between your hypothesis based for example on its goodness of fit to data (if you owe some) with some information criterion (AIC, BIC, DIC... depending on your fitting methodology).