0

I'm using a hidden markov model for classification, the jahmm implementation.

When training a model i use kMeans clustering for an initial model. Then i a use an arbitrary iteration rounds to optimize the model. I was wonderding was happens in these iteration.

My guts tell me that sequenes are generated based on the initial model, which in turn are used to train the model again, and so on.

is this true or is there something else which happens?

Thank you!

jorrebor
  • 2,166
  • 12
  • 48
  • 74

1 Answers1

0

BaumWelchLearner.java:

public <O extends Observation> Hmm<O>
    learn(Hmm<O> initialHmm, List<? extends List<? extends O>> sequences)
    {
        Hmm<O> hmm = initialHmm;

        for (int i = 0; i < nbIterations; i++)
            hmm = iterate(hmm, sequences);

        return hmm;
    }

Actually it is using the provided observation sequences over and over again in each iteration. Iterations are needed because models sometimes converge only slowly to a local max. Write a program like this to see the model after each iteration:

BaumWelchLearner bwl = new BaumWelchLearner();
for (int i=0; i<=bwl.getNbIterations(); i++) {
    Hmm iteration = bwl.iterate(yourHmm, learningSequences);
    System.out.println("\nIteration " + i + ":\n" + iteration.toString());
    yourHmm = iteration;
}
Sven Menschner
  • 603
  • 5
  • 12