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)
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)
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)
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)
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)