Reputation: 43
I've trained a hmm model for sketch "D" using jahmm, the model is initilized via K-means as suggested by jahmm website, then I use Baum-Welch algorithm. After trained, I test a sequence of observation, and get the probability by ForwardBackwardScaledCalculator.InProbability() method, the code is;
...
//training
KMeansLearner<ObservationInteger> kml = new KMeansLearner<ObservationInteger>(20, new OpdfIntegerFactory(256), seqs);
KullbackLeiblerDistanceCalculator klc = new KullbackLeiblerDistanceCalculator();
Hmm initHmm = kml.learn();
BaumWelchLearner bwl = new BaumWelchLearner();
Hmm<ObservationInteger> learntHmm = bwl.iterate(initHmm, seqs);
for (int i = 0; i < 10; i++) {
System.out.println("Distance at iteration : " + klc.distance(learntHmm, initHmm));
learntHmm = bwl.iterate(learntHmm, seqs);
}
return learntHmm
//test
ForwardBackwardScaledCalculator fbc = new ForwardBackwardScaledCalculator(testseqs,trainedHmm);
System.out.println(fbc.lnProbability());
however, the result of lnProbability() is like -196.25146 or even smaller (-300), what's the problem here? does it because the HMm is not trained well or because of the dataset? Really appreciate any suggestions!
Upvotes: 0
Views: 222
Reputation: 17
it has been a long time since you asked but since I have also used the same library with a similar way, let me try to answer your question.
The thing with Hmms is that the recognition probability is dependable to the size of the dataset and the larger the dataset the less the probability of recognition will be. You could try to set your recognition threshold with regards to the dataset size, or by getting an average value of the recognition probability of same accurate representations of your model.
Upvotes: 2