"vscode:/vscode.git/clone" did not exist on "1f88721a7982a804731b1dc108ee40625405639c"
Commit e2835654 authored by Guolin Ke's avatar Guolin Ke
Browse files

refine output message of loading model.

parent 1a35083a
......@@ -1651,7 +1651,7 @@ class Booster(object):
c_str(filename)))
_save_pandas_categorical(filename, self.pandas_categorical)
def _load_model_from_string(self, model_str):
def _load_model_from_string(self, model_str, verbose=True):
"""[Private] Load model from string"""
if self.handle is not None:
_safe_call(_LIB.LGBM_BoosterFree(self.handle))
......@@ -1666,6 +1666,8 @@ class Booster(object):
_safe_call(_LIB.LGBM_BoosterGetNumClasses(
self.handle,
ctypes.byref(out_num_class)))
if verbose:
print('Finished loading model, total used %d iterations' % (int(out_num_iterations.value)))
self.__num_class = out_num_class.value
def _save_model_to_string(self, num_iteration=-1):
......
......@@ -222,7 +222,7 @@ def train(params, train_set, num_boost_round=100,
for dataset_name, eval_name, score, _ in evaluation_result_list:
booster.best_score[dataset_name][eval_name] = score
if not keep_training_booster:
booster._load_model_from_string(booster._save_model_to_string())
booster._load_model_from_string(booster._save_model_to_string(), False)
booster.free_dataset()
return booster
......
......@@ -254,7 +254,7 @@ void Application::Predict() {
void Application::InitPredict() {
boosting_.reset(
Boosting::CreateBoosting("gbdt", config_.io_config.input_model.c_str()));
Log::Info("Finished initializing prediction");
Log::Info("Finished initializing prediction, total used %d iterations", boosting_->GetCurrentIteration());
}
void Application::ConvertModel() {
......
......@@ -458,8 +458,6 @@ bool GBDT::LoadModelFromString(const char* buffer, size_t len) {
}
OMP_THROW_EX();
}
Log::Info("Finished loading %d models", models_.size());
num_iteration_for_pred_ = static_cast<int>(models_.size()) / num_tree_per_iteration_;
num_init_iteration_ = num_iteration_for_pred_;
iter_ = 0;
......
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