keep builtin evaluations while using customized evaluation function (#1624)
* keep builtin evaluations while using customized evaluation function * fix concat bytes to str
This commit is contained in:
parent
8b9d9669bb
commit
55bfc29942
@ -864,7 +864,6 @@ class Booster(object):
|
|||||||
result: str
|
result: str
|
||||||
Evaluation result string.
|
Evaluation result string.
|
||||||
"""
|
"""
|
||||||
if feval is None:
|
|
||||||
for d in evals:
|
for d in evals:
|
||||||
if not isinstance(d[0], DMatrix):
|
if not isinstance(d[0], DMatrix):
|
||||||
raise TypeError('expected DMatrix, got {}'.format(type(d[0]).__name__))
|
raise TypeError('expected DMatrix, got {}'.format(type(d[0]).__name__))
|
||||||
@ -878,9 +877,8 @@ class Booster(object):
|
|||||||
_check_call(_LIB.XGBoosterEvalOneIter(self.handle, iteration,
|
_check_call(_LIB.XGBoosterEvalOneIter(self.handle, iteration,
|
||||||
dmats, evnames, len(evals),
|
dmats, evnames, len(evals),
|
||||||
ctypes.byref(msg)))
|
ctypes.byref(msg)))
|
||||||
return msg.value
|
res = msg.value.decode()
|
||||||
else:
|
if feval is not None:
|
||||||
res = '[%d]' % iteration
|
|
||||||
for dmat, evname in evals:
|
for dmat, evname in evals:
|
||||||
feval_ret = feval(self.predict(dmat), dmat)
|
feval_ret = feval(self.predict(dmat), dmat)
|
||||||
if isinstance(feval_ret, list):
|
if isinstance(feval_ret, list):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user