Fix sparse threshold warning. (#8268)

This commit is contained in:
Jiaming Yuan 2022-09-26 22:22:11 +08:00 committed by GitHub
parent ff71c69adf
commit 4056974e37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -244,7 +244,8 @@ BatchSet<GHistIndexMatrix> IterativeDMatrix::GetGradientIndex(BatchParam const&
ghist_ = std::make_shared<GHistIndexMatrix>(&ctx_, Info(), *ellpack_, param);
}
if (param.sparse_thresh != tree::TrainParam::DftSparseThreshold()) {
if (!std::isnan(param.sparse_thresh) &&
param.sparse_thresh != tree::TrainParam::DftSparseThreshold()) {
LOG(WARNING) << "`sparse_threshold` can not be changed when `QuantileDMatrix` is used instead "
"of `DMatrix`.";
}