none
Infer.NET 101 Chapter 7 - Model Comparison

    Question

  • So I have followed pretty much chapters 1 - 6 but I don't understand how a simple

    Evidence = Variable.Bernoulli(0.5);
    using (Variable.If(Evidence))
    {
    	base.CreateModel();
    }
    
    

    Is all that you need in the model to calculate evidence.  How does that C# capture my intension to calculate the evidence in such a simple statement.  Thanks. 

    Monday, January 16, 2012 12:07 AM

All replies

  • It works because the call to Variable.If sets a global flag so that when base.CreateModel executes, it knows that the model is inside of a Variable.If(Evidence) block.
    Monday, January 16, 2012 2:20 PM