def test5(self): bn = self.makeBurglaryNet() a = ask('Earthquake', False, {'Burglar': True}, bn) print('P(-e)=', a) self.assertAlmostEqual(0.998, a)
def test4(self): bn = self.makeBurglaryNet() a = ask('Alarm', True, {'Burglar': False}, bn) print('P(a|-b)=', a) self.assertAlmostEqual(0.001578, a)
def test2(self): bn = self.makeBurglaryNet() a = ask('Burglar', True, {'JohnCalls': True, 'MaryCalls': True}, bn) print('P(b|j,m)=', a) self.assertAlmostEqual(0.2841718, a)
def test3(self): bn = self.makeBurglaryNet() a = ask('Alarm', True, {}, bn) print('P(a)=', a) self.assertAlmostEqual(0.002516442, a)
def test1(self): bn = self.makeBurglaryNet() a = ask('Alarm', True, {'Burglar': True, 'Earthquake': True}, bn) print('P(a|b,e)=', a) self.assertAlmostEqual(0.95, a)