Avoid regenerating the gradient index for approx. (#7591)

This commit is contained in:
Jiaming Yuan
2022-01-26 21:41:30 +08:00
committed by GitHub
parent 5d7818e75d
commit e060519d4f
7 changed files with 40 additions and 18 deletions

View File

@@ -94,7 +94,8 @@ BatchSet<GHistIndexMatrix> SimpleDMatrix::GetGradientIndex(const BatchParam& par
if (!(batch_param_ != BatchParam{})) {
CHECK(param != BatchParam{}) << "Batch parameter is not initialized.";
}
if (!gradient_index_ || (batch_param_ != param && param != BatchParam{}) || param.regen) {
if (!gradient_index_ || RegenGHist(batch_param_, param)) {
LOG(INFO) << "Generating new Gradient Index.";
CHECK_GE(param.max_bin, 2);
CHECK_EQ(param.gpu_id, -1);
// Used only by approx.