I was on vacation last week so I decided to have some fun with Infer.Net.  As someone interested in F#/Machine learning, Infer.Net seemed like a cool side project.  I was not disappointed.  I downloaded the most recent bits (though no NuGet) and wired up a basic problem of determining the probability of 2 even-sided coins to both come up heads:

  1. Console.WriteLine("Start");
  3. Variable<bool> firstCoin = Variable.Bernoulli(0.5);
  4. Variable<bool> secondCoin = Variable.Bernoulli(0.5);
  5. Variable<bool> bothHeads = firstCoin & secondCoin;
  7. InferenceEngine engine = new InferenceEngine();
  8. Console.WriteLine("Probability both coins are heads: " + engine.Infer(bothHeads));
  10. Console.WriteLine("End");
  11. Console.ReadKey();


Sure enough:


I can’t wait to dig into the other tutorials and then apply the inference to some of the real data sets I have collected…

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: