Address review comments

release/4.3a0
Frank Dellaert 2023-07-16 12:37:01 +02:00
parent 3d979763f0
commit 3edde4d693
4 changed files with 8 additions and 8 deletions

View File

@ -76,7 +76,7 @@ GTSAM_CONCEPT_TESTABLE_INST(CrazyDecisionTree)
/* ************************************************************************** */ /* ************************************************************************** */
// Create a decision stump one one variable 'a' with values 10 and 20. // Create a decision stump one one variable 'a' with values 10 and 20.
TEST(DecisionTree, constructor) { TEST(DecisionTree, Constructor) {
DecisionTree<char, int> tree('a', 10, 20); DecisionTree<char, int> tree('a', 10, 20);
// Evaluate the tree on an assignment to the variable. // Evaluate the tree on an assignment to the variable.
@ -129,7 +129,7 @@ struct Ring {
/* ************************************************************************** */ /* ************************************************************************** */
// Check that creating decision trees respects key order. // Check that creating decision trees respects key order.
TEST(DecisionTree, constructor_order) { TEST(DecisionTree, ConstructorOrder) {
// Create labels // Create labels
string A("A"), B("B"); string A("A"), B("B");
@ -159,7 +159,7 @@ TEST(DecisionTree, constructor_order) {
/* ************************************************************************** */ /* ************************************************************************** */
// test DT // test DT
TEST(DecisionTree, example) { TEST(DecisionTree, Example) {
// Create labels // Create labels
string A("A"), B("B"), C("C"); string A("A"), B("B"), C("C");

View File

@ -28,7 +28,7 @@ using namespace std;
using namespace gtsam; using namespace gtsam;
/* ************************************************************************* */ /* ************************************************************************* */
TEST(DecisionTreeFactor, constructors_match) { TEST(DecisionTreeFactor, ConstructorsMatch) {
// Declare two keys // Declare two keys
DiscreteKey X(0, 2), Y(1, 3); DiscreteKey X(0, 2), Y(1, 3);

View File

@ -140,7 +140,7 @@ namespace gtsam {
/** Access the conditional */ /** Access the conditional */
const sharedConditional& conditional() const { return conditional_; } const sharedConditional& conditional() const { return conditional_; }
/// Is this the root of a Bayes tree? /// Return true if this clique is the root of a Bayes tree.
inline bool isRoot() const { return parent_.expired(); } inline bool isRoot() const { return parent_.expired(); }
/// Return the number of children. /// Return the number of children.

View File

@ -20,7 +20,7 @@ from gtsam.utils.test_case import GtsamTestCase
import gtsam import gtsam
from gtsam import (DiscreteBayesNet, DiscreteBayesTreeClique, from gtsam import (DiscreteBayesNet, DiscreteBayesTreeClique,
DiscreteConditional, DiscreteFactorGraph, DiscreteConditional, DiscreteFactorGraph,
DiscreteKeys, DiscreteValues, Ordering) DiscreteValues, Ordering)
class TestDiscreteBayesNet(GtsamTestCase): class TestDiscreteBayesNet(GtsamTestCase):
@ -32,7 +32,7 @@ class TestDiscreteBayesNet(GtsamTestCase):
# Define DiscreteKey pairs. # Define DiscreteKey pairs.
keys = [(j, 2) for j in range(15)] keys = [(j, 2) for j in range(15)]
# Create thin-tree Bayesnet. # Create thin-tree Bayes net.
bayesNet = DiscreteBayesNet() bayesNet = DiscreteBayesNet()
bayesNet.add(keys[0], [keys[8], keys[12]], "2/3 1/4 3/2 4/1") bayesNet.add(keys[0], [keys[8], keys[12]], "2/3 1/4 3/2 4/1")
@ -121,7 +121,7 @@ class TestDiscreteBayesNet(GtsamTestCase):
graph.add([x2, a2, x3], table) graph.add([x2, a2, x3], table)
# Eliminate for MPE (maximum probable explanation). # Eliminate for MPE (maximum probable explanation).
ordering = Ordering([A(2), X(3), X(1), A(1), X(2)]) ordering = Ordering(keys=[A(2), X(3), X(1), A(1), X(2)])
lookup = graph.eliminateMultifrontal(ordering, gtsam.EliminateForMPE) lookup = graph.eliminateMultifrontal(ordering, gtsam.EliminateForMPE)
# Check that the lookup table is correct # Check that the lookup table is correct