Unverified Commit ddf8c104 authored by Guolin Ke's avatar Guolin Ke Committed by GitHub
Browse files

Allow the minimal feature to 1 in column sampling (#3197)


Co-authored-by: default avatarStrikerRUS <nekit94-12@hotmail.com>
parent 314b9d24
...@@ -31,7 +31,7 @@ class ColSampler { ...@@ -31,7 +31,7 @@ class ColSampler {
} }
static int GetCnt(size_t total_cnt, double fraction) { static int GetCnt(size_t total_cnt, double fraction) {
const int min = std::min(2, static_cast<int>(total_cnt)); const int min = std::min(1, static_cast<int>(total_cnt));
int used_feature_cnt = static_cast<int>(Common::RoundInt(total_cnt * fraction)); int used_feature_cnt = static_cast<int>(Common::RoundInt(total_cnt * fraction));
return std::max(used_feature_cnt, min); return std::max(used_feature_cnt, min);
} }
......
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