Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

HybridBayesTree

Open In Colab

A HybridBayesTree is the hybrid equivalent of a gtsam.GaussianBayesTree. It represents the result of multifrontal variable elimination on a HybridGaussianFactorGraph.

Like a standard Bayes tree, it’s a tree structure where each node is a ‘clique’. However, in a HybridBayesTree, each clique contains a gtsam.HybridConditional representing P(Fk∣Sk)P(F_k | S_k), where FkF_k are the frontal variables eliminated in that clique, and SkS_k are the separator variables shared with the parent clique.

In hybrid Bayes trees discrete variables can only occur as frontal variables if the separator is entirely discrete, i.e., we will never have the situation that a discrete variable is conditioned on a continuous variable.

The joint probability distribution P(X,M)P(X, M) encoded by the tree is the product of all clique conditionals:

P(X,M)=∏kP(Fk:Sk)P(X, M) = \prod_k P(F_k : S_k)

Compared to a HybridBayesNet (from sequential elimination), a HybridBayesTree is (a) tree-structured, (b) often has a shallower structure. Both are advantageous for inference tasks like marginalization and incremental updates, especially in sparse problems common in robotics (SLAM).

Creating a HybridBayesTree (via Elimination)

HybridBayesTree objects are obtained by performing multifrontal elimination on a HybridGaussianFactorGraph.

Original HybridGaussianFactorGraph:
Loading...

Elimination Ordering: Position 0: x0, x1, d0


Resulting HybridBayesTree:
Loading...

Operations on HybridBayesTree

Similar to HybridBayesNet, the tree can be used for optimization, evaluation, and extracting specific conditional distributions.


MAP Solution (Optimize):
HybridValues: 
  Continuous: 2 elements
  x0: 0
  x1: 1
  Discrete: (d0, 0)
  Nonlinear
Values with 0 values:

MPE Discrete Assignment:
DiscreteValues{7205759403792793600: 0}

Optimized Continuous Solution for D0=0:
VectorValues: 2 elements
  x0: 0
  x1: 1

Optimized Continuous Solution for D0=1:
VectorValues: 2 elements
  x0: 1.90476
  x1: 3.09524

Total Error at MAP solution: 0.023412453920796855

GaussianBayesTree for D0=0:
: cliques: 3, variables: 2
- p()
  R = Empty (0x0)
  d = Empty (0x1)
  mean: 0 elements
  logNormalizationConstant: -0
  No noise model
| - p(x1)
  R = [ 2.21565 ]
  d = [ 2.21565 ]
  mean: 1 elements
  x1: 1
  logNormalizationConstant: -0.123394
  No noise model
| | - p(x0 | x1)
  R = [ 3.31662 ]
  S[x1] = [ -3.01511 ]
  d = [ -3.01511 ]
  logNormalizationConstant: 0.280009
  No noise model