[Breaking] Set output margin to True for custom objective. (#5564)

* Set output margin to True for custom objective in Python and R.

* Add a demo for writing multi-class custom objective function.

* Run tests on selected demos.
This commit is contained in:
Jiaming Yuan
2020-04-20 20:44:12 +08:00
committed by GitHub
parent fcbedcedf8
commit 9c1103e06c
10 changed files with 262 additions and 22 deletions

View File

@@ -1367,7 +1367,7 @@ class Booster(object):
ctypes.c_int(iteration),
dtrain.handle))
else:
pred = self.predict(dtrain, training=True)
pred = self.predict(dtrain, output_margin=True, training=True)
grad, hess = fobj(pred, dtrain)
self.boost(dtrain, grad, hess)