def test_selectivity_empty(self): """selectivity: should handle empty reference/predicted structure""" # both empty self.assertFloatEqual(selectivity(Pairs(), Pairs()), 1) pred = Pairs([(6, 1), (10, 11), (3, 12), (13, 20), (14, 19), (15, 18)]) # prediction emtpy self.assertFloatEqual(selectivity(Pairs(), pred), 0) # reference empty self.assertFloatEqual(selectivity(pred, Pairs()), 0)
def test_selectivity_general(self): """selectivity: should work in general""" ref = Pairs([(1, 6), (2, 5), (10, 13)]) pred = Pairs([(6, 1), (3, 4), (10, 12)]) # one good prediction self.assertFloatEqual(selectivity(ref, pred), 0.5) # over-prediction not penalized pred = Pairs([(6, 1), (10, 11), (3, 12), (13, 20), (14, 19), (15, 18)]) self.assertFloatEqual(selectivity(ref, pred), 0.25)
def test_selectivity_empty(self): """selectivity: should handle empty reference/predicted structure""" # both empty self.assertFloatEqual(selectivity(Pairs(), Pairs()), 1) pred = Pairs([(6,1),(10,11),(3,12),(13,20),(14,19),(15,18)]) # prediction emtpy self.assertFloatEqual(selectivity(Pairs(), pred), 0) # reference empty self.assertFloatEqual(selectivity(pred, Pairs()), 0)
def test_selectivity_general(self): """selectivity: should work in general""" ref = Pairs([(1,6),(2,5),(10,13)]) pred = Pairs([(6,1),(3,4),(10,12)]) # one good prediction self.assertFloatEqual(selectivity(ref, pred), 0.5) # over-prediction not penalized pred = Pairs([(6,1),(10,11),(3,12),(13,20),(14,19),(15,18)]) self.assertFloatEqual(selectivity(ref, pred), 0.25)
def test_selectivity_dupl(self): """selectivity: duplicates and Nones shouldn't influence the calc. """ ref = Pairs([(1, 6), (2, 5), (10, 13), (6, 1), (7, None), (None, None)]) pred = Pairs([(6, 1), (3, 4), (10, 12)]) self.assertFloatEqual(selectivity(ref, pred), 0.5)
def test_selectivity(self): """selectivity: check against compare_ct.pm""" sel = selectivity(self.true, self.predicted) self.assertEqual(sel, 0.5)
def test_selectivity_dupl(self): """selectivity: duplicates and Nones shouldn't influence the calc. """ ref = Pairs([(1,6),(2,5),(10,13),(6,1),(7,None),(None,None)]) pred = Pairs([(6,1),(3,4),(10,12)]) self.assertFloatEqual(selectivity(ref, pred), 0.5)
def test_selectivity(self): """selectivity: check against compare_ct.pm""" sel = selectivity(self.true,self.predicted) self.assertEqual(sel, 0.5)