예제 #1
0
        public void GmmParseErrors(string fullGrad, string positions, string alphas, string means, string icfs)
        {
            var comparer = new JacobianComparison(defaultTolerance);

            comparer.CompareGmmFullAndPartGradients(fullGrad, new[] { positions, alphas, means, icfs });
            Assert.True(comparer.ViolationsHappened());
            Assert.True(comparer.ParseError);
        }
예제 #2
0
        public void GmmDimensionMismatch()
        {
            var comparer = new JacobianComparison(defaultTolerance);

            comparer.CompareGmmFullAndPartGradients(cutGmm, new[] { positions, alphas, means, icfs });
            Assert.True(comparer.ViolationsHappened());
            Assert.False(comparer.ParseError);
            Assert.True(comparer.DimensionMismatch);
        }
예제 #3
0
        public void GoodGmmFailOnSmallTolerance()
        {
            var comparer = new JacobianComparison(1e-8);

            comparer.CompareGmmFullAndPartGradients(goodGmm, new[] { positions, alphas, means, icfs });
            Assert.True(comparer.ViolationsHappened());
            Assert.False(comparer.ParseError);
            Assert.False(comparer.DimensionMismatch);
            Assert.True(comparer.MaxDifference <= defaultTolerance);
            Assert.True(comparer.DifferenceViolationCount > 0);
            Assert.Equal(15, comparer.NumberComparisonCount);
            Assert.NotEmpty(comparer.DifferenceViolations);
        }
예제 #4
0
        public void BadGmmFail()
        {
            var comparer = new JacobianComparison(defaultTolerance);

            comparer.CompareGmmFullAndPartGradients(badGmm, new[] { positions, alphas, means, icfs });
            Assert.True(comparer.ViolationsHappened());
            Assert.False(comparer.ParseError);
            Assert.False(comparer.DimensionMismatch);
            Assert.False(comparer.MaxDifference <= defaultTolerance);
            Assert.Equal(8, comparer.DifferenceViolationCount);
            Assert.Equal(15, comparer.NumberComparisonCount);
            Assert.NotEmpty(comparer.DifferenceViolations);
            for (int i = 0; i < 15; i += 2)
            {
                Assert.Contains((0, i), comparer.DifferenceViolations);
            }
            for (int i = 1; i < 15; i += 2)
            {
                Assert.DoesNotContain((0, i), comparer.DifferenceViolations);
            }
        }