[aGrUM] all approximated inference fixed

parent 780c490c
......@@ -108,24 +108,14 @@ namespace gum {
void ImportanceSampling< GUM_SCALAR >::_onContextualize(
BayesNetFragment< GUM_SCALAR >* bn) {
GUM_TRACE_VAR(this->hardEvidenceNodes());
for (auto ev : this->hardEvidenceNodes()) {
GUM_CHECKPOINT;
bn->uninstallCPT(ev);
GUM_TRACE_VAR(ev);
GUM_TRACE_VAR(this->hardEvidenceNodes());
bn->installCPT(ev, new Potential< GUM_SCALAR >(*this->evidence()[ev]));
GUM_CHECKPOINT;
// we keep the variables with hard evidence but alone
// bn->uninstallNode( sid[i] );
}
GUM_CHECKPOINT;
auto minParam = bn->minNonZeroParam();
auto minAccepted = this->epsilon() / bn->maxVarDomainSize();
GUM_CHECKPOINT;
if (minParam < minAccepted) this->_unsharpenBN(bn, minAccepted);
}
}
......@@ -9,11 +9,11 @@ void unsharpen(const gum::BayesNet< GUM_SCALAR >& bn) {
bn.cpt(nod).normalizeAsCPT();
}
}
template < typename GUM_SCALAR, template < typename > class INFERENCE >
bool __compareInference(const gum::BayesNet< GUM_SCALAR >& bn,
gum::LazyPropagation< GUM_SCALAR >& lazy,
INFERENCE< GUM_SCALAR >& inf,
double errmax = 5e-2) {
template < typename GUM_SCALAR >
bool __compareInference(const gum::BayesNet< GUM_SCALAR >& bn,
gum::LazyPropagation< GUM_SCALAR >& lazy,
gum::ApproximateInference< GUM_SCALAR >& inf,
double errmax = 5e-2) {
GUM_SCALAR err = static_cast< GUM_SCALAR >(0);
std::string argstr = "";
......@@ -50,10 +50,10 @@ bool __compareInference(const gum::BayesNet< GUM_SCALAR >& bn,
argstr += " inf : " + inf.posterior(node).toString() + " \n";
}
}
if (err > errmax) {
/*if (err > errmax) {
GUM_TRACE(argstr);
GUM_TRACE(inf.messageApproximationScheme());
}
}*/
return err <= errmax;
}
......
......@@ -16,17 +16,17 @@
TS_FAIL( "gum::Exception thrown" ); \
} )
#define APPROXINFERENCE_TEST_BEGIN_ITERATION \
#define GUM_APPROX_TEST_BEGIN_ITERATION \
bool res = false; \
(void)res; \
for ( int ii = 0; ii < 10; ii++ ) {
#define APPROXINFERENCE_TEST_END_ITERATION( ERRMAX ) \
#define GUM_APPROX_TEST_END_ITERATION( ERRMAX ) \
if ( __compareInference( bn, lazy, inf, ERRMAX ) ) { \
res = true; \
break; \
} \
std::cout << "![" << __LINE__ << "]"<<std::flush; \
if ( ii == 4 ) TS_FAIL( "even with 10 tries." ); \
if ( ii == 10 ) TS_FAIL( "even with 10 tries." ); \
}
#endif // AGRUM_TEST_SUITE_H
......@@ -77,12 +77,12 @@ namespace gum_tests {
lazy.makeInference();
try {
APPROXINFERENCE_TEST_BEGIN_ITERATION
GUM_APPROX_TEST_BEGIN_ITERATION
gum::GibbsSampling< float > inf(&bn);
inf.setEpsilon(EPSILON_FOR_GIBBS);
inf.setVerbosity(false);
inf.makeInference();
APPROXINFERENCE_TEST_END_ITERATION(EPSILON_FOR_GIBBS_SIMPLE_TEST)
GUM_APPROX_TEST_END_ITERATION(EPSILON_FOR_GIBBS_SIMPLE_TEST)
} catch (gum::Exception& e) {
GUM_SHOWERROR(e);
TS_ASSERT(false);
......@@ -99,14 +99,14 @@ namespace gum_tests {
lazy.makeInference();
try {
APPROXINFERENCE_TEST_BEGIN_ITERATION
GUM_APPROX_TEST_BEGIN_ITERATION
gum::GibbsSampling< float > inf(&bn);
inf.addEvidence("d", 0);
inf.addEvidence("g", 1);
inf.setEpsilon(EPSILON_FOR_GIBBS);
inf.setVerbosity(false);
inf.makeInference();
APPROXINFERENCE_TEST_END_ITERATION(EPSILON_FOR_GIBBS_SIMPLE_TEST)
GUM_APPROX_TEST_END_ITERATION(EPSILON_FOR_GIBBS_SIMPLE_TEST)
} catch (gum::Exception& e) {
GUM_SHOWERROR(e);
TS_ASSERT(false);
......@@ -124,13 +124,13 @@ namespace gum_tests {
lazy.addEvidence(bn.idFromName(ev), 0);
lazy.makeInference();
APPROXINFERENCE_TEST_BEGIN_ITERATION
GUM_APPROX_TEST_BEGIN_ITERATION
gum::GibbsSampling< float > inf(&bn);
inf.addEvidence(bn.idFromName(ev), 0);
inf.setEpsilon(EPSILON_FOR_GIBBS);
inf.setVerbosity(false);
inf.makeInference();
APPROXINFERENCE_TEST_END_ITERATION(EPSILON_FOR_GIBBS_SIMPLE_TEST)
GUM_APPROX_TEST_END_ITERATION(EPSILON_FOR_GIBBS_SIMPLE_TEST)
} catch (gum::Exception& e) {
GUM_SHOWERROR(e);
TS_ASSERT(false);
......@@ -149,13 +149,13 @@ namespace gum_tests {
lazy.addEvidence(bn.idFromName(ev), 0);
lazy.makeInference();
APPROXINFERENCE_TEST_BEGIN_ITERATION
GUM_APPROX_TEST_BEGIN_ITERATION
gum::GibbsSampling< float > inf(&bn);
inf.addEvidence(bn.idFromName(ev), 0);
inf.setEpsilon(EPSILON_FOR_GIBBS);
inf.setVerbosity(false);
inf.makeInference();
APPROXINFERENCE_TEST_END_ITERATION(EPSILON_FOR_GIBBS_SIMPLE_TEST)
GUM_APPROX_TEST_END_ITERATION(EPSILON_FOR_GIBBS_SIMPLE_TEST)
} catch (gum::Exception& e) {
GUM_SHOWERROR(e);
TS_ASSERT(false);
......@@ -173,13 +173,13 @@ namespace gum_tests {
lazy.addEvidence(bn.idFromName(ev), 0);
lazy.makeInference();
APPROXINFERENCE_TEST_BEGIN_ITERATION
GUM_APPROX_TEST_BEGIN_ITERATION
gum::GibbsSampling< float > inf(&bn);
inf.addEvidence(bn.idFromName(ev), 0);
inf.setEpsilon(EPSILON_FOR_GIBBS);
inf.setVerbosity(false);
inf.makeInference();
APPROXINFERENCE_TEST_END_ITERATION(EPSILON_FOR_GIBBS_SIMPLE_TEST)
GUM_APPROX_TEST_END_ITERATION(EPSILON_FOR_GIBBS_SIMPLE_TEST)
} catch (gum::Exception& e) {
GUM_SHOWERROR(e);
TS_ASSERT(false);
......@@ -198,7 +198,7 @@ namespace gum_tests {
lazy.addEvidence(bn.idFromName("h"), 0);
lazy.makeInference();
APPROXINFERENCE_TEST_BEGIN_ITERATION
GUM_APPROX_TEST_BEGIN_ITERATION
gum::GibbsSampling< float > inf(&bn);
inf.addEvidence(bn.idFromName("e"), 0);
inf.addEvidence(bn.idFromName("b"), 1);
......@@ -206,7 +206,7 @@ namespace gum_tests {
inf.setEpsilon(EPSILON_FOR_GIBBS);
inf.setVerbosity(false);
inf.makeInference();
APPROXINFERENCE_TEST_END_ITERATION(EPSILON_FOR_GIBBS_SIMPLE_TEST)
GUM_APPROX_TEST_END_ITERATION(EPSILON_FOR_GIBBS_SIMPLE_TEST)
} catch (gum::Exception& e) {
GUM_SHOWERROR(e);
TS_ASSERT(false);
......@@ -225,7 +225,7 @@ namespace gum_tests {
lazy.addEvidence(bn.idFromName("h"), 0);
lazy.makeInference();
APPROXINFERENCE_TEST_BEGIN_ITERATION
GUM_APPROX_TEST_BEGIN_ITERATION
gum::GibbsSampling< float > inf(&bn);
inf.addEvidence(bn.idFromName("e"), 0);
inf.addEvidence(bn.idFromName("b"), 1);
......@@ -233,7 +233,7 @@ namespace gum_tests {
inf.setVerbosity(false);
inf.setEpsilon(EPSILON_FOR_GIBBS);
inf.makeInference();
APPROXINFERENCE_TEST_END_ITERATION(EPSILON_FOR_GIBBS_SIMPLE_TEST)
GUM_APPROX_TEST_END_ITERATION(EPSILON_FOR_GIBBS_SIMPLE_TEST)
} catch (gum::Exception& e) {
GUM_SHOWERROR(e);
TS_ASSERT(false);
......@@ -248,12 +248,12 @@ namespace gum_tests {
gum::LazyPropagation< float > lazy(&bn);
lazy.makeInference();
APPROXINFERENCE_TEST_BEGIN_ITERATION
GUM_APPROX_TEST_BEGIN_ITERATION
gum::GibbsSampling< float > inf(&bn);
inf.setVerbosity(false);
inf.setEpsilon(EPSILON_FOR_GIBBS);
inf.makeInference();
APPROXINFERENCE_TEST_END_ITERATION(EPSILON_FOR_GIBBS_SIMPLE_TEST)
GUM_APPROX_TEST_END_ITERATION(EPSILON_FOR_GIBBS_SIMPLE_TEST)
} catch (gum::Exception& e) {
GUM_SHOWERROR(e);
TS_ASSERT(false);
......@@ -264,13 +264,13 @@ namespace gum_tests {
lazy.addEvidence(bn.idFromName("a"), 0);
lazy.makeInference();
APPROXINFERENCE_TEST_BEGIN_ITERATION
GUM_APPROX_TEST_BEGIN_ITERATION
gum::GibbsSampling< float > inf(&bn);
inf.addEvidence(bn.idFromName("a"), 0);
inf.setVerbosity(false);
inf.setEpsilon(EPSILON_FOR_GIBBS);
inf.makeInference();
APPROXINFERENCE_TEST_END_ITERATION(EPSILON_FOR_GIBBS_SIMPLE_TEST)
GUM_APPROX_TEST_END_ITERATION(EPSILON_FOR_GIBBS_SIMPLE_TEST)
} catch (gum::Exception& e) {
GUM_SHOWERROR(e);
TS_ASSERT(false);
......@@ -281,13 +281,13 @@ namespace gum_tests {
lazy.addEvidence(bn.idFromName("d"), 0);
lazy.makeInference();
APPROXINFERENCE_TEST_BEGIN_ITERATION
GUM_APPROX_TEST_BEGIN_ITERATION
gum::GibbsSampling< float > inf(&bn);
inf.addEvidence(bn.idFromName("d"), 0);
inf.setVerbosity(false);
inf.setEpsilon(EPSILON_FOR_GIBBS);
inf.makeInference();
APPROXINFERENCE_TEST_END_ITERATION(EPSILON_FOR_GIBBS_SIMPLE_TEST)
GUM_APPROX_TEST_END_ITERATION(EPSILON_FOR_GIBBS_SIMPLE_TEST)
} catch (gum::Exception& e) {
GUM_SHOWERROR(e);
TS_ASSERT(false);
......@@ -303,12 +303,12 @@ namespace gum_tests {
gum::LazyPropagation< float > lazy(&bn);
lazy.makeInference();
APPROXINFERENCE_TEST_BEGIN_ITERATION
GUM_APPROX_TEST_BEGIN_ITERATION
gum::GibbsSampling< float > inf(&bn);
inf.setVerbosity(false);
inf.setEpsilon(EPSILON_FOR_GIBBS);
inf.makeInference();
APPROXINFERENCE_TEST_END_ITERATION(EPSILON_FOR_GIBBS_SIMPLE_TEST)
GUM_APPROX_TEST_END_ITERATION(EPSILON_FOR_GIBBS_SIMPLE_TEST)
} catch (gum::Exception& e) {
GUM_SHOWERROR(e);
TS_ASSERT(false);
......@@ -319,13 +319,13 @@ namespace gum_tests {
lazy.addEvidence(bn.idFromName("a"), 0);
lazy.makeInference();
APPROXINFERENCE_TEST_BEGIN_ITERATION
GUM_APPROX_TEST_BEGIN_ITERATION
gum::GibbsSampling< float > inf(&bn);
inf.addEvidence(bn.idFromName("a"), 0);
inf.setVerbosity(false);
inf.setEpsilon(EPSILON_FOR_GIBBS);
inf.makeInference();
APPROXINFERENCE_TEST_END_ITERATION(EPSILON_FOR_GIBBS_SIMPLE_TEST)
GUM_APPROX_TEST_END_ITERATION(EPSILON_FOR_GIBBS_SIMPLE_TEST)
} catch (gum::Exception& e) {
GUM_SHOWERROR(e);
TS_ASSERT(false);
......@@ -336,13 +336,13 @@ namespace gum_tests {
lazy.addEvidence(bn.idFromName("d"), 0);
lazy.makeInference();
APPROXINFERENCE_TEST_BEGIN_ITERATION
GUM_APPROX_TEST_BEGIN_ITERATION
gum::GibbsSampling< float > inf(&bn);
inf.addEvidence(bn.idFromName("d"), 0);
inf.setVerbosity(false);
inf.setEpsilon(EPSILON_FOR_GIBBS);
inf.makeInference();
APPROXINFERENCE_TEST_END_ITERATION(EPSILON_FOR_GIBBS_SIMPLE_TEST)
GUM_APPROX_TEST_END_ITERATION(EPSILON_FOR_GIBBS_SIMPLE_TEST)
} catch (gum::Exception& e) {
GUM_SHOWERROR(e);
TS_ASSERT(false);
......@@ -361,13 +361,13 @@ namespace gum_tests {
gum::LazyPropagation< float > lazy(&bn);
lazy.makeInference();
APPROXINFERENCE_TEST_BEGIN_ITERATION
GUM_APPROX_TEST_BEGIN_ITERATION
gum::GibbsSampling< float > inf(&bn);
inf.setVerbosity(false);
inf.setEpsilon(EPSILON_FOR_HARD_GIBBS);
inf.setMinEpsilonRate(0.001);
inf.makeInference();
APPROXINFERENCE_TEST_END_ITERATION(EPSILON_FOR_GIBBS_HARD_TEST)
GUM_APPROX_TEST_END_ITERATION(EPSILON_FOR_GIBBS_HARD_TEST)
} catch (gum::Exception& e) {
GUM_SHOWERROR(e);
TS_ASSERT(false);
......@@ -385,14 +385,14 @@ namespace gum_tests {
gum::LazyPropagation< float > lazy(&bn);
lazy.makeInference();
APPROXINFERENCE_TEST_BEGIN_ITERATION
GUM_APPROX_TEST_BEGIN_ITERATION
gum::GibbsSampling< float > inf(&bn);
inf.setVerbosity(false);
inf.setEpsilon(EPSILON_FOR_HARD_GIBBS);
inf.setMinEpsilonRate(0.001);
inf.makeInference();
// alarm is not good for GibbsApprox
APPROXINFERENCE_TEST_END_ITERATION(EPSILON_FOR_GIBBS_HARD_TEST)
GUM_APPROX_TEST_END_ITERATION(EPSILON_FOR_GIBBS_HARD_TEST)
} catch (gum::Exception& e) {
GUM_SHOWERROR(e);
TS_ASSERT(false);
......
......@@ -59,12 +59,12 @@ namespace gum_tests {
try {
APPROXINFERENCE_TEST_BEGIN_ITERATION
GUM_APPROX_TEST_BEGIN_ITERATION
gum::ImportanceSampling< float > inf(&bn);
inf.setEpsilon(EPSILON_FOR_IMPORTANCE);
inf.makeInference();
APPROXINFERENCE_TEST_END_ITERATION(EPSILON_FOR_IMPORTANCE_SIMPLE_TEST)
GUM_APPROX_TEST_END_ITERATION(EPSILON_FOR_IMPORTANCE_SIMPLE_TEST)
} catch (gum::Exception& e) {
GUM_SHOWERROR(e);
......@@ -86,12 +86,12 @@ namespace gum_tests {
lazy.addEvidence(bn.idFromName(ev), 0);
lazy.makeInference();
APPROXINFERENCE_TEST_BEGIN_ITERATION
GUM_APPROX_TEST_BEGIN_ITERATION
gum::ImportanceSampling< float > inf(&bn);
inf.addEvidence(bn.idFromName(ev), 0);
inf.setEpsilon(EPSILON_FOR_IMPORTANCE);
inf.makeInference();
APPROXINFERENCE_TEST_END_ITERATION(EPSILON_FOR_IMPORTANCE_SIMPLE_TEST)
GUM_APPROX_TEST_END_ITERATION(EPSILON_FOR_IMPORTANCE_SIMPLE_TEST)
} catch (gum::Exception& e) {
GUM_SHOWERROR(e);
......@@ -111,13 +111,13 @@ namespace gum_tests {
lazy.addEvidence(bn.idFromName(ev), 0);
lazy.makeInference();
APPROXINFERENCE_TEST_BEGIN_ITERATION
GUM_APPROX_TEST_BEGIN_ITERATION
gum::ImportanceSampling< float > inf(&bn);
inf.addEvidence(bn.idFromName(ev), 0);
inf.setEpsilon(EPSILON_FOR_IMPORTANCE);
inf.setVerbosity(false);
inf.makeInference();
APPROXINFERENCE_TEST_END_ITERATION(EPSILON_FOR_IMPORTANCE_SIMPLE_TEST)
GUM_APPROX_TEST_END_ITERATION(EPSILON_FOR_IMPORTANCE_SIMPLE_TEST)
} catch (gum::Exception& e) {
GUM_SHOWERROR(e);
......@@ -137,13 +137,13 @@ namespace gum_tests {
lazy.addEvidence(bn.idFromName(ev), 0);
lazy.makeInference();
APPROXINFERENCE_TEST_BEGIN_ITERATION
GUM_APPROX_TEST_BEGIN_ITERATION
gum::ImportanceSampling< float > inf(&bn);
inf.addEvidence(bn.idFromName(ev), 0);
inf.setEpsilon(EPSILON_FOR_IMPORTANCE);
inf.setVerbosity(false);
inf.makeInference();
APPROXINFERENCE_TEST_END_ITERATION(EPSILON_FOR_IMPORTANCE_SIMPLE_TEST)
GUM_APPROX_TEST_END_ITERATION(EPSILON_FOR_IMPORTANCE_SIMPLE_TEST)
} catch (gum::Exception& e) {
GUM_SHOWERROR(e);
......@@ -165,7 +165,7 @@ namespace gum_tests {
lazy.addEvidence(bn.idFromName("h"), 0);
lazy.makeInference();
APPROXINFERENCE_TEST_BEGIN_ITERATION
GUM_APPROX_TEST_BEGIN_ITERATION
gum::ImportanceSampling< float > inf(&bn);
inf.addEvidence(bn.idFromName("e"), 0);
inf.addEvidence(bn.idFromName("b"), 1);
......@@ -173,7 +173,7 @@ namespace gum_tests {
inf.setEpsilon(EPSILON_FOR_IMPORTANCE);
inf.setVerbosity(false);
inf.makeInference();
APPROXINFERENCE_TEST_END_ITERATION(EPSILON_FOR_IMPORTANCE_SIMPLE_TEST)
GUM_APPROX_TEST_END_ITERATION(EPSILON_FOR_IMPORTANCE_SIMPLE_TEST)
} catch (gum::Exception& e) {
......@@ -196,7 +196,7 @@ namespace gum_tests {
lazy.addEvidence(bn.idFromName("h"), 0);
lazy.makeInference();
APPROXINFERENCE_TEST_BEGIN_ITERATION
GUM_APPROX_TEST_BEGIN_ITERATION
gum::ImportanceSampling< float > inf(&bn);
inf.addEvidence(bn.idFromName("e"), 0);
inf.addEvidence(bn.idFromName("b"), 1);
......@@ -204,7 +204,7 @@ namespace gum_tests {
inf.setVerbosity(false);
inf.setEpsilon(EPSILON_FOR_IMPORTANCE);
inf.makeInference();
APPROXINFERENCE_TEST_END_ITERATION(EPSILON_FOR_IMPORTANCE_SIMPLE_TEST)
GUM_APPROX_TEST_END_ITERATION(EPSILON_FOR_IMPORTANCE_SIMPLE_TEST)
} catch (gum::Exception& e) {
......@@ -223,12 +223,12 @@ namespace gum_tests {
gum::LazyPropagation< float > lazy(&bn);
lazy.makeInference();
APPROXINFERENCE_TEST_BEGIN_ITERATION
GUM_APPROX_TEST_BEGIN_ITERATION
gum::ImportanceSampling< float > inf(&bn);
inf.setVerbosity(false);
inf.setEpsilon(EPSILON_FOR_IMPORTANCE);
inf.makeInference();
APPROXINFERENCE_TEST_END_ITERATION(EPSILON_FOR_IMPORTANCE_SIMPLE_TEST)
GUM_APPROX_TEST_END_ITERATION(EPSILON_FOR_IMPORTANCE_SIMPLE_TEST)
} catch (gum::Exception& e) {
......@@ -242,13 +242,13 @@ namespace gum_tests {
lazy.addEvidence(bn.idFromName("a"), 0);
lazy.makeInference();
APPROXINFERENCE_TEST_BEGIN_ITERATION
GUM_APPROX_TEST_BEGIN_ITERATION
gum::ImportanceSampling< float > inf(&bn);
inf.addEvidence(bn.idFromName("a"), 0);
inf.setVerbosity(false);
inf.setEpsilon(EPSILON_FOR_IMPORTANCE);
inf.makeInference();
APPROXINFERENCE_TEST_END_ITERATION(EPSILON_FOR_IMPORTANCE_SIMPLE_TEST)
GUM_APPROX_TEST_END_ITERATION(EPSILON_FOR_IMPORTANCE_SIMPLE_TEST)
} catch (gum::Exception& e) {
......@@ -262,13 +262,13 @@ namespace gum_tests {
lazy.addEvidence(bn.idFromName("d"), 0);
lazy.makeInference();
APPROXINFERENCE_TEST_BEGIN_ITERATION
GUM_APPROX_TEST_BEGIN_ITERATION
gum::ImportanceSampling< float > inf(&bn);
inf.addEvidence(bn.idFromName("d"), 0);
inf.setVerbosity(false);
inf.setEpsilon(EPSILON_FOR_IMPORTANCE);
inf.makeInference();
APPROXINFERENCE_TEST_END_ITERATION(EPSILON_FOR_IMPORTANCE_SIMPLE_TEST)
GUM_APPROX_TEST_END_ITERATION(EPSILON_FOR_IMPORTANCE_SIMPLE_TEST)
} catch (gum::Exception& e) {
......@@ -288,12 +288,12 @@ namespace gum_tests {
gum::LazyPropagation< float > lazy(&bn);
lazy.makeInference();
APPROXINFERENCE_TEST_BEGIN_ITERATION
GUM_APPROX_TEST_BEGIN_ITERATION
gum::ImportanceSampling< float > inf(&bn);
inf.setVerbosity(false);
inf.setEpsilon(EPSILON_FOR_IMPORTANCE);
inf.makeInference();
APPROXINFERENCE_TEST_END_ITERATION(EPSILON_FOR_IMPORTANCE_SIMPLE_TEST)
GUM_APPROX_TEST_END_ITERATION(EPSILON_FOR_IMPORTANCE_SIMPLE_TEST)
} catch (gum::Exception& e) {
......@@ -307,13 +307,13 @@ namespace gum_tests {
lazy.addEvidence(bn.idFromName("a"), 0);
lazy.makeInference();
APPROXINFERENCE_TEST_BEGIN_ITERATION
GUM_APPROX_TEST_BEGIN_ITERATION
gum::ImportanceSampling< float > inf(&bn);
inf.addEvidence(bn.idFromName("a"), 0);
inf.setVerbosity(false);
inf.setEpsilon(EPSILON_FOR_IMPORTANCE);
inf.makeInference();
APPROXINFERENCE_TEST_END_ITERATION(EPSILON_FOR_IMPORTANCE_SIMPLE_TEST)
GUM_APPROX_TEST_END_ITERATION(EPSILON_FOR_IMPORTANCE_SIMPLE_TEST)
} catch (gum::Exception& e) {
......@@ -328,13 +328,13 @@ namespace gum_tests {
lazy.addEvidence(bn.idFromName("d"), 0);
lazy.makeInference();
APPROXINFERENCE_TEST_BEGIN_ITERATION
GUM_APPROX_TEST_BEGIN_ITERATION
gum::ImportanceSampling< float > inf(&bn);
inf.addEvidence(bn.idFromName("d"), 0);
inf.setVerbosity(false);
inf.setEpsilon(EPSILON_FOR_IMPORTANCE);
inf.makeInference();
APPROXINFERENCE_TEST_END_ITERATION(EPSILON_FOR_IMPORTANCE_SIMPLE_TEST)
GUM_APPROX_TEST_END_ITERATION(EPSILON_FOR_IMPORTANCE_SIMPLE_TEST)
} catch (gum::Exception& e) {
GUM_SHOWERROR(e);
......@@ -379,12 +379,12 @@ namespace gum_tests {
gum::LazyPropagation< float > lazy(&bn);
lazy.makeInference();
APPROXINFERENCE_TEST_BEGIN_ITERATION
GUM_APPROX_TEST_BEGIN_ITERATION
gum::ImportanceSampling< float > inf(&bn);
inf.setVerbosity(false);
inf.setEpsilon(EPSILON_FOR_IMPORTANCE);
inf.makeInference();
APPROXINFERENCE_TEST_END_ITERATION(EPSILON_FOR_IMPORTANCE_SIMPLE_TEST)
GUM_APPROX_TEST_END_ITERATION(EPSILON_FOR_IMPORTANCE_SIMPLE_TEST)
} catch (gum::Exception& e) {
......@@ -407,12 +407,12 @@ namespace gum_tests {
gum::LazyPropagation< float > lazy(&bn);
lazy.makeInference();
APPROXINFERENCE_TEST_BEGIN_ITERATION
GUM_APPROX_TEST_BEGIN_ITERATION
gum::ImportanceSampling< float > inf(&bn);
inf.setVerbosity(false);
inf.setEpsilon(EPSILON_FOR_IMPORTANCE);
inf.makeInference();
APPROXINFERENCE_TEST_END_ITERATION(EPSILON_FOR_IMPORTANCE_SIMPLE_TEST)
GUM_APPROX_TEST_END_ITERATION(EPSILON_FOR_IMPORTANCE_SIMPLE_TEST)
} catch (gum::Exception& e) {
......
......@@ -58,11 +58,11 @@ namespace gum_tests {
lazy.makeInference();
try {
APPROXINFERENCE_TEST_BEGIN_ITERATION
GUM_APPROX_TEST_BEGIN_ITERATION
gum::MonteCarloSampling< float > inf(&bn);
inf.setEpsilon(EPSILON_FOR_MONTECARLO);
inf.makeInference();
APPROXINFERENCE_TEST_END_ITERATION(EPSILON_FOR_MONTECARLO_SIMPLE_TEST)
GUM_APPROX_TEST_END_ITERATION(EPSILON_FOR_MONTECARLO_SIMPLE_TEST)
} catch (gum::Exception& e) {
GUM_SHOWERROR(e);
TS_ASSERT(false);
......@@ -78,11 +78,11 @@ namespace gum_tests {
lazy.makeInference();
try {
APPROXINFERENCE_TEST_BEGIN_ITERATION
GUM_APPROX_TEST_BEGIN_ITERATION
gum::MonteCarloSampling< float > inf(&bn);
inf.setEpsilon(EPSILON_FOR_MONTECARLO);
inf.makeInference();
APPROXINFERENCE_TEST_END_ITERATION(EPSILON_FOR_MONTECARLO_SIMPLE_TEST)
GUM_APPROX_TEST_END_ITERATION(EPSILON_FOR_MONTECARLO_SIMPLE_TEST)
} catch (gum::Exception& e) {
GUM_SHOWERROR(e);
TS_ASSERT(false);
......@@ -103,12 +103,12 @@ namespace gum_tests {
lazy.addEvidence(bn.idFromName(ev), 0);
lazy.makeInference();
APPROXINFERENCE_TEST_BEGIN_ITERATION
GUM_APPROX_TEST_BEGIN_ITERATION
gum::MonteCarloSampling< float > inf(&bn);
inf.addEvidence(bn.idFromName(ev), 0);
inf.setEpsilon(EPSILON_FOR_MONTECARLO);
inf.makeInference();
APPROXINFERENCE_TEST_END_ITERATION(EPSILON_FOR_MONTECARLO_SIMPLE_TEST)
GUM_APPROX_TEST_END_ITERATION(EPSILON_FOR_MONTECARLO_SIMPLE_TEST)
} catch (gum::Exception& e) {
GUM_SHOWERROR(e);
......@@ -127,13 +127,13 @@ namespace gum_tests {
lazy.addEvidence(bn.idFromName(ev), 0);
lazy.makeInference();
APPROXINFERENCE_TEST_BEGIN_ITERATION
GUM_APPROX_TEST_BEGIN_ITERATION
gum::MonteCarloSampling< float > inf(&bn);
inf.addEvidence(bn.idFromName(ev), 0);
inf.setEpsilon(EPSILON_FOR_MONTECARLO);
inf.setVerbosity(false);
inf.makeInference();
APPROXINFERENCE_TEST_END_ITERATION(EPSILON_FOR_MONTECARLO_SIMPLE_TEST)
GUM_APPROX_TEST_END_ITERATION(EPSILON_FOR_MONTECARLO_SIMPLE_TEST)
} catch (gum::Exception& e) {
GUM_SHOWERROR(e);
......@@ -153,13 +153,13 @@ namespace gum_tests {
lazy.addEvidence(bn.idFromName(ev), 0);
lazy.makeInference();
APPROXINFERENCE_TEST_BEGIN_ITERATION
GUM_APPROX_TEST_BEGIN_ITERATION
gum::MonteCarloSampling< float > inf(&bn);
inf.addEvidence(bn.idFromName(ev), 0);
inf.setEpsilon(EPSILON_FOR_MONTECARLO);
inf.setVerbosity(false);
inf.makeInference();
APPROXINFERENCE_TEST_END_ITERATION(EPSILON_FOR_MONTECARLO_SIMPLE_TEST)
GUM_APPROX_TEST_END_ITERATION(EPSILON_FOR_MONTECARLO_SIMPLE_TEST)
} catch (gum::Exception& e) {
GUM_SHOWERROR(e);
......@@ -180,7 +180,7 @@ namespace gum_tests {
lazy.addEvidence(bn.idFromName("h"), 0);
lazy.makeInference();
APPROXINFERENCE_TEST_BEGIN_ITERATION
GUM_APPROX_TEST_BEGIN_ITERATION
gum::MonteCarloSampling< float > inf(&bn);
inf.addEvidence(bn.idFromName("e"), 0);
inf.addEvidence(bn.idFromName("b"), 1);
......@@ -188,7 +188,7 @@ namespace gum_tests {
inf.setEpsilon(EPSILON_FOR_MONTECARLO);
inf.setVerbosity(false);
inf.makeInference();
APPROXINFERENCE_TEST_END_ITERATION(EPSILON_FOR_MONTECARLO_SIMPLE_TEST)
GUM_APPROX_TEST_END_ITERATION(EPSILON_FOR_MONTECARLO_SIMPLE_TEST)
} catch (gum::Exception& e) {
......@@ -210,7 +210,7 @@ namespace gum_tests {
lazy.addEvidence(bn.idFromName("h"), 0);
lazy.makeInference();
APPROXINFERENCE_TEST_BEGIN_ITERATION
GUM_APPROX_TEST_BEGIN_ITERATION
gum::MonteCarloSampling< float > inf(&bn);
inf.addEvidence(bn.idFromName("e"), 0);
inf.addEvidence(bn.idFromName("b"), 1);
......@@ -218,7 +218,7 @@ namespace gum_tests {
inf.setVerbosity(false);
inf.setEpsilon(EPSILON_FOR_MONTECARLO);
inf.makeInference();
APPROXINFERENCE_TEST_END_ITERATION(EPSILON_FOR_MONTECARLO_SIMPLE_TEST)
GUM_APPROX_TEST_END_ITERATION(EPSILON_FOR_MONTECARLO_SIMPLE_TEST)
} catch (gum::Exception& e) {
......@@ -237,12 +237,12 @@ namespace gum_tests {
gum::LazyPropagation< float > lazy(&bn);
lazy.makeInference();
APPROXINFERENCE_TEST_BEGIN_ITERATION
GUM_APPROX_TEST_BEGIN_ITERATION
gum::MonteCarloSampling< float > inf(&bn);
inf.setVerbosity(false);
inf.setEpsilon(EPSILON_FOR_MONTECARLO);
inf.makeInference();
APPROXINFERENCE_TEST_END_ITERATION(EPSILON_FOR_MONTECARLO_SIMPLE_TEST)
GUM_APPROX_TEST_END_ITERATION(EPSILON_FOR_MONTECARLO_SIMPLE_TEST)
} catch (gum::Exception& e) {
......@@ -256,13 +256,13 @@ namespace gum_tests {
lazy.addEvidence(bn.idFromName("a"), 0);
lazy.makeInference();
APPROXINFERENCE_TEST_BEGIN_ITERATION
GUM_APPROX_TEST_BEGIN_ITERATION
gum::MonteCarloSampling< float > inf(&bn);
inf.addEvidence(bn.idFromName("a"), 0);
inf.setVerbosity(false);
inf.setEpsilon(EPSILON_FOR_MONTECARLO);
inf.makeInference();
APPROXINFERENCE_TEST_END_ITERATION(EPSILON_FOR_MONTECARLO_SIMPLE_TEST)
GUM_APPROX_TEST_END_ITERATION(EPSILON_FOR_MONTECARLO_SIMPLE_TEST)
} catch (gum::Exception& e) {
......@@ -276,13 +276,13 @@ namespace gum_tests {
lazy.addEvidence(bn.idFromName("d"), 0);
lazy.makeInference();
APPROXINFERENCE_TEST_BEGIN_ITERATION
GUM_APPROX_TEST_BEGIN_ITERATION
gum::MonteCarloSampling< float > inf(&bn);
inf.addEvidence(bn.idFromName("d"), 0);
inf.setVerbosity(false);
inf.setEpsilon(EPSILON_FOR_MONTECARLO);
inf.makeInference();
APPROXINFERENCE_TEST_END_ITERATION(EPSILON_FOR_MONTECARLO_SIMPLE_TEST)
GUM_APPROX_TEST_END_ITERATION(EPSILON_FOR_MONTECARLO_SIMPLE_TEST)
} catch (gum::Exception& e) {
......@@ -301,12 +301,12 @@ namespace gum_tests {
gum::LazyPropagation< float > lazy(&bn);
lazy.makeInference();
APPROXINFERENCE_TEST_BEGIN_ITERATION
GUM_APPROX_TEST_BEGIN_ITERATION
gum::MonteCarloSampling< float > inf(&bn);
inf.setVerbosity(false);
inf.setEpsilon(EPSILON_FOR_MONTECARLO);
inf.makeInference();
APPROXINFERENCE_TEST_END_ITERATION(EPSILON_FOR_MONTECARLO_SIMPLE_TEST)
GUM_APPROX_TEST_END_ITERATION(EPSILON_FOR_MONTECARLO_SIMPLE_TEST)
} catch (gum::Exception& e) {
......@@ -320,13 +320,13 @@ namespace gum_tests {
lazy.addEvidence(bn.idFromName("a"), 0);
lazy.makeInference();
APPROXINFERENCE_TEST_BEGIN_ITERATION
GUM_APPROX_TEST_BEGIN_ITERATION
gum::MonteCarloSampling< float > inf(&bn);