locked
How to generate sample data from a set of Bernoulli variables? RRS feed

  • Question

  • Suppose I have the following variables:

    Variable<bool> a = Variable.Bernoulli(0.1);

    Variable<bool> b = Variable.Bernoulli(0.3);

    Variable<bool> c = Variable.Bernoulli(0.5);

    How can I get some fake data according to the above distribution, as shown below?

    c;

    b, c;

    c;

    a, c;

    b;

    a, b;

    ...



    • Edited by Xindong Tao Thursday, February 5, 2015 8:08 AM
    Thursday, February 5, 2015 8:02 AM

Answers

  • Hi Xindong,

    Infer.NET currently doesn't provide the functionality to sample data from a generative model. What you have to do is create distributions and sample from them. That is, use
    var a = new Bernoulli(0.1);
    instead of 
    var a = Variable.Bernoulli(0.1);.

    You can then use the .Sample() method present on all our distributions and combine the samples using regular mathematical operations.

    An example of this can be seen in the Generating data from the model section of the recommender tutorial.

    -Y-

    • Marked as answer by Xindong Tao Friday, February 6, 2015 1:49 AM
    Thursday, February 5, 2015 9:20 AM

All replies

  • Hi Xindong,

    Infer.NET currently doesn't provide the functionality to sample data from a generative model. What you have to do is create distributions and sample from them. That is, use
    var a = new Bernoulli(0.1);
    instead of 
    var a = Variable.Bernoulli(0.1);.

    You can then use the .Sample() method present on all our distributions and combine the samples using regular mathematical operations.

    An example of this can be seen in the Generating data from the model section of the recommender tutorial.

    -Y-

    • Marked as answer by Xindong Tao Friday, February 6, 2015 1:49 AM
    Thursday, February 5, 2015 9:20 AM
  • Thanks Yordan, I'll try this.
    Friday, February 6, 2015 1:41 AM