locked
A variable specified by constraints? RRS feed

  • General discussion

  • I have a (possibly stupid) question about the Infer.NET syntax. Suppose I want to state the constraint that all n variables are in an interval of size 2*epsilon. However, I don't want a quadratic number of boolean variables lying around. The natural thing to do would be to create another variable (center of the interval) with

    Variable<double> x = Variable.New<double>();
    

    and then specify x by adding either constraints like

    Variable.IsBetween(a[i], x - eps, x + eps)

    or Boolean variables with the same effect. However, this gives an error "variable x has no definition". What would you advise me to do in this case? Thank you!

    Thursday, November 10, 2011 6:29 AM

All replies

  • It sounds like you haven't specified what value x should take. I'm guessing you want the value of x to be fixed, in which case you should do something like

    x.ObservedValue = .5; 

    (or whatever value) before running inference. If however you want to infer the value of x then you need to give it a prior. 

    Hope that helps!

    David. 

    Thursday, November 10, 2011 3:53 PM
  • David, thank you for your reply! No, I definitely don't want x to be fixed. Moreover, I don't really want to give it a prior. I want to express the event that "random real variables a_1, ... , a_n are within 2*eps from each other" without placing additional constraints on the values of a_i.

    I'll try to give it a prior with a very large variance, though, thanks!

    Thursday, November 10, 2011 5:10 PM
  • I found out that Infer.NET supports infinite variance values for the priors; this is probably what I need for this kind of thing.
    Tuesday, November 22, 2011 9:54 AM