[Breaking] Fix custom metric for multi output. (#5954)

* Set output margin to true for custom metric.  This fixes only R and Python.
This commit is contained in:
Jiaming Yuan
2020-07-29 19:25:27 +08:00
committed by GitHub
parent 75b8c22b0b
commit 18349a7ccf
7 changed files with 41 additions and 13 deletions

View File

@@ -37,11 +37,11 @@ class TestEarlyStopping(unittest.TestCase):
eval_set=[(X_test, y_test)])
assert clf3.best_score == 1
@pytest.mark.skipif(**tm.no_sklearn())
def evalerror(self, preds, dtrain):
from sklearn.metrics import mean_squared_error
labels = dtrain.get_label()
preds = 1.0 / (1.0 + np.exp(-preds))
return 'rmse', mean_squared_error(labels, preds)
@staticmethod