[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

@@ -79,6 +79,10 @@ test_that("custom objective with multi-class works", {
hess <- rnorm(dim(as.matrix(preds))[1])
return (list(grad = grad, hess = hess))
}
fake_merror <- function(preds, dtrain) {
expect_equal(dim(data)[1] * nclasses, dim(as.matrix(preds))[1])
}
param$objective <- fake_softprob
param$eval_metric <- fake_merror
bst <- xgb.train(param, dtrain, 1, num_class = nclasses)
})