From d545793bc57c6432ba146165ac31ec1d8c197c37 Mon Sep 17 00:00:00 2001 From: Joseph Lizier Date: Thu, 25 Jul 2019 10:14:57 +1000 Subject: [PATCH] Patching unit test on KSG MI with discrete which tested that result changed from K=2 to 4, but the threshold for change was too large. --- .../MutualInfoMultiVariateWithDiscreteKraskovTester.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/java/unittests/infodynamics/measures/mixed/kraskov/MutualInfoMultiVariateWithDiscreteKraskovTester.java b/java/unittests/infodynamics/measures/mixed/kraskov/MutualInfoMultiVariateWithDiscreteKraskovTester.java index 4bfdf967..984d1f86 100755 --- a/java/unittests/infodynamics/measures/mixed/kraskov/MutualInfoMultiVariateWithDiscreteKraskovTester.java +++ b/java/unittests/infodynamics/measures/mixed/kraskov/MutualInfoMultiVariateWithDiscreteKraskovTester.java @@ -249,7 +249,14 @@ public void testProperties() throws Exception { miCalc.initialise(1, 2); miCalc.setObservations(contData, discData); double res3 = miCalc.computeAverageLocalOfObservations(); - assertTrue(Math.abs(res3 - res1) > 0.001); + double diff = Math.abs(res3 - res1); + double tol = 1e-6; + if (diff <= tol) { + System.out.printf("KSG MI with discrete changed less (%.8f) than %.7f when K changed from 2 to 4." + + "That can happen at random, but we are failing the unit test as a warning; re-run to check.\n", + diff, tol); + } + assertTrue(diff > tol); miCalc.setProperty("k", "4"); // Test that noiseLevel has an effect