# computing EP messages in factor graph

I'm using infer.net for implementing a dynamic Bayesian network model. every node in each layer is dependent on all nodes in previous layer (we want to train wji, the weights of edges between each node j from the previous level (time t-1) to node i in current level (time t)). node values are shown by yi (value of node i). The dependency is a complicated function like: yi(t) = y(t-1).(1-alpha.deltaT) + beta . 1 / (1 + exp(-WeightedSigma)) WeightedSigma = Sigma (Wij * yj(t)) Now I want to put a factor node in my factor graph implementation in infer.NET. I don't know how should I implement such factor node and its message passing. I'm so confused. Can anyone please help me in this case? I appreciate any help. Thanks

## 1 Answer

The only part of this expression that you need a custom factor for is the function $1/(1+\exp(-Sigma(x)))$. This is a function from a scalar to a scalar, so should be relatively easy to implement using quadrature. For examples of this approach, see section 13.8 of Bayesian Data Analysis (third edition) or section 1.4 of EP: A quick reference.

• Thanks for your reply. I'm going to read the documents. – user3034939 Sep 4 '14 at 13:52
• Dear Tom How can I define the messages passed from this factor node to each Wij, and to alpha and betas? I don't know how exactly should I define messages: research.microsoft.com/en-us/um/cambridge/projects/infernet/… Like in this link how they are computed after we have the distribution after removing data i (\i)? Thanks a lot – user3034939 Sep 10 '14 at 21:20
• The other thing is that, I have these different variables (there are two matrices W1 and W2 which are used in this Wij*Yj term) to which I have to send messages from my factor node. As I explained before I have 1 / (1 + exp(-WeightedSigma)){ in the formula: WeightedSigma = Sum (Wij * yj(t)) } Now I don't understand how to propagate these messages back to these W's (elements of W1 and W2). – user3034939 Sep 10 '14 at 22:24
• Messages to W, alpha, and beta are handled by the product factor. Take a look at the TrueSkill paper for an example of how message passing gets broken down across different factors. – Tom Minka Sep 11 '14 at 13:08