Merge branch 'fix-1496' into decisiontree-improvements

release/4.3a0
Varun Agrawal 2023-06-26 14:49:04 -04:00
commit 3d7163a995
1 changed files with 13 additions and 6 deletions

View File

@ -308,10 +308,15 @@ namespace gtsam {
size_t nrLeaves() const; size_t nrLeaves() const;
/** /**
* @brief Return the number of total leaf assignments. * @brief This is a convenience function which returns the total number of
* This includes counts removed from implicit pruning hence, * leaf assignments in the decision tree.
* it will always be >= nrLeaves(). * This function is not used for anymajor operations within the discrete
* * factor graph framework.
*
* Leaf assignments represent the cardinality of each leaf node, e.g. in a
* binary tree each leaf has 2 assignments. This includes counts removed
* from implicit pruning hence, it will always be >= nrLeaves().
*
* E.g. we have a decision tree as below, where each node has 2 branches: * E.g. we have a decision tree as below, where each node has 2 branches:
* *
* Choice(m1) * Choice(m1)
@ -322,9 +327,11 @@ namespace gtsam {
* 1 0 Leaf 1.0 * 1 0 Leaf 1.0
* 1 1 Leaf 2.0 * 1 1 Leaf 2.0
* *
* In the unpruned form, the tree will have 4 assignments, 2 for each key, and 4 leaves. * In the unpruned form, the tree will have 4 assignments, 2 for each key,
* and 4 leaves.
* *
* In the pruned form, the number of assignments is still 4 but the number of leaves is now 3, as below: * In the pruned form, the number of assignments is still 4 but the number
* of leaves is now 3, as below:
* *
* Choice(m1) * Choice(m1)
* 0 Leaf 0.0 * 0 Leaf 0.0