Merge pull request #696 from Far0n/tc_fix

fixed wrong iter when using training continuation
This commit is contained in:
Yuan (Terry) Tang 2015-12-19 11:45:15 -05:00
commit b942005931

View File

@ -117,7 +117,7 @@ def train(params, dtrain, num_boost_round=10, evals=(), obj=None, feval=None,
evals_result.update(dict([(key, {}) for key in evals_name]))
if not early_stopping_rounds:
for i in range(num_boost_round):
for i in range(nboost, nboost + num_boost_round):
bst.update(dtrain, i, obj)
nboost += 1
if len(evals) != 0:
@ -189,7 +189,7 @@ def train(params, dtrain, num_boost_round=10, evals=(), obj=None, feval=None,
if isinstance(learning_rates, list) and len(learning_rates) != num_boost_round:
raise ValueError("Length of list 'learning_rates' has to equal 'num_boost_round'.")
for i in range(num_boost_round):
for i in range(nboost, nboost + num_boost_round):
if learning_rates is not None:
if isinstance(learning_rates, list):
bst.set_param({'eta': learning_rates[i]})