add timing checkpoints
parent
50d24ab38e
commit
2b72f75a07
|
@ -161,12 +161,14 @@ void HybridBayesNet::updateDiscreteConditionals(
|
||||||
DecisionTreeFactor::ADT prunedDiscreteTree =
|
DecisionTreeFactor::ADT prunedDiscreteTree =
|
||||||
discreteTree->apply(prunerFunc(prunedDiscreteProbs, *conditional));
|
discreteTree->apply(prunerFunc(prunedDiscreteProbs, *conditional));
|
||||||
|
|
||||||
|
gttic_(HybridBayesNet_MakeConditional);
|
||||||
// Create the new (hybrid) conditional
|
// Create the new (hybrid) conditional
|
||||||
KeyVector frontals(discrete->frontals().begin(),
|
KeyVector frontals(discrete->frontals().begin(),
|
||||||
discrete->frontals().end());
|
discrete->frontals().end());
|
||||||
auto prunedDiscrete = std::make_shared<DiscreteLookupTable>(
|
auto prunedDiscrete = std::make_shared<DiscreteLookupTable>(
|
||||||
frontals.size(), conditional->discreteKeys(), prunedDiscreteTree);
|
frontals.size(), conditional->discreteKeys(), prunedDiscreteTree);
|
||||||
conditional = std::make_shared<HybridConditional>(prunedDiscrete);
|
conditional = std::make_shared<HybridConditional>(prunedDiscrete);
|
||||||
|
gttoc_(HybridBayesNet_MakeConditional);
|
||||||
|
|
||||||
// Add it back to the BayesNet
|
// Add it back to the BayesNet
|
||||||
this->at(i) = conditional;
|
this->at(i) = conditional;
|
||||||
|
@ -177,12 +179,16 @@ 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 decision tree of only the discrete keys
|
||||||
|
gttic_(HybridBayesNet_PruneDiscreteConditionals);
|
||||||
DecisionTreeFactor::shared_ptr discreteConditionals =
|
DecisionTreeFactor::shared_ptr discreteConditionals =
|
||||||
this->discreteConditionals();
|
this->discreteConditionals();
|
||||||
const DecisionTreeFactor prunedDiscreteProbs =
|
const DecisionTreeFactor prunedDiscreteProbs =
|
||||||
discreteConditionals->prune(maxNrLeaves);
|
discreteConditionals->prune(maxNrLeaves);
|
||||||
|
gttoc_(HybridBayesNet_PruneDiscreteConditionals);
|
||||||
|
|
||||||
|
gttic_(HybridBayesNet_UpdateDiscreteConditionals);
|
||||||
this->updateDiscreteConditionals(prunedDiscreteProbs);
|
this->updateDiscreteConditionals(prunedDiscreteProbs);
|
||||||
|
gttoc_(HybridBayesNet_UpdateDiscreteConditionals);
|
||||||
|
|
||||||
/* To Prune, we visitWith every leaf in the GaussianMixture.
|
/* To Prune, we visitWith every leaf in the GaussianMixture.
|
||||||
* For each leaf, using the assignment we can check the discrete decision tree
|
* For each leaf, using the assignment we can check the discrete decision tree
|
||||||
|
@ -193,6 +199,7 @@ HybridBayesNet HybridBayesNet::prune(size_t maxNrLeaves) {
|
||||||
|
|
||||||
HybridBayesNet prunedBayesNetFragment;
|
HybridBayesNet prunedBayesNetFragment;
|
||||||
|
|
||||||
|
gttic_(HybridBayesNet_PruneMixtures);
|
||||||
// Go through all the conditionals in the
|
// Go through all the conditionals in the
|
||||||
// Bayes Net and prune them as per prunedDiscreteProbs.
|
// Bayes Net and prune them as per prunedDiscreteProbs.
|
||||||
for (auto &&conditional : *this) {
|
for (auto &&conditional : *this) {
|
||||||
|
@ -209,6 +216,7 @@ HybridBayesNet HybridBayesNet::prune(size_t maxNrLeaves) {
|
||||||
prunedBayesNetFragment.push_back(conditional);
|
prunedBayesNetFragment.push_back(conditional);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
gttoc_(HybridBayesNet_PruneMixtures);
|
||||||
|
|
||||||
return prunedBayesNetFragment;
|
return prunedBayesNetFragment;
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ static GaussianFactorGraphTree addGaussian(
|
||||||
// TODO(dellaert): it's probably more efficient to first collect the discrete
|
// TODO(dellaert): it's probably more efficient to first collect the discrete
|
||||||
// keys, and then loop over all assignments to populate a vector.
|
// keys, and then loop over all assignments to populate a vector.
|
||||||
GaussianFactorGraphTree HybridGaussianFactorGraph::assembleGraphTree() const {
|
GaussianFactorGraphTree HybridGaussianFactorGraph::assembleGraphTree() const {
|
||||||
gttic(assembleGraphTree);
|
gttic_(assembleGraphTree);
|
||||||
|
|
||||||
GaussianFactorGraphTree result;
|
GaussianFactorGraphTree result;
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ GaussianFactorGraphTree HybridGaussianFactorGraph::assembleGraphTree() const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gttoc(assembleGraphTree);
|
gttoc_(assembleGraphTree);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -235,7 +235,9 @@ hybridElimination(const HybridGaussianFactorGraph &factors,
|
||||||
gttic_(hybrid_eliminate);
|
gttic_(hybrid_eliminate);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
gttic_(hybrid_continuous_eliminate);
|
||||||
auto result = EliminatePreferCholesky(graph, frontalKeys);
|
auto result = EliminatePreferCholesky(graph, frontalKeys);
|
||||||
|
gttoc_(hybrid_continuous_eliminate);
|
||||||
|
|
||||||
#ifdef HYBRID_TIMING
|
#ifdef HYBRID_TIMING
|
||||||
gttoc_(hybrid_eliminate);
|
gttoc_(hybrid_eliminate);
|
||||||
|
|
Loading…
Reference in New Issue