Skip to content

Commit

Permalink
handls inconsistency in lgb api- forces best_iteration to be -1 inste…
Browse files Browse the repository at this point in the history
…ad of None, even if they give us None
  • Loading branch information
ClimbsRocks committed Feb 13, 2018
1 parent 1aedcdb commit 54da719
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions auto_ml/utils_model_training.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,10 @@ def predict(self, X, verbose=False):
best_iteration = self.model.best_iteration_
except AttributeError:
best_iteration = self.model.best_iteration
# At version 2.1.0, lgbm returns best_iteration = None, but doesn't take None as an input for num_iteration. this issue only exists in python3(.6)
if best_iteration is None:
best_iteration = -1

predictions = self.model.predict(X, num_iteration=best_iteration)
else:
predictions = self.model.predict(X_predict)
Expand Down

0 comments on commit 54da719

Please sign in to comment.