Skip to content

Commit

Permalink
fix bug in reset config for dataset (#2453)
Browse files Browse the repository at this point in the history
* Update feature_histogram.hpp

* Update feature_histogram.hpp
  • Loading branch information
guolinke committed Sep 26, 2019
1 parent 70fc45b commit 7a8c4e5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/treelearner/feature_histogram.hpp
Expand Up @@ -748,13 +748,16 @@ class HistogramPool {
OMP_LOOP_EX_END();
}
OMP_THROW_EX();
train_data_ = train_data;
}

void ResetConfig(const Config* config) {
int size = static_cast<int>(feature_metas_.size());
#pragma omp parallel for schedule(static, 512) if (size >= 1024)
for (int i = 0; i < size; ++i) {
feature_metas_[i].config = config;
feature_metas_[i].monotone_type = train_data_->FeatureMonotone(i);
feature_metas_[i].penalty = train_data_->FeaturePenalte(i);
}
}
/*!
Expand Down Expand Up @@ -823,6 +826,7 @@ class HistogramPool {
std::vector<int> inverse_mapper_;
std::vector<int> last_used_time_;
int cur_time_ = 0;
const Dataset* train_data_;
};

} // namespace LightGBM
Expand Down

0 comments on commit 7a8c4e5

Please sign in to comment.