Skip to content

Commit

Permalink
Allow the minimal feature to 1 in column sampling (#3197)
Browse files Browse the repository at this point in the history
Co-authored-by: StrikerRUS <[email protected]>
  • Loading branch information
guolinke and StrikerRUS authored Jul 1, 2020
1 parent 314b9d2 commit ddf8c10
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/treelearner/col_sampler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ColSampler {
}

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));
return std::max(used_feature_cnt, min);
}
Expand Down

0 comments on commit ddf8c10

Please sign in to comment.