AIMA.Test.Core.Unit.Probability.Reasoning.HMMTest.testRecursiveBackwardMessageCalculationIsCorrect C# (CSharp) Method

testRecursiveBackwardMessageCalculationIsCorrect() private method

private testRecursiveBackwardMessageCalculationIsCorrect ( ) : void
return void
        public void testRecursiveBackwardMessageCalculationIsCorrect()
        {
            RandomVariable afterOneStep = rainmanHmm.forward(rainmanHmm.prior(),
                    HmmConstants.DO_NOTHING, HmmConstants.SEE_UMBRELLA);
            RandomVariable afterTwoSteps = rainmanHmm.forward(afterOneStep,
                    HmmConstants.DO_NOTHING, HmmConstants.SEE_UMBRELLA);

            RandomVariable postSequence = afterTwoSteps.duplicate()
                    .createUnitBelief();

            RandomVariable smoothed = rainmanHmm.calculate_next_backward_message(
                    afterOneStep, postSequence, HmmConstants.SEE_UMBRELLA);
            Assert.AreEqual(0.883, smoothed
                    .getProbabilityOf(HmmConstants.RAINING), TOLERANCE);
            Assert.AreEqual(0.117, smoothed
                    .getProbabilityOf(HmmConstants.NOT_RAINING), TOLERANCE);
        }