test exposing incorrect conversion
parent
456df093f1
commit
b91c470b69
|
@ -147,6 +147,36 @@ TEST(TableFactor, constructors) {
|
||||||
EXPECT(assert_inequal(f5_with_wrong_keys, f5, 1e-9));
|
EXPECT(assert_inequal(f5_with_wrong_keys, f5, 1e-9));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ************************************************************************* */
|
||||||
|
// Check conversion from DecisionTreeFactor.
|
||||||
|
TEST(TableFactor, Conversion) {
|
||||||
|
/* This is the DecisionTree we are using
|
||||||
|
Choice(m2)
|
||||||
|
0 Choice(m1)
|
||||||
|
0 0 Leaf 0
|
||||||
|
0 1 Choice(m0)
|
||||||
|
0 1 0 Leaf 0
|
||||||
|
0 1 1 Leaf 0.14649446 // 3
|
||||||
|
1 Choice(m1)
|
||||||
|
1 0 Choice(m0)
|
||||||
|
1 0 0 Leaf 0
|
||||||
|
1 0 1 Leaf 0.14648756 // 5
|
||||||
|
1 1 Choice(m0)
|
||||||
|
1 1 0 Leaf 0.14649446 // 6
|
||||||
|
1 1 1 Leaf 0.23918345 // 7
|
||||||
|
*/
|
||||||
|
DiscreteKeys dkeys = {{0, 2}, {1, 2}, {2, 2}};
|
||||||
|
DecisionTreeFactor dtf(
|
||||||
|
dkeys, std::vector<double>{0, 0, 0, 0.14649446, 0, 0.14648756, 0.14649446,
|
||||||
|
0.23918345});
|
||||||
|
|
||||||
|
// dtf.print();
|
||||||
|
TableFactor tf(dtf.discreteKeys(), dtf);
|
||||||
|
// tf.print();
|
||||||
|
// tf.toDecisionTreeFactor().print();
|
||||||
|
EXPECT(assert_equal(dtf, tf.toDecisionTreeFactor()));
|
||||||
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
// Check multiplication between two TableFactors.
|
// Check multiplication between two TableFactors.
|
||||||
TEST(TableFactor, multiplication) {
|
TEST(TableFactor, multiplication) {
|
||||||
|
|
Loading…
Reference in New Issue