views:

49

answers:

1

This excellent article on implementing a Hidden Markov Model in C# does a fair job of classifying a single bit sequence based on training data.

How to modify the algorithm, or build it out (multiple HMMs?) to support the classification of multiple simultaneous bit sequences?

Example

Instead of classifying just one stream:

double t1 = hmm.Evaluate(new int[] { 0,1 });      // 0.49999423004045024  
double t2 = hmm.Evaluate(new int[] { 0,1,1,1 });  // 0.11458685045803882

Rather classify a dual bit stream:

double t1 = hmm.Evaluate(new int[] { [0, 0], [0, 1] });
double t2 = hmm.Evaluate(new int[] { [0, 0], [1, 1], [0, 1], [1, 1] });

Or even better, three streams:

double t1 = hmm.Evaluate(new int[] { [0, 0, 1], [0, 0, 1] });
double t2 = hmm.Evaluate(new int[] { [0, 0, 1], [1, 1, 0], [0, 1, 1], [1, 1, 1] });

Obviously the training data would also be expanded.

A: 

The trick is to model the set of observations as the n-ary cartesian product of all possible values of each sequence, in your case the HMM will have 2^n output symbol where n is the number of bit sequences.

Example: for three bit sequences, the 8 symbols are: 000 001 010 011 100 101 110 111, as if we created a megavariable whose values are all the possible tuples of values of the individual observation sequences (0/1 of each bit sequence)

Amro
FreshCode
@FreshCode: I might have used the wrong words, I was talking about observation symbols (emissions) not states (the hidden states). Also keep in mind that in HMM, the emission model only depends on the current state `$P( O_t | q_0,..,q_t , O_0,...,O_{t-1} ) = P( O_t | q_t )$` (what is known as the Markov assumption of evidence)
Amro
I guess the alternative is to adapt the emission matrix to have some kind of multivariate version of the multinomial distribution, as well as making the corresponding changes to the Baum-Welch training algorithm...
Amro