Infer.NET
August 6, 2013 Leave a comment
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:
- Console.WriteLine("Start");
- Variable<bool> firstCoin = Variable.Bernoulli(0.5);
- Variable<bool> secondCoin = Variable.Bernoulli(0.5);
- Variable<bool> bothHeads = firstCoin & secondCoin;
- InferenceEngine engine = new InferenceEngine();
- Console.WriteLine("Probability both coins are heads: " + engine.Infer(bothHeads));
- Console.WriteLine("End");
- 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…