Ask for help with a toy inference problem (Migrated from community.research.microsoft.com) RRS feed

  • Question

  • shengbo posted on 02-18-2010 5:41 AM

    Hi folks, 

    I have a probabilistic model of two variables. One is a hidden Gaussian variable x; the other is an observed poisson variable r with r~Poisson(x). Now suppose I observe that r = 3, I expect to estimate the posterior distribution of x. However, I have difficulty in compiling the code as below. I'd be appreciated if someone could help me with this. Thanks!



    using System;

    using System.Collections.Generic;

    using System.Linq;

    using System.Text;

    using MicrosoftResearch.Infer.Models;

    using MicrosoftResearch.Infer;

    namespace PoissonGaussian


    public class Program


    static void Main(string[] args)


    // The probabilistic program

    Variable<double> x = Variable.GaussianFromMeanAndVariance(10, 3*3).Named("x");

             Variable<int> r = Variable.Poisson(x).Named("r");

             // The inference

    InferenceEngine engine = new InferenceEngine();

             r.ObservedValue = 3;            



             Console.WriteLine("Press any key...");







    Friday, June 3, 2011 5:34 PM


  • John Guiver replied on 02-18-2010 5:57 AM

    Hi Shengbo

    You will need to use a Gamma for x as you need a random variable whose domain is the positive reals. Then your example should work.

    Note that support for Poisson is limited right now. Your example will work, but there is not yet support for a Poisson factor with unobserved output.


    Friday, June 3, 2011 5:34 PM