def test_sensitivity_dupl(self): """sensitivity: should handle duplicates, pseudo, None""" ref = Pairs([(1,6),(2,5),(3,10),(7,None),(None,None),(5,2),(4,9)]) pred = Pairs([(6,1),(10,11),(3,12)]) self.assertFloatEqual(sensitivity(ref, pred), 0.25) pred = Pairs([(6,1),(10,11),(3,12),(20,None),(None,None),(1,6)]) self.assertFloatEqual(sensitivity(ref, pred), 0.25)
def test_sensitivity_empty(self): """sensitivity: should work on emtpy Pairs""" # both empty self.assertFloatEqual(sensitivity(Pairs(), Pairs()), 1) pred = Pairs([(6, 1), (10, 11), (3, 12), (13, 20), (14, 19), (15, 18)]) # prediction emtpy self.assertFloatEqual(sensitivity(Pairs(), pred), 0) # reference empty self.assertFloatEqual(sensitivity(pred, Pairs()), 0)
def test_sensitivity_general(self): """sensitivity: should work in general""" ref = Pairs([(1, 6), (2, 5), (3, 10)]) pred = Pairs([(6, 1), (10, 11), (3, 12)]) # one good prediction self.assertFloatEqual(sensitivity(ref, pred), 1 / 3) # over-prediction not penalized pred = Pairs([(6, 1), (10, 11), (3, 12), (13, 20), (14, 19), (15, 18)]) self.assertFloatEqual(sensitivity(ref, pred), 1 / 3)
def test_sensitivity_empty(self): """sensitivity: should work on emtpy Pairs""" # both empty self.assertFloatEqual(sensitivity(Pairs(), Pairs()), 1) pred = Pairs([(6,1),(10,11),(3,12),(13,20),(14,19),(15,18)]) # prediction emtpy self.assertFloatEqual(sensitivity(Pairs(), pred), 0) # reference empty self.assertFloatEqual(sensitivity(pred, Pairs()), 0)
def test_sensitivity_general(self): """sensitivity: should work in general""" ref = Pairs([(1,6),(2,5),(3,10)]) pred = Pairs([(6,1),(10,11),(3,12)]) # one good prediction self.assertFloatEqual(sensitivity(ref, pred), 1/3) # over-prediction not penalized pred = Pairs([(6,1),(10,11),(3,12),(13,20),(14,19),(15,18)]) self.assertFloatEqual(sensitivity(ref, pred), 1/3)
def test_sensitivity(self): """sensitivity: check against compare_ct.pm""" sen = sensitivity(self.true, self.predicted) self.assertEqual(sen, 0.4)
def test_sensitivity(self): """sensitivity: check against compare_ct.pm""" sen = sensitivity(self.true,self.predicted) self.assertEqual(sen, 0.4)