fix test case
parent
e5fea0da52
commit
9b7f4b3f54
|
|
@ -137,7 +137,9 @@ namespace gtsam {
|
||||||
// Applying binary operator to two leaves results in a leaf
|
// Applying binary operator to two leaves results in a leaf
|
||||||
NodePtr apply_g_op_fL(const Leaf& fL, const Binary& op) const override {
|
NodePtr apply_g_op_fL(const Leaf& fL, const Binary& op) const override {
|
||||||
// fL op gL
|
// fL op gL
|
||||||
NodePtr h(new Leaf(op(fL.constant_, constant_), nrAssignments_));
|
// TODO(Varun) nrAssignments setting is not correct.
|
||||||
|
// Depending on f and g, the nrAssignments can be different. This is a bug!
|
||||||
|
NodePtr h(new Leaf(op(fL.constant_, constant_), fL.nrAssignments()));
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -496,13 +498,11 @@ namespace gtsam {
|
||||||
// DecisionTree
|
// DecisionTree
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
template<typename L, typename Y>
|
template<typename L, typename Y>
|
||||||
DecisionTree<L, Y>::DecisionTree() {
|
DecisionTree<L, Y>::DecisionTree() {}
|
||||||
}
|
|
||||||
|
|
||||||
template<typename L, typename Y>
|
template<typename L, typename Y>
|
||||||
DecisionTree<L, Y>::DecisionTree(const NodePtr& root) :
|
DecisionTree<L, Y>::DecisionTree(const NodePtr& root) :
|
||||||
root_(root) {
|
root_(root) {}
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
template<typename L, typename Y>
|
template<typename L, typename Y>
|
||||||
|
|
|
||||||
|
|
@ -356,14 +356,14 @@ size: 2
|
||||||
factor 0: f[ (m0,2), (m1,2), (m2,2), ]
|
factor 0: f[ (m0,2), (m1,2), (m2,2), ]
|
||||||
Choice(m2)
|
Choice(m2)
|
||||||
0 Choice(m1)
|
0 Choice(m1)
|
||||||
0 0 Leaf [1] 0
|
0 0 Leaf [2] 0
|
||||||
0 1 Choice(m0)
|
0 1 Choice(m0)
|
||||||
0 1 0 Leaf [1]0.27527634
|
0 1 0 Leaf [1]0.27527634
|
||||||
0 1 1 Leaf [1]0.44944733
|
0 1 1 Leaf [1] 0
|
||||||
1 Choice(m1)
|
1 Choice(m1)
|
||||||
1 0 Leaf [1] 0
|
1 0 Leaf [2] 0
|
||||||
1 1 Choice(m0)
|
1 1 Choice(m0)
|
||||||
1 1 0 Leaf [1] 0
|
1 1 0 Leaf [1]0.44944733
|
||||||
1 1 1 Leaf [1]0.27527634
|
1 1 1 Leaf [1]0.27527634
|
||||||
factor 1: f[ (m0,2), (m1,2), (m2,2), (m3,2), ]
|
factor 1: f[ (m0,2), (m1,2), (m2,2), (m3,2), ]
|
||||||
Choice(m3)
|
Choice(m3)
|
||||||
|
|
@ -442,7 +442,7 @@ factor 1: f[ (m0,2), (m1,2), (m2,2), (m3,2), ]
|
||||||
)";
|
)";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DiscreteKeys d0{{M(2), 2}, {M(1), 2}, {M(0), 2}};
|
DiscreteKeys d0{{M(0), 2}, {M(1), 2}, {M(2), 2}};
|
||||||
std::vector<double> p0 = {0, 0, 0.17054468, 0.27845056, 0, 0, 0, 0.17054468};
|
std::vector<double> p0 = {0, 0, 0.17054468, 0.27845056, 0, 0, 0, 0.17054468};
|
||||||
AlgebraicDecisionTree<Key> dt(d0, p0);
|
AlgebraicDecisionTree<Key> dt(d0, p0);
|
||||||
//TODO(Varun) Passing ADT to DiscreteConditional causes nrAssignments to get messed up
|
//TODO(Varun) Passing ADT to DiscreteConditional causes nrAssignments to get messed up
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue