Accord.Tests.Statistics.Models.Fields.IndependentForwardBackwardAlgorithmTest.LogForwardGesturesPriorsTest C# (CSharp) Method

LogForwardGesturesPriorsTest() private method

private LogForwardGesturesPriorsTest ( ) : void
return void
        public void LogForwardGesturesPriorsTest()
        {
            int[] labels;
            double[][][] words;
            var classifier = IndependentMarkovFunctionTest.CreateModel4(out words, out labels, true);

            var function = new MarkovMultivariateFunction(classifier);
            var target = new HiddenConditionalRandomField<double[]>(function);

            foreach (var word in words)
            {
                for (int c = 0; c < 3; c++)
                {
                    var actual = Accord.Statistics.Models.Fields.ForwardBackwardAlgorithm.LogForward(
                        target.Function.Factors[c], word, c);

                    var expected = Accord.Statistics.Models.Markov.ForwardBackwardAlgorithm.LogForward(
                        classifier[c], word);

                    for (int i = 0; i < actual.GetLength(0); i++)
                    {
                        for (int j = 0; j < actual.GetLength(1); j++)
                        {
                            double a = actual[i, j];
                            double e = expected[i, j];

                            // TODO: Verify if is possible to reduce this tolerance
                            Assert.IsTrue(e.IsRelativelyEqual(a, 0.1));
                        }
                    }
                }
            }
        }