Language Guide

One of the driving ideas behind HMMingbird was to provide a platform agnostic way of describing hidden markov models. This approach allows the domain focused user to simply define the model without worrying about the target architecture.

To that end the language itself is pretty simple. We will explore the language by considering a widely used model.

The Occasionally Dishonest Casino

Say we are an inveterate gambler, and that we have a particularly fondness for games involving die. We play in the casino night after night, and we begin to notice a pattern: occasionally, the dealer is able to throw a disproportionate number of sixes.

So we try and build a model that represents what we believe to be happening - that the dealer is secretly switching the fair die for a loaded one!

hmm casino {
    alphabet [1, 2, 3, 4, 5, 6];
    startstate start;
    state fair emits fairemission;
    state loaded emits loadedemission;
    endstate end;
    emission fairemission =   [1/6, 1/6, 1/6, 1/6, 1/6, 1/6];
    emission loadedemission = [0.1, 0.1, 0.1, 0.1, 0.1, 0.5];
    start -> fair 1;
    fair -> fair 0.95;
    fair -> loaded 0.05;
    loaded -> loaded 0.97999;
    loaded -> fair 0.02;
    loaded -> end 0.00001;

The consituent parts here should be fairly obvious.

Alphabet: Defines the valid set of output characters. Only one alphabet per HMM, as we do not support multiple tapes yet. The order matters when determining emissions.

State: Declare the states with names. startstate and endstate are special key words, only one of each is allowed. States may declare emissions with the emits keyword, or may remain silent.

Emission: Defines the likelihood of each emission. May be in a dictionary syntax e.g { 1: 0.1, 2: 0.1, etc}, in which case any order is permitted, or in an implied format [0.1, 0.1, 0.1,...] in which case the order of the characters is the same as in the alphabet.

Transitions: Declared with arrows and must provide a probability. Can optionally declare an emission if and only if the destination state does not declare one.

Last modified 9 years ago Last modified on Aug 3, 2010, 10:35:32 PM