예제 #1
0
    def test_median_absolute_error(self):
        eva = Evaluation()
        y_true = [3, -0.5, 2, 7]
        y_pred = [2.5, 0.0, 2, 8]
        self.assertFloatEqual(eva.median_absolute_error(y_true, y_pred), 0.5)

        y_true = [3, -0.6, 2, 7]
        y_pred = [2.5, 0.0, 2, 8]
        self.assertFloatEqual(eva.median_absolute_error(y_true, y_pred), 0.55)
예제 #2
0
    def test_median_absolute_error(self):
        eva = Evaluation()
        eva._init_model(EvaluateParam(eval_type=consts.REGRESSION,
                                      pos_label=1))
        y_true = [3, -0.5, 2, 7]
        y_pred = [2.5, 0.0, 2, 8]
        self.assertFloatEqual(eva.median_absolute_error(y_true, y_pred), 0.5)

        y_true = [3, -0.6, 2, 7]
        y_pred = [2.5, 0.0, 2, 8]
        self.assertFloatEqual(eva.median_absolute_error(y_true, y_pred), 0.55)