public void Training() { var model = new HiddenMarkovModel(5, 5); model.InitialStateProbabilities = new double[] { 0.1, 0.3, 0.1, 0.4, 0.1 }; // all emission P should be 0.2 Assert.IsTrue(model.EmissionProbabilities.Cast <double>().All(e => e == 0.2)); int[] observations = new int[] { 4, 2, 3, 0, 1, 3, 2 }; int[] observations2 = new int[] { 3, 4, 0, 2, 1, 1, 4, 1, 3, 2 }; var sequence = Enumerable.Repeat(observations, 10); var sequence2 = Enumerable.Repeat(observations2, 10); model.train(sequence); Assert.AreEqual(model.EmissionProbabilities[1, 2], 0.25491738788355622); Assert.AreEqual(model.EmissionProbabilities[3, 1], 0.087887575284407757); model.train(sequence2); Assert.AreEqual(model.EmissionProbabilities[1, 2], 0.0096840128278279109); Assert.AreEqual(model.EmissionProbabilities[3, 1], 0.10439889167415384); Assert.AreEqual(model.TransitionProbabilities[1, 3], 0.35392973024268204); }