Error when Infering a variable with two parents RRS feed

  • Question

  • Hello

    I'm adapting the wet grass/rain/sprinkler example to my model. However, I'm having a problem when making the inference of a variable with two parents.

    In the original example, they predict the variable Rain (with one parent) in the following way:

    var rainPosterior = Engine.Infer<DistributionRefArray<Discrete,int>>(Rain);

    I would like to know how can I adapt it to infer the variable Wetgrass (with two parents). I tried the following:

    var rainPosterior = Engine.Infer<DistributionRefArray<DistributionRefArray<Discrete,int>,int[]>>(WetGrass); but it's giving me the following error: IndexOutOfRangeException: Array index is out of range.

    I'm sorry if it's a very basic question, but I just started using this framework for a research project, and it's kind of urgent now. So, I'd really appreciate your help.



    Sunday, June 2, 2013 10:22 PM

All replies

  • You are not providing the right type to infer.  It should be: 
    But either way, you should not get an IndexOutOfRangeException.  Did you change something else in the example?
    Monday, June 3, 2013 3:02 PM
  • I used Engine.Infer<DistributionRefArray<Discrete,int>>(WetGrass) because I'm using Infer.NET 2.3. Actually it's the same issue than this topic: http://social.microsoft.com/Forums/es-ES/infer.net/thread/caae672b-84b4-4974-97b6-a0849545da9f . I explained there the modifications I made. I'm sorry to duplicate the question, but afterwards I thought it would be better to continue the question in the previous thread.

    Monday, June 3, 2013 3:21 PM