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.

BayesTree

A BayesTree is a graphical model that represents the result of multifrontal variable elimination on a FactorGraph. It is a tree structure where each node is a ‘clique’ containing a set of conditional distributions P(Frontals∣Separator)P(\text{Frontals} | \text{Separator}).

Each clique k contains a conditional P(Fk∣Sk)P(F_k∣S_k), where FkF_k are frontal variables and SkS_k are separator variables. The joint probability distribution encoded by the Bayes tree is given by the product of all clique conditionals:

P(X)=∏kP(Fk∣Sk)P(X) = \prod_k P(F_k | S_k)

Key properties:

  • Cliques: Each node (clique) groups variables that are eliminated together.

  • Frontal Variables: Variables eliminated within a specific clique.

  • Separator Variables: Variables shared between a clique and its parent in the tree. These variables were eliminated higher up in the tree.

  • Tree Structure: Represents the dependencies introduced during elimination more compactly than a Bayes net, especially for sparse problems.

Like FactorGraph and BayesNet, BayesTree is templated on the type of conditional/clique (e.g., GaussianBayesTree).

Open In Colab

Creating a BayesTree (via Elimination)

BayesTrees are typically obtained by performing multifrontal elimination on a FactorGraph.

Original Factor Graph:
Loading...
Resulting BayesTree:
: cliques: 2, variables: 5
- p(x1 l2 x2 )
  R = [   1.61245 -0.620174 -0.620174 ]
      [         0   1.27098  -1.08941 ]
      [         0         0  0.654654 ]
  d = [ 0 0 0 ]
  mean: 3 elements
  l2: 0
  x1: 0
  x2: 0
  logNormalizationConstant: -2.46292
  No noise model
| - p(l1 x0  | x1)
  R = [   1.41421 -0.707107 ]
      [         0   1.58114 ]
  S[x1] = [ -0.707107 ]
          [ -0.948683 ]
  d = [ 0 0 ]
  logNormalizationConstant: -1.03316
  No noise model

Visualization:
Loading...
BayesTree number of cliques: 2

Solution and Marginals

Similar to BayesNet, BayesTree (specifically derived types like GaussianBayesTree) provides an optimize() method for finding the MLE solution. It also allows for efficient computation of marginals on individual variables or joint marginals on pairs of variables using belief propagation or shortcut evaluation on the tree.

Optimized Solution (MLE):
VectorValues: 5 elements
  l1: 0
  l2: 0
  x0: 0
  x1: 0
  x2: 0

Marginal Factor on x1:
GaussianConditional p(x1)
  R = [ 0.774597 ]
  d = [ 0 ]
  mean: 1 elements
  x1: 0
  logNormalizationConstant: -1.17435
  No noise model

Joint Marginal Factor Graph on (x0, x2):

size: 2
factor 0:  p(x0 | x2)
  R = [ 1.32288 ]
  S[x2] = [ -0.566947 ]
  d = [ 0 ]
  logNormalizationConstant: -0.639131
  No noise model
factor 1:  p(x2)
  R = [ 0.654654 ]
  d = [ 0 ]
  mean: 1 elements
  x2: 0
  logNormalizationConstant: -1.34259
  No noise model