Commit 399710ac authored by Guolin Ke's avatar Guolin Ke Committed by GitHub
Browse files

Update gbdt.cpp

parent f5aa1c9b
...@@ -48,6 +48,7 @@ GBDT::GBDT() ...@@ -48,6 +48,7 @@ GBDT::GBDT()
num_threads_ = omp_get_num_threads(); num_threads_ = omp_get_num_threads();
} }
average_output_ = false; average_output_ = false;
tree_learner_ = nullptr;
} }
GBDT::~GBDT() { GBDT::~GBDT() {
...@@ -217,13 +218,12 @@ void GBDT::ResetTrainingData(const Dataset* train_data, const ObjectiveFunction* ...@@ -217,13 +218,12 @@ void GBDT::ResetTrainingData(const Dataset* train_data, const ObjectiveFunction*
void GBDT::ResetConfig(const BoostingConfig* config) { void GBDT::ResetConfig(const BoostingConfig* config) {
auto new_config = std::unique_ptr<BoostingConfig>(new BoostingConfig(*config)); auto new_config = std::unique_ptr<BoostingConfig>(new BoostingConfig(*config));
early_stopping_round_ = new_config->early_stopping_round; early_stopping_round_ = new_config->early_stopping_round;
shrinkage_rate_ = new_config->learning_rate; shrinkage_rate_ = new_config->learning_rate;
if (tree_learner_ != nullptr) {
ResetBaggingConfig(new_config.get()); ResetBaggingConfig(new_config.get());
tree_learner_->ResetConfig(&new_config->tree_config); tree_learner_->ResetConfig(&new_config->tree_config);
}
gbdt_config_.reset(new_config.release()); gbdt_config_.reset(new_config.release());
} }
......
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