32 template class BayesTreeCliqueBase<HybridBayesTreeClique,
33 HybridGaussianFactorGraph>;
34 template class BayesTree<HybridBayesTreeClique>;
51 if (root_conditional->isDiscrete()) {
52 dbn.
push_back(root_conditional->asDiscrete());
55 throw std::runtime_error(
56 "HybridBayesTree root is not discrete-only. Please check elimination " 57 "ordering or use continuous factor graph.");
89 : assignment_(assignment),
90 parentClique_(parentClique),
91 gaussianbayesTree_(gbt),
111 if (hybrid_conditional->isHybrid()) {
112 conditional = (*hybrid_conditional->asMixture())(parentData.
assignment_);
113 }
else if (hybrid_conditional->isContinuous()) {
114 conditional = hybrid_conditional->asGaussian();
117 conditional = std::make_shared<GaussianConditional>();
123 clique = std::make_shared<GaussianBayesTree::Node>(conditional);
128 parentData.
valid_ =
false;
146 treeTraversal::no_op visitorPost;
165 if (gbt.
size() == 0) {
177 this->
roots_.at(0)->conditional()->asDiscrete();
180 decisionTree->
root_ = prunedDecisionTree.
root_;
183 struct HybridPrunerData {
188 : prunedDecisionTree(prunedDecisionTree) {}
198 static HybridPrunerData AssignmentPreOrderVisitor(
205 if (conditional->isHybrid()) {
206 auto gaussianMixture = conditional->asMixture();
208 gaussianMixture->
prune(parentData.prunedDecisionTree);
214 HybridPrunerData rootData(prunedDecisionTree, 0);
216 treeTraversal::no_op visitorPost;
220 *
this, rootData, HybridPrunerData::AssignmentPreOrderVisitor,
DecisionTreeFactor prune(size_t maxNrAssignments) const
Prune the decision tree of discrete variables.
std::shared_ptr< This > shared_ptr
shared_ptr to this class
sharedClique sharedNode
Synonym for sharedClique (TODO: remove)
void addClique(const sharedClique &clique, const sharedClique &parent_clique=sharedClique())
const DiscreteValues assignment_
IsDerived< DERIVEDFACTOR > push_back(std::shared_ptr< DERIVEDFACTOR > factor)
Add a factor directly using a shared_ptr.
Base class for cliques of a BayesTree.
bool equals(const This &other, double tol=1e-9) const
static HybridAssignmentData AssignmentPreOrderVisitor(const HybridBayesTree::sharedNode &node, HybridAssignmentData &parentData)
A function used during tree traversal that operates on each node before visiting the node's children...
DiscreteValues optimize(OptionalOrderingType orderingType={}) const
Find the maximum probable explanation (MPE) by doing max-product.
void prune(const size_t maxNumberLeaves)
Prune the underlying Bayes tree.
GaussianBayesTree choose(const DiscreteValues &assignment) const
Get the Gaussian Bayes Tree which corresponds to a specific discrete value assignment.
A Bayes net of Gaussian Conditionals indexed by discrete keys.
NodePtr root_
A DecisionTree just contains the root. TODO(dellaert): make protected.
VectorValues optimize() const
void DepthFirstForestParallel(FOREST &forest, DATA &rootData, VISITOR_PRE &visitorPre, VISITOR_POST &visitorPost, int problemSizeThreshold=10)
Hybrid Bayes Tree, the result of eliminating a HybridJunctionTree.
HybridValues optimize() const
Optimize the hybrid Bayes tree by computing the MPE for the current set of discrete variables and usi...
GaussianBayesTree::sharedNode parentClique_
Bayes Tree is a tree of cliques of a Bayes Chain.
std::shared_ptr< This > shared_ptr
shared_ptr to this class
GaussianBayesTree * gaussianbayesTree_
HybridAssignmentData(const DiscreteValues &assignment, const GaussianBayesTree::sharedNode &parentClique, GaussianBayesTree *gbt, bool valid=true)
Construct a new Hybrid Assignment Data object.
const sharedClique & clique(Key j) const
bool equals(const This &other, double tol=1e-9) const
Helper class for Depth First Forest traversal on the HybridBayesTree.