Esempio n. 1
0
        public void TestDiscBWL()
        {
            var hmm = BuildDiscHMM();
            var learntHmm = BuildDiscInitHMM();
            var mg = new MarkovGenerator(hmm);
            var training = mg.GenerateSequences(200, 100);
            var bwl = new TrainBaumWelch(learntHmm, training);
            var klc = new KullbackLeiblerDistanceCalculator();

            bwl.Iteration(5);
            learntHmm = (HiddenMarkovModel) bwl.Method;

            var e = klc.Distance(learntHmm, hmm);
            Assert.IsTrue(e < 0.01);
        }
        public void Validate(HiddenMarkovModel result, HiddenMarkovModel source)
        {
            KullbackLeiblerDistanceCalculator klc =
                    new KullbackLeiblerDistanceCalculator();

            double e = klc.Distance(result, source);
            Assert.IsTrue(e < 0.01);
        }
Esempio n. 3
0
        public void TestDiscKMeans()
        {
            var hmm = BuildDiscHMM();

            var mg = new MarkovGenerator(hmm);
            var sequences = mg.GenerateSequences(200, 100);

            var trainer = new TrainKMeans(hmm, sequences);
            var klc =
                new KullbackLeiblerDistanceCalculator();

            trainer.Iteration(5);
            var learntHmm = (HiddenMarkovModel) trainer.Method;
            var e = klc.Distance(learntHmm, hmm);
            Assert.IsTrue(e < 0.05);
        }