small improvements to comments and code structure

release/4.3a0
Varun Agrawal 2023-07-13 16:06:16 -04:00
parent 6a26ecf971
commit f7071298c3
2 changed files with 5 additions and 5 deletions

View File

@ -39,8 +39,7 @@ bool HybridBayesNet::equals(const This &bn, double tol) const {
/* ************************************************************************* */ /* ************************************************************************* */
DiscreteConditional::shared_ptr HybridBayesNet::discreteConditionals() const { DiscreteConditional::shared_ptr HybridBayesNet::discreteConditionals() const {
// The canonical decision tree factor which will get // The joint discrete probability.
// the discrete conditionals added to it.
DiscreteConditional discreteProbs; DiscreteConditional discreteProbs;
for (auto &&conditional : *this) { for (auto &&conditional : *this) {
@ -152,7 +151,7 @@ void HybridBayesNet::updateDiscreteConditionals(
// Convert pointer from conditional to factor // Convert pointer from conditional to factor
auto discreteFactor = auto discreteFactor =
std::dynamic_pointer_cast<DecisionTreeFactor>(discrete); std::dynamic_pointer_cast<DecisionTreeFactor>(discrete);
// Apply prunerFunc to the underlying AlgebraicDecisionTree // Apply prunerFunc to the underlying conditional
DecisionTreeFactor::ADT prunedDiscreteFactor = DecisionTreeFactor::ADT prunedDiscreteFactor =
discreteFactor->apply(prunerFunc(prunedDiscreteProbs, *conditional)); discreteFactor->apply(prunerFunc(prunedDiscreteProbs, *conditional));
@ -173,7 +172,7 @@ void HybridBayesNet::updateDiscreteConditionals(
/* ************************************************************************* */ /* ************************************************************************* */
HybridBayesNet HybridBayesNet::prune(size_t maxNrLeaves) { HybridBayesNet HybridBayesNet::prune(size_t maxNrLeaves) {
// Get the decision tree of only the discrete keys // Get the joint distribution of only the discrete keys
gttic_(HybridBayesNet_PruneDiscreteConditionals); gttic_(HybridBayesNet_PruneDiscreteConditionals);
DiscreteConditional::shared_ptr discreteConditionals = DiscreteConditional::shared_ptr discreteConditionals =
this->discreteConditionals(); this->discreteConditionals();

View File

@ -97,7 +97,8 @@ HybridSmoother::addConditionals(const HybridGaussianFactorGraph &originalGraph,
HybridGaussianFactorGraph graph(originalGraph); HybridGaussianFactorGraph graph(originalGraph);
HybridBayesNet hybridBayesNet(originalHybridBayesNet); HybridBayesNet hybridBayesNet(originalHybridBayesNet);
// If we are not at the first iteration, means we have conditionals to add. // If hybridBayesNet is not empty,
// it means we have conditionals to add to the factor graph.
if (!hybridBayesNet.empty()) { if (!hybridBayesNet.empty()) {
// We add all relevant conditional mixtures on the last continuous variable // We add all relevant conditional mixtures on the last continuous variable
// in the previous `hybridBayesNet` to the graph // in the previous `hybridBayesNet` to the graph