def test_OneTP(self): """ case where auc is one """ npTruthValues = np.array([1, 1, 1, 1, 1, 0]) npResults = np.array([0.1, 0.9, 0.2, 0.2, 0.2, 0.2]) [auc, fpr, tpr, thresholds] = Error.GenAUC(npResults, npTruthValues) self.assertTrue(auc, 0.5)
def test_AllCorrect(self): """ case where auc is one """ npTruthValues = np.array([0, 0, 0, 1, 1, 1]) npResults = np.array([0.1, 0.1, 0.2, 0.9, 0.8, 0.7]) [auc, fpr, tpr, thresholds] = Error.GenAUC(npResults, npTruthValues) self.assertTrue(auc, 1)
def test_AllFN(self): """ case where auc is one """ npTruthValues = np.array([1, 1, 1]) npResults = np.array([0.1, 0.1, 0.2]) [auc, fpr, tpr, thresholds] = Error.GenAUC(npResults, npTruthValues) self.assertTrue(np.isnan(auc))
def test_AllTN(self): """ case where everthing zero might make things weird """ npTruthValues = np.array([0, 0, 0]) npResults = np.array([0.2, 0.3, 0.4]) [auc, fpr, tpr, thresholds] = Error.GenAUC(npResults, npTruthValues) self.assertTrue(np.isnan(auc))