TobiasMadsen / dgRaph

Discrete factor graphs in R
3 stars 2 forks source link

Avoid redoing sumProduct Algorithm #5

Open TobiasMadsen opened 9 years ago

TobiasMadsen commented 9 years ago

With this commit d636c404678178ba2da6f6e73750dd866e73cc6d the option to calculate the normalising constant without rerunning the sumproduct-algorithm was removed. This was done primarily because those function would fail in case of disconnected graphs. At the same time we want to delegate the decision of whether sumProduct needs to be run to the sumproduct algorithm itself.

Possible solution: Have a private boolean indicating if internal state(potentials) has changed since sumProduct was run last.

Complications: MaxSum algorithm uses same set of messages to do calculations. Identify other scenarios where sumProduct needs to be re-run.

TobiasMadsen commented 9 years ago

Complication: Remember statemasks i.e. observed variables.