-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Free energy computation around deterministic nodes #7
Comments
I probably don't know enough about factor graphs and free energy, but... Hear me out. I have been thinking about the equality node from an implementation point of view lately. More precisely, the implementation as I have it in mind. Now in that view, I actually don't think you need an equality node and your problem may go away completely. In my understanding, the only reason to have an equality node is to 'copy' messages, so they are independent for the different attached nodes. In an observable reactive paradigm, I think you could capture this in the concept of subscriptions. This would mean that in the implementation the Also, these types of graphs are why you want things like PlantUML or something similar integration in your issue tracking :D Edit added |
I would much prefer to get rid of the equality node. It feels like a nuisance that arises from the desire to stick to Forney-style graphs. I actually think that this problem disappears if you work with standard factor graphs (https://en.wikipedia.org/wiki/Factor_graph). Yes. It is my understanding that it serves to copy messages as well. I'm glad to hear that this is possible with reactive programming. I'll give it a try! What, you don't like my hand-crafted, artisanal, ASCII art? ;) Thanks for the edit as well! I wrote the issue on shitty airport wifi and couldn't get back to fix it. |
Equality nodes don't copy messages. Equality nodes are branching nodes in generative direction and fusing nodes (by bayes rule) in "recognition" direction. Let's talk:) |
This is my understanding of the equality node: For an equality node with 2 edges,
the factor node function is f=(x,z) = δ(x-z) and the outgoing messages are:
So, the incoming message qx(x) becomes the outgoing message qx(z). Since qx indicates that the same distribution is used, I would call the outgoing message a copy of the incoming message. For an equality node with 3 edges,
the factor node function is f=(x,y,z) = δ(x-z)δ(x-y) and the outgoing messages are:
In other words, the outgoing message is a product of the copies of the incoming messages. So, what am I missing? Why would it be inappropriate to call this copying? And what do you mean exactly with "branching in the generative direction" and "fusing in the recognition direction"? |
In short, passing on the product of two messages is not copying but rather a very specific update rule. Longer version below. First, the proper update rules are just sum-product rules rather than variational update rules, see bullet 4 p.6 in long paper by Dauwels on VMP. Regarding the 3-edge equality node. Let's assume the equality node is positioned as we usually do in state-space models, ie, the forward message on x carries a prior, the upward message on y carries a likelihood msg and the forward msg on z carries a posterior. Assume the forward message for x is ready and the upward msg on y is 1 and the backward msg on z is also 1. This is the "generative (or "predictive") direction", since there is no likelihood msg and no backward msg from the future. Applying the update rules will lead to copying the forward msg of x onto both the forward msg on y and on the forward msg on z, iow, the msg x gets "branched" (copied). Now assume that y also carries a backward (likelihood) msg, then the message onto z is the product of the forward msg on x and the backward msg on y, ie, we execute bayes rule (prior times likelihood). This is not simply copying. Passing on the product of two messages is not the same as copying. (For instance, why not pass on the sum of two incoming messages). |
Currently, free energy is computed by the edges who query the connected nodes. However, deterministic nodes have no free energy.
This becomes a problem in equality nodes. Suppose we have 3 edges x,y and z connected via and equality node. They each are also connected to other nodes, f,g and h respectively.
To get the free energy for edge y, we would need to query the energies of f and h. Edge y cannot access these nodes, because the equality is in between. We need some way of passing energies through equality / deterministic nodes or some way for edges to reach beyond just their connected nodes.
Edit by Joris if you add three backticks around a graph it will be rendered as-is. This is typically just used for code, but helps in this case as well.
The text was updated successfully, but these errors were encountered: