我已经使用 jahmm 为草图“D”训练了一个 hmm 模型,该模型是按照 jahmm 网站的建议通过 K-means 初始化的,然后我使用 Baum-Welch 算法。经过训练,我测试了一个观察序列,通过 ForwardBackwardScaledCalculator.InProbability() 方法得到概率,代码是;
...
//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());
但是,lnProbability() 的结果就像 -196.25146 甚至更小(-300),这里有什么问题?是因为 HMm 没有训练好还是因为数据集?非常感谢任何建议!