From d40de22c32b12ff8d7454ab94f25a3fa71ba9960 Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Sat, 25 Jun 2011 00:33:30 +0200 Subject: [PATCH] chi-square test cleanups --- data/tests/test_bsdf.xml | 18 +++++++++--------- include/mitsuba/core/chisquare.h | 5 +---- src/libcore/chisquare.cpp | 4 ++++ src/tests/test_chisquare.cpp | 10 ++++++++-- 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/data/tests/test_bsdf.xml b/data/tests/test_bsdf.xml index 2450e5c7..0c826dff 100644 --- a/data/tests/test_bsdf.xml +++ b/data/tests/test_bsdf.xml @@ -80,6 +80,15 @@ + + + + + + + + @@ -98,14 +107,5 @@ - - - - - - - - diff --git a/include/mitsuba/core/chisquare.h b/include/mitsuba/core/chisquare.h index d09d2569..4e2e75c5 100644 --- a/include/mitsuba/core/chisquare.h +++ b/include/mitsuba/core/chisquare.h @@ -20,10 +20,7 @@ #define __CHI_SQUARE_TEST_H #include -#include -#include -#include -#include +#include MTS_NAMESPACE_BEGIN diff --git a/src/libcore/chisquare.cpp b/src/libcore/chisquare.cpp index f1b4d003..442d88f8 100644 --- a/src/libcore/chisquare.cpp +++ b/src/libcore/chisquare.cpp @@ -17,6 +17,10 @@ */ #include +#include +#include +#include +#include MTS_NAMESPACE_BEGIN diff --git a/src/tests/test_chisquare.cpp b/src/tests/test_chisquare.cpp index ed2b6dbf..e33a83e7 100644 --- a/src/tests/test_chisquare.cpp +++ b/src/tests/test_chisquare.cpp @@ -20,6 +20,12 @@ #include #include #include +#include + +/* Statistical significance level of the test. Set to + 1/2 percent by default -- we want there to be notable + evidence before failing a test case */ +#define SIGNIFICANCE_LEVEL 0.005f MTS_NAMESPACE_BEGIN @@ -149,7 +155,7 @@ public: ); // (the following assumes that the distribution has 1 parameter, e.g. exponent value) - ChiSquare::ETestResult result = chiSqr->runTest(1); + ChiSquare::ETestResult result = chiSqr->runTest(1, SIGNIFICANCE_LEVEL); if (result == ChiSquare::EReject) { std::string filename = formatString("failure_%i.m", failureCount++); chiSqr->dumpTables(filename); @@ -190,7 +196,7 @@ public: ); // (the following assumes that the distribution has 1 parameter, e.g. exponent value) - ChiSquare::ETestResult result = chiSqr->runTest(1); + ChiSquare::ETestResult result = chiSqr->runTest(1, SIGNIFICANCE_LEVEL); if (result == ChiSquare::EReject) { std::string filename = formatString("failure_%i.m", failureCount++); chiSqr->dumpTables(filename);