Exemple #1
0
    def test_opposite(self):
        b = Bayes([0.2, 0.8])
        opposite = b.opposite()
        self.assertEqual(opposite[0] / opposite[1], b[1] / b[0])

        b = Bayes([0.2, 0.4, 0.4])
        opposite = b.opposite()
        self.assertEqual(opposite[0] / opposite[1], b[1] / b[0])
        self.assertEqual(opposite[1] / opposite[2], b[2] / b[1])
        self.assertEqual(opposite[0] / opposite[2], b[2] / b[0])
Exemple #2
0
    def test_opposite(self):
        b = Bayes([0.2, 0.8])
        opposite = b.opposite()
        self.assertEqual(opposite[0] / opposite[1], b[1] / b[0])

        b = Bayes([0.2, 0.4, 0.4])
        opposite = b.opposite()
        self.assertEqual(opposite[0] / opposite[1], b[1] / b[0])
        self.assertEqual(opposite[1] / opposite[2], b[2] / b[1])
        self.assertEqual(opposite[0] / opposite[2], b[2] / b[0])
Exemple #3
0
 def test_conversions(self):
     b = Bayes({'a': 9, 'b': 1, 'c': 0})
     self.assertEqual(b, b.normalized())
     self.assertEqual(b.normalized()['a'], 0.9)
     self.assertEqual(b.opposite().opposite(), b)
Exemple #4
0
 def test_conversions(self):
     b = Bayes({'a': 9, 'b': 1, 'c': 0})
     self.assertEqual(b, b.normalized())
     self.assertEqual(b.normalized()['a'], 0.9)
     self.assertEqual(b.opposite().opposite(), b)