move create to the top
parent
6b6283c151
commit
a142556c52
|
@ -30,6 +30,12 @@
|
|||
using namespace std;
|
||||
using namespace gtsam;
|
||||
|
||||
/** Convert Signature into CPT */
|
||||
DecisionTreeFactor create(const Signature& signature) {
|
||||
DecisionTreeFactor p(signature.discreteKeys(), signature.cpt());
|
||||
return p;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
TEST(DecisionTreeFactor, ConstructorsMatch) {
|
||||
// Declare two keys
|
||||
|
@ -69,15 +75,6 @@ TEST(DecisionTreeFactor, constructors) {
|
|||
EXPECT_DOUBLES_EQUAL(0.8, f4(x121), 1e-9);
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
TEST(DecisionTreeFactor, Divide) {
|
||||
DiscreteKey A(0, 2), S(1, 2);
|
||||
DecisionTreeFactor pA = create(A % "99/1"), pS = create(S % "50/50");
|
||||
DecisionTreeFactor joint = pA * pS;
|
||||
DecisionTreeFactor s = joint / pA;
|
||||
EXPECT(assert_equal(pS, s));
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
TEST(DecisionTreeFactor, Error) {
|
||||
// Declare a bunch of keys
|
||||
|
@ -114,6 +111,15 @@ TEST(DecisionTreeFactor, multiplication) {
|
|||
CHECK(assert_equal(expected2, actual));
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
TEST(DecisionTreeFactor, Divide) {
|
||||
DiscreteKey A(0, 2), S(1, 2);
|
||||
DecisionTreeFactor pA = create(A % "99/1"), pS = create(S % "50/50");
|
||||
DecisionTreeFactor joint = pA * pS;
|
||||
DecisionTreeFactor s = joint / pA;
|
||||
EXPECT(assert_equal(pS, s));
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
TEST(DecisionTreeFactor, sum_max) {
|
||||
DiscreteKey v0(0, 3), v1(1, 2);
|
||||
|
@ -226,12 +232,6 @@ void maybeSaveDotFile(const DecisionTreeFactor& f, const string& filename) {
|
|||
#endif
|
||||
}
|
||||
|
||||
/** Convert Signature into CPT */
|
||||
DecisionTreeFactor create(const Signature& signature) {
|
||||
DecisionTreeFactor p(signature.discreteKeys(), signature.cpt());
|
||||
return p;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
// test Asia Joint
|
||||
TEST(DecisionTreeFactor, joint) {
|
||||
|
|
Loading…
Reference in New Issue