locked
problem with inference using VMP for the constrain -- Variable.ConstrainPositive( doubleVarFromGaussian1 - doubleVarFromGaussian2 ) (Migrated from community.research.microsoft.com) RRS feed

  • Question

  • shengbo posted on 03-25-2011 10:51 AM

    Hi Team, 

    When I use VMP to conduct inference for the constraint: Variable.ConstrainPositive( doubleVarFromGaussian1 - doubleVarFromGaussian2 ), I got the following error: 

    MicrosoftResearch.Infer.Distributions.Gaussian is not of type MicrosoftResearch.Infer.Distributions.TruncatedGaussian for the result of method PositiveOp.XAverageLogarithm. 

    Please note that "doubleVarFromGaussian1" and "doubleVarFromGaussian2" are two variables drawn from Gaussian distributions. 

    This problem can be avoided if I use EP, but is there any way to fix this when inferring with VMP? 

    Thanks and regards,

    Shengbo

    Friday, June 3, 2011 6:40 PM

Answers

  • shengbo replied on 03-27-2011 5:01 PM

    Thanks a lot for your help! It fixed the problem. 

    Cheers,

    Shengbp

    Friday, June 3, 2011 6:40 PM

All replies

  • minka replied on 03-26-2011 5:31 AM

    VMP supports the logistic function, which can be used to imitate a positivity constraint: (set scale to some large number)

    Variable.ConstrainTrue(Variable.Bernoulli(Variable.Logistic(scale*(doubleVarFromGaussian1 - doubleVarFromGaussian2))));

    Friday, June 3, 2011 6:40 PM
  • minka replied on 03-26-2011 5:34 AM

    Also, as indicated by the error message, you could use TruncatedGaussian variables instead of Gaussian (set the truncation limits to -infinity and +infinity to mimic a Gaussian prior).

    Friday, June 3, 2011 6:40 PM
  • shengbo replied on 03-27-2011 5:01 PM

    Thanks a lot for your help! It fixed the problem. 

    Cheers,

    Shengbp

    Friday, June 3, 2011 6:40 PM