Fix approximated predict contribution. (#6811)

This commit is contained in:
Jiaming Yuan
2021-04-03 02:15:03 +08:00
committed by GitHub
parent 0cced530ea
commit 7e06c81894
6 changed files with 47 additions and 17 deletions

View File

@@ -1647,7 +1647,9 @@ class Booster(object):
prediction. Note the final column is the bias term.
approx_contribs :
Approximate the contributions of each feature
Approximate the contributions of each feature. Used when ``pred_contribs`` or
``pred_interactions`` is set to True. Changing the default of this parameter
(False) is not recommended.
pred_interactions :
When this is True the output will be a matrix of size (nsample,
@@ -1716,9 +1718,9 @@ class Booster(object):
if pred_contribs:
assign_type(2 if not approx_contribs else 3)
if pred_interactions:
assign_type(4)
assign_type(4 if not approx_contribs else 5)
if pred_leaf:
assign_type(5)
assign_type(6)
preds = ctypes.POINTER(ctypes.c_float)()
shape = ctypes.POINTER(c_bst_ulong)()
dims = c_bst_ulong()