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); }
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); }
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); }
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); } }