JuliaRobotics / IncrementalInference.jl

Clique recycling non-Gaussian (multi-modal) factor graph solver; also see Caesar.jl.
MIT License
72 stars 21 forks source link

how to do Gaussian belief propagation on tree #464

Open dehann opened 4 years ago

dehann commented 4 years ago

which variables and factors (maybe conditionals) are needed in each clique?

dehann commented 4 years ago

The Factor Graph

Screenshot from 2019-12-05 19-28-58

@Affie does not want to (immediately) upload himself -- so now im doing it ;-) Lets work from here. Calling on @tonioteran who draws beautiful graphics on the same issue.

The issue comes back to whether Bayes tree cliques are densely connected (like the Bayes Net). Remember the Bayes tree is picked up from the Bayes Net. Other way Bayes Net is a squashed Bayes tree.

First hypothesis is that the densely connected structure of the Bayes net is in large part carried by the ordering of the Bayes tree itself.

dehann commented 4 years ago

variable ordering is: 0, 2, 4, 1, 3, 5

Affie commented 4 years ago

The Tree for variable ordering 0,2,4,1,3,5

Screenshot from 2019-12-05 19-27-18

dehann commented 4 years ago

Look, closely at the structure of the tree.

Q: When does the relationship (conditionals) between x3, x5, x1 (root) come into affect?

A: Look at each of the children -- when calculating x3,x5 in the left child, the mixing through x4 does occur in both the up and downward direction.

This is easy to see in a numerical approach when initial values for x3, x4, x5 exist.

Aside Q: What if no initialization values exist? How should information from the prior on x0 arrive at upward frontal and separators for (x4 : x3,x5). Is cascading up and down passes the correct way to solve this problem? This is what is currently implemented in CSM treeinit: https://github.com/JuliaRobotics/IncrementalInference.jl/blob/62a87ed1b02e7f5488911051348dc039a4eaad77/src/CliqStateMachine.jl#L369

dehann commented 4 years ago

Also see:

dehann commented 4 years ago

Just as a note, the "method of triples" also exists.

tonioteran commented 4 years ago

I'll finish some graphics and then post them here to try and elucidate some concepts.

Affie commented 4 years ago

Elimination of the factor graph illustrated in a tree

Flipped from tree image above. "upsolve" image

"downsolve" (back substitution in the matrix equivalent) image

dehann commented 4 years ago

Okay, lets make this worse -- should up and down solves (on the tree message passing) be symmetric. Or should different factors be used in different cliques during the up or down pass -- think of priors as first case.

Also think of initializing variables on the tree. Should priors show up as early as possible during an up pass, or should priors only occur for frontals mid tree, and rather rely on downward initialization messages first.

dehann commented 4 years ago

Initialization on tree, how would we initialize x1,x2,x3 since prior is on x0.

FYI: https://vimeo.com/332507701

dehann commented 4 years ago

you can only pass information on the tree following the links -- so if a clique does not have enough info lower from below, then it must initialize with a message from parent down.

tonioteran commented 4 years ago

similar graph as the one at the top, but with one additional variable (l_1). specifies how to go from factor graph, to chordal bayes net, to bayes tree for a specific ordering. you wonder, aren't cliques densely connected: well yes, in the chordal bayes net sense (color coded). nonetheless, when one analyses the factors and the portion of the factor graph contained within each clique (which is the actual information being used for inference), then the variables involved are not fully connected: the tree just specifies us the order in which to carry out operations.

hex-slam.pdf

tonioteran commented 4 years ago

the latter part (which parts of the factor graph land in which cliques) i will have pictorially depicted in a bit

tonioteran commented 4 years ago

here's what the upstream messages would look like, e.g., the "smart factors" or priors being passed up towards the root (all based on the previous example)

hex-slam-upstream-factors-in-cliques.pdf

EDIT: TT, errata -- yellow root matrix should be fully dense (top right corner of submatrix is nonzero)

dehann commented 4 years ago

hi @tonioteran , thanks those are great!!

So after many hours today we think we have better wording to describe what is going on with Bayes net vs Bayes tree, will post that text here.

dehann commented 4 years ago

Definitions

Example

Look at clique: (x0:x1,x5)

eliminate x0 from factor graph produces (in the Bayes net) conditionals x5->x0, x1->x0, plus a new product-factor between x0,x5:

Expontial Families are special (congruency)

Non-parametric design:

dehann commented 4 years ago

https://github.com/JuliaRobotics/Caesar.jl/pull/445/files

dehann commented 4 years ago

Previous comment, placing here so that it does not get lost

See node x1 to x3 in IncrementalInference issue 464. It does not branch or provide additional prior information. so it is collapsed into one factor between x1 and x3, solved in the root and the individual variable can be solved by inference.

Affie commented 4 months ago

https://github.com/JuliaRobotics/IncrementalInference.jl/compare/23Q4/exp/par_tree