Add validate_features option for Booster predict (#3323)
* Add validate_features option for Booster predict * Fix trailing whitespace in docstring
This commit is contained in:
parent
b018ef104f
commit
a510e68dda
@ -988,7 +988,8 @@ class Booster(object):
|
||||
return self.eval_set([(data, name)], iteration)
|
||||
|
||||
def predict(self, data, output_margin=False, ntree_limit=0, pred_leaf=False,
|
||||
pred_contribs=False, approx_contribs=False, pred_interactions=False):
|
||||
pred_contribs=False, approx_contribs=False, pred_interactions=False,
|
||||
validate_features=True):
|
||||
"""
|
||||
Predict with data.
|
||||
|
||||
@ -1030,6 +1031,10 @@ class Booster(object):
|
||||
pred_contribs), and the sum of the entire matrix equals the raw untransformed margin
|
||||
value of the prediction. Note the last row and column correspond to the bias term.
|
||||
|
||||
validate_features : bool
|
||||
When this is True, validate that the Booster's and data's feature_names are identical.
|
||||
Otherwise, it is assumed that the feature_names are the same.
|
||||
|
||||
Returns
|
||||
-------
|
||||
prediction : numpy array
|
||||
@ -1046,6 +1051,7 @@ class Booster(object):
|
||||
if pred_interactions:
|
||||
option_mask |= 0x10
|
||||
|
||||
if validate_features:
|
||||
self._validate_features(data)
|
||||
|
||||
length = c_bst_ulong()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user