public void testMCMCask2() { BayesNet net = createWetGrassNetwork(); MockRandomizer r = new MockRandomizer( new double[] { 0.5, 0.5, 0.5, 0.5 }); Dictionary <String, bool> evidence = new Dictionary <String, bool>(); evidence.Add("Sprinkler", true); double[] results = net.mcmcAsk("Rain", evidence, 1, r); Assert.AreEqual(0.333, results[0], 0.001); Assert.AreEqual(0.666, results[1], 0.001); }
public void testEnumerationAskinMCMC() { BayesNet net = createWetGrassNetwork(); MockRandomizer r = new MockRandomizer( new double[] { 0.5, 0.5, 0.5, 0.5 }); Dictionary <String, bool> evidence = new Dictionary <String, bool>(); evidence.Add("Rain", true); evidence.Add("Sprinkler", true); Query q = new Query("Cloudy", new String[] { "Sprinkler", "Rain" }, new bool[] { true, true }); double[] results = EnumerationAsk.ask(q, net); double[] results2 = net.mcmcAsk("Cloudy", evidence, 1000); }