"vscode:/vscode.git/clone" did not exist on "07eb351a8a680412ef0d798f25b4dab4ab1e9071"
Unverified Commit 1a48fd26 authored by Guolin Ke's avatar Guolin Ke Committed by GitHub
Browse files

fix ResetConfig in FeatureHistogram (#2882)

parent 018bdd3f
......@@ -59,6 +59,10 @@ class FeatureHistogram {
void Init(hist_t* data, const FeatureMetainfo* meta) {
meta_ = meta;
data_ = data;
ResetFunc();
}
void ResetFunc() {
if (meta_->bin_type == BinType::NumericalBin) {
FuncForNumrical();
} else {
......@@ -1131,7 +1135,21 @@ class HistogramPool {
}
void ResetConfig(const Dataset* train_data, const Config* config) {
CHECK_GT(train_data->num_features(), 0);
const Config* old_config = feature_metas_[0].config;
SetFeatureInfo<false, true>(train_data, config, &feature_metas_);
// if need to reset the function pointers
if (old_config->lambda_l1 != config->lambda_l1 ||
old_config->monotone_constraints != config->monotone_constraints ||
old_config->extra_trees != config->extra_trees ||
old_config->max_delta_step != config->max_delta_step) {
#pragma omp parallel for schedule(static)
for (int i = 0; i < cache_size_; ++i) {
for (int j = 0; j < train_data->num_features(); ++j) {
pool_[i][j].ResetFunc();
}
}
}
}
/*!
......
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