Skip to content

Commit e38d5a6

Browse files
authored
Document current limitation in number of features (dmlc#3886)
1 parent 828d757 commit e38d5a6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/learner.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -674,11 +674,15 @@ class LearnerImpl : public Learner {
674674
inline void LazyInitModel() {
675675
if (this->ModelInitialized()) return;
676676
// estimate feature bound
677+
// TODO(hcho3): Change num_feature to 64-bit integer
677678
unsigned num_feature = 0;
678679
for (auto & matrix : cache_) {
679680
CHECK(matrix != nullptr);
680-
num_feature = std::max(num_feature,
681-
static_cast<unsigned>(matrix->Info().num_col_));
681+
const uint64_t num_col = matrix->Info().num_col_;
682+
CHECK_LE(num_col, static_cast<uint64_t>(std::numeric_limits<unsigned>::max()))
683+
<< "Unfortunately, XGBoost does not support data matrices with "
684+
<< std::numeric_limits<unsigned>::max() << " features or greater";
685+
num_feature = std::max(num_feature, static_cast<unsigned>(num_col));
682686
}
683687
// run allreduce on num_feature to find the maximum value
684688
rabit::Allreduce<rabit::op::Max>(&num_feature, 1);

0 commit comments

Comments
 (0)