public void AbsoluteConvergenceConstructorTest() { var criteria = new AbsoluteConvergence(iterations: 10, tolerance: 0.1); int progress = 1; do { // Do some processing... // Update current iteration information: criteria.NewValue = 12345.6 / progress++; } while (!criteria.HasConverged); // The method will converge after reaching the // maximum of 10 iterations with a final value // of 1371.73: int iterations = criteria.CurrentIteration; // 10 double value = criteria.OldValue; // 1371.7333333 Assert.AreEqual(10, criteria.CurrentIteration); Assert.AreEqual(1371.7333333333333, criteria.OldValue); }
/// <summary> /// Initializes a new instance of the <see cref="BaseBaumWelchLearning"/> class. /// </summary> /// protected BaseBaumWelchLearning(IHiddenMarkovModel model) { this.convergence = new AbsoluteConvergence(); this.model = model; }
/// <summary> /// Creates a new instance of the Viterbi learning algorithm. /// </summary> /// public ViterbiLearning(HiddenMarkovModel model) { this.convergence = new AbsoluteConvergence(); this.mle = new MaximumLikelihoodLearning(model); }