prune and then add to BayesNet

release/4.3a0
Varun Agrawal 2025-01-24 18:04:33 -05:00
parent 26642f1ba0
commit 2644c4baa9
1 changed files with 3 additions and 2 deletions

View File

@ -58,11 +58,12 @@ HybridBayesNet HybridBayesNet::prune(size_t maxNrLeaves,
joint = joint * (*conditional);
}
// Prune the joint. NOTE: imperative and, again, possibly quite expensive.
joint.prune(maxNrLeaves);
// Create the result starting with the pruned joint.
HybridBayesNet result;
result.emplace_shared<DiscreteConditional>(joint);
// Prune the joint. NOTE: imperative and, again, possibly quite expensive.
result.back()->asDiscrete()->prune(maxNrLeaves);
// Get pruned discrete probabilities so
// we can prune HybridGaussianConditionals.