Commit 595c10ab authored by Guolin Ke's avatar Guolin Ke
Browse files

some naming fix

parent 27624755
...@@ -898,9 +898,10 @@ class Booster(object): ...@@ -898,9 +898,10 @@ class Booster(object):
if 'metric' in params: if 'metric' in params:
self.__need_reload_eval_info = True self.__need_reload_eval_info = True
params_str = param_dict_to_str(params) params_str = param_dict_to_str(params)
_safe_call(_LIB.LGBM_BoosterResetParameter( if params_str:
self.handle, _safe_call(_LIB.LGBM_BoosterResetParameter(
c_str(params_str))) self.handle,
c_str(params_str)))
def update(self, train_set=None, fobj=None): def update(self, train_set=None, fobj=None):
""" """
......
...@@ -166,7 +166,7 @@ def train(params, train_data, num_boost_round=100, ...@@ -166,7 +166,7 @@ def train(params, train_data, num_boost_round=100,
"""start training""" """start training"""
for i in range(num_boost_round): for i in range(num_boost_round):
for cb in callbacks_before_iter: for cb in callbacks_before_iter:
cb(CallbackEnv(model=booster, cb(callback.CallbackEnv(model=booster,
cvfolds=None, cvfolds=None,
iteration=i, iteration=i,
begin_iteration=0, begin_iteration=0,
...@@ -183,16 +183,16 @@ def train(params, train_data, num_boost_round=100, ...@@ -183,16 +183,16 @@ def train(params, train_data, num_boost_round=100,
evaluation_result_list.extend(booster.eval_valid(feval)) evaluation_result_list.extend(booster.eval_valid(feval))
try: try:
for cb in callbacks_after_iter: for cb in callbacks_after_iter:
cb(CallbackEnv(model=booster, cb(callback.CallbackEnv(model=booster,
cvfolds=None, cvfolds=None,
iteration=i, iteration=i,
begin_iteration=0, begin_iteration=0,
end_iteration=num_boost_round, end_iteration=num_boost_round,
evaluation_result_list=evaluation_result_list)) evaluation_result_list=evaluation_result_list))
except EarlyStopException: except callback.EarlyStopException:
break break
if booster.attr('best_iteration') is not None: if booster.attr('best_iteration') is not None:
booster.best_iteration = int(booster.attr('best_iteration')) booster.best_iteration = int(booster.attr('best_iteration'))
else: else:
booster.best_iteration = num_boost_round - 1 booster.best_iteration = num_boost_round - 1
return num_boost_round return num_boost_round
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment