locked
Infer.NET syntax (Migrated from community.research.microsoft.com) RRS feed

  • Question

  • Vincent Tan posted on 07-20-2009 2:27 PM

    Hi,

    I hope that you can help me try to understand what's the difference (if any) between the following two lines of Infer.NET code.

    1) Variable.ConstrainPositive(s);

    2) Variable<bool> b = Variable<bool>.IsPositive(s);b.ObservedValue = true;;

    Vincent

    Friday, June 3, 2011 4:59 PM

Answers

  • John Guiver replied on 07-24-2009 5:05 AM

    Hi Vincent

    These should give you the same answer. However, (2) will be preferable in cases where you want to specify this constraint at run-time without the model getting recompiled - you can set the constraint to positive or negative just by setting the observed value of b. I have used this to good effect when implementing ordinal regression models.

    John 

    Friday, June 3, 2011 4:59 PM