Infer.NET 101 Chapter 7 - Model Comparison

Domanda Infer.NET 101 Chapter 7 - Model Comparison

  • lunedì 16 gennaio 2012 00:07
     
      Contiene codice

    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. 

Tutte le risposte

  • lunedì 16 gennaio 2012 14:20
     
     
    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.