Encode pandas categorical data automatically. (#7231)

This commit is contained in:
Jiaming Yuan
2021-09-17 11:09:55 +08:00
committed by GitHub
parent 32e0858501
commit 22d56cebf1
3 changed files with 40 additions and 16 deletions

View File

@@ -582,6 +582,8 @@ struct GPUHistMakerDevice {
auto is_cat = candidate.split.is_cat;
if (is_cat) {
CHECK_LT(candidate.split.fvalue, std::numeric_limits<bst_cat_t>::max())
<< "Categorical feature value too large.";
auto cat = common::AsCat(candidate.split.fvalue);
std::vector<uint32_t> split_cats(LBitField32::ComputeStorageSize(std::max(cat+1, 1)), 0);
LBitField32 cats_bits(split_cats);