Пример #1
0
 def testStructuralHamming(self):
     true_bn = gum.fastBN("A->B->C;B->D")
     bn = gum.fastBN("A->B;C->B;D->C")
     shd = bvb.GraphicalBNComparator(true_bn,
                                     bn).hamming()['structural hamming']
     self.assertEqual(4, shd)
Пример #2
0
 def testHamming(self):
     true_bn = gum.fastBN("A->B->C;B->D")
     bn = gum.fastBN("A->B;C->B;D->C")
     hamming = bvb.GraphicalBNComparator(true_bn, bn).hamming()['hamming']
     self.assertEqual(2, hamming)
Пример #3
0
 def testRecall(self):
     true_bn = gum.fastBN("A->B->C")
     bn = gum.fastBN("A->B;C->B;A->C")
     recall = bvb.GraphicalBNComparator(true_bn, bn).scores()['recall']
     self.assertEqual(1. / 2., recall)
Пример #4
0
 def testFscore(self):
     true_bn = gum.fastBN("A->B->C")
     bn = gum.fastBN("A->B;C->B;A->C")
     fscore = bvb.GraphicalBNComparator(true_bn, bn).scores()['fscore']
     self.assertEqual(2. / 5., fscore)
Пример #5
0
 def testPrecision(self):
     true_bn = gum.fastBN("A->B->C")
     bn = gum.fastBN("A->B;C->B;A->C")
     precision = bvb.GraphicalBNComparator(true_bn,
                                           bn).scores()['precision']
     self.assertEqual(1. / 3., precision)