def test_auc(self): y_true = np.array([0, 0, 1, 1]) y_predict = np.array([0.1, 0.4, 0.35, 0.8]) ground_true_auc = 0.75 eva = Evaluation("binary") auc = eva.auc(y_true, y_predict) auc = round(auc, 2) self.assertFloatEqual(auc, ground_true_auc)
def test_auc(self): y_true = np.array([0, 0, 1, 1]) y_predict = np.array([0.1, 0.4, 0.35, 0.8]) ground_true_auc = 0.75 eva = Evaluation() eva._init_model(EvaluateParam(eval_type=consts.BINARY, pos_label=1)) auc = eva.auc(y_true, y_predict) auc = round(auc, 2) self.assertFloatEqual(auc, ground_true_auc)