How to add continous parents without factors RRS feed

  • Question

  • Hello together,

    I'm quite new in programming Infer.Net and I already read the tutorials and also Infer.Net 101. It is quite amazing, what is possible, but currently I run into a problem of implementing continous parents (Gaussians), which are not combined by a factor. I have a model with three nodes (A - Guassian, B - Gaussian, C - Gaussian) and C depends on A and B. I am looking for something similar to the Wet/Sprinkler/Rain-Sample, but with continous distributions.

    I hope you can understand what I mean and give me a short hint.

    Thank you all.

    Tuesday, March 12, 2013 9:32 AM

All replies

  • Can you please let us know how exactly C depends on A and B?
    Tuesday, March 12, 2013 10:11 AM
  • Actually I am not sure, if it is a simple sum like C = A + B.

    I have a simple use case, diabetics. A = amount of insulin, B = value of bloodsugar before threatment, C = value of bloodsugar after treatment. So I have some trainingsdata which amount of insulin in combination with a specific pre-bloodsugar (B) results in which post-bloodsugar (C).

    My inference question is for an observed pre-bloodsugar (B) and an observed post-bloodsugar (C), which amount of insulin (A) is necessary.

    Sorry, for this newbie questions, but I am a little bit confused of how to build the right model and how to implement it with Infer.Net.

    Thanks a lot.

    Tuesday, March 12, 2013 10:40 AM
  • It depends on whether you understand the relation between A, B and C or not.

    If you have the this domain knowledge, then Infer.NET is your best friend. You can build a factor graph which describes how exactly C is generated from A and B, and you can learn the parameters in this model. An example can be that C = B + A*W. That is, the post-bloodsugar is equal to the pre-bloodsugar plus some scaling of the insulin. In this scenario you observe A, B and C and learn the weight W. Another example is C = B*V + A*W, where you learn weights for both the pre-bloodsugar and the insulin. I really don't know what exactly this relation is, so I'm just guessing. But the point is that if you know, you can model it. By the way, the latter example that I gave is very similar to a BPM.

    The second options is that you don't have the domain knowledge, and the model is a blackbox for you. That is, you only observe A, B and C, but you don't have any idea how they are related. What you can do in this situation is to use a GP.

    In this post I gave links to two classifiers, while what you need is regressors. This can be easily achieved by slightly tweaking the models. In both cases what we compute is a score, and in the end we convert this score into a class. In particular, we do score > 0. You want to get rid of this '> 0' in the end, and instead of observing the class, observe the score. For instance, in the case of a GP, the line:
    y[j] = Variable.GaussianFromMeanAndVariance(score,  0.1) > 0;
    will change to:
    y[j] = Variable.GaussianFromMeanAndVariance(score,  0.1);

    Wednesday, March 13, 2013 5:25 PM