Commit 943edca7 authored by Tsukasa OMOTO's avatar Tsukasa OMOTO Committed by Guolin Ke
Browse files

output warning when only set max_depth (#838)

* output warning when only set `max_depth`

* Remove check of max_depth

max_depth can take both positive and negative value
parent aa99c40a
......@@ -20,6 +20,7 @@ const std::string kDefaultTreeLearnerType = "serial";
const std::string kDefaultDevice = "cpu";
const std::string kDefaultBoostingType = "gbdt";
const std::string kDefaultObjectiveType = "regression";
const int kDefaultNumLeaves = 31;
/*!
* \brief The interface for Config
......@@ -202,7 +203,7 @@ public:
double lambda_l2 = 0.0f;
double min_gain_to_split = 0.0f;
// should > 1
int num_leaves = 31;
int num_leaves = kDefaultNumLeaves;
int feature_fraction_seed = 2;
double feature_fraction = 1.0f;
// max cache size(unit:MB) for historical histogram. < 0 means no limit
......
......@@ -237,6 +237,14 @@ void OverallConfig::CheckParamConflict() {
boosting_config.tree_config.histogram_pool_size = -1;
}
}
// Check max_depth and num_leaves
if (boosting_config.tree_config.max_depth > 0) {
int full_num_leaves = std::pow(2, boosting_config.tree_config.max_depth);
if (full_num_leaves > boosting_config.tree_config.num_leaves
&& boosting_config.tree_config.num_leaves == kDefaultNumLeaves) {
Log::Warning("Accuarcy may be bad since you didn't set num_leaves.");
}
}
}
void IOConfig::Set(const std::unordered_map<std::string, std::string>& params) {
......
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