locked
a factor of several operations RRS feed

  • Question

  • Hello

    I have an operation like y=exp(a.b+c.x) in my model. y is a Gaussian distributed variable, which its observed values come from the expression exp(a.b+c.x). a and c are observed values here and b, and x are variables which I need to infer their distribution. In fact I don't want y to have an exponential distribution. How can I implement this? I don't know how should my message passing for EP be implemented in this case?

    What is the difference if I use {tow product factor (for a.b and c.x) and a plus factor, then an exponential factor } or I use { one factor node with all these operations done in that factor at once}? I don't understand the difference. Would you please help me in this case?

    Many thanks!


    • Edited by Capli19 Monday, September 1, 2014 11:50 AM
    Monday, September 1, 2014 11:49 AM

Answers

  • You shouldn't need to implement a new factor to do this, since these operations are all included in Infer.NET.  Implementing all of these operations in a single factor will have no benefit on the accuracy, since the linear part is already handled exactly.  The only inexactness here is in the 'exp' factor.  By the way, y cannot be Gaussian distributed since the output of the exponential function is always positive. 
    • Marked as answer by Capli19 Monday, September 1, 2014 9:55 PM
    • Unmarked as answer by Capli19 Monday, September 1, 2014 9:59 PM
    • Marked as answer by Capli19 Monday, September 1, 2014 9:59 PM
    Monday, September 1, 2014 1:10 PM
    Owner
  • Right.
    • Marked as answer by Capli19 Monday, September 1, 2014 9:57 PM
    Monday, September 1, 2014 3:33 PM
    Owner
  • Use Variable.ConstrainPositive.
    • Marked as answer by Capli19 Monday, September 1, 2014 9:55 PM
    Monday, September 1, 2014 5:06 PM
    Owner

All replies

  • You shouldn't need to implement a new factor to do this, since these operations are all included in Infer.NET.  Implementing all of these operations in a single factor will have no benefit on the accuracy, since the linear part is already handled exactly.  The only inexactness here is in the 'exp' factor.  By the way, y cannot be Gaussian distributed since the output of the exponential function is always positive. 
    • Marked as answer by Capli19 Monday, September 1, 2014 9:55 PM
    • Unmarked as answer by Capli19 Monday, September 1, 2014 9:59 PM
    • Marked as answer by Capli19 Monday, September 1, 2014 9:59 PM
    Monday, September 1, 2014 1:10 PM
    Owner
  • Thanks a lot.

    Actually my real y is a function of exp(a.b+c.x) which is not always positive.

    I have this big function, which I don't know how to implement. But anyway there is/or Not a difference between {using separate factor nodes to implement this function} and {implementing all operations in one factor node}?

    From your answer I got there is no difference and even implementing all of them in one single node would not be beneficial in terms of accuracy. So I can implement all these using separate nodes... And message passing is implemented already on these existing factor nodes so I don't need to do anything.

    Am I right?


    • Edited by Capli19 Monday, September 1, 2014 1:47 PM
    • Marked as answer by Capli19 Monday, September 1, 2014 9:58 PM
    • Unmarked as answer by Capli19 Monday, September 1, 2014 9:58 PM
    Monday, September 1, 2014 1:43 PM
  • Right.
    • Marked as answer by Capli19 Monday, September 1, 2014 9:57 PM
    Monday, September 1, 2014 3:33 PM
    Owner
  • Thanks.

    The problem is that I have a constraint (to be positive) on my variables b and x. They have to be positive. And this model is not working when I use distributions like log-normal (I found about this on the forum post "New distributions?")* for these variables.

    That's why I thought about implementing new factors (which now I understood it is much harder!).

    Is there any way that I put a constraint on b and x to force them to have positive values?

    I also have an array (2d) which I want to force it to take values sparsely while training...

    I don't know what to do in these cases?

    Would you please give me some advices what can I do for implementing my model?

    * I can't place hyperlinks in my post.

    • Marked as answer by Capli19 Monday, September 1, 2014 9:58 PM
    • Unmarked as answer by Capli19 Monday, September 1, 2014 9:59 PM
    Monday, September 1, 2014 4:43 PM
  • Use Variable.ConstrainPositive.
    • Marked as answer by Capli19 Monday, September 1, 2014 9:55 PM
    Monday, September 1, 2014 5:06 PM
    Owner