Use maximum category in sketch. (#7853)

This commit is contained in:
Jiaming Yuan
2022-05-05 19:56:49 +08:00
committed by GitHub
parent 8ab5e13b5d
commit 46e0bce212
6 changed files with 117 additions and 78 deletions

View File

@@ -74,10 +74,15 @@ inline void InvalidCategory() {
// values to be less than this last representable value.
auto str = std::to_string(OutOfRangeCat());
LOG(FATAL) << "Invalid categorical value detected. Categorical value should be non-negative, "
"less than total umber of categories in training data and less than " +
"less than total number of categories in training data and less than " +
str;
}
inline void CheckMaxCat(float max_cat, size_t n_categories) {
CHECK_GE(max_cat + 1, n_categories)
<< "Maximum cateogry should not be lesser than the total number of categories.";
}
/*!
* \brief Whether should we use onehot encoding for categorical data.
*/