| 1134 | } |
| 1135 | |
| 1136 | void BoostOneIter(std::int32_t, std::shared_ptr<DMatrix> train, |
| 1137 | GradientContainer* in_gpair) override { |
| 1138 | this->monitor_.Start(__func__); |
| 1139 | this->Configure(); |
| 1140 | |
| 1141 | if (ctx_.seed_per_iteration) { |
| 1142 | ctx_.Rng().seed(ctx_.seed * kRandSeedMagic + this->BoostedRounds()); |
| 1143 | } |
| 1144 | |
| 1145 | this->ValidateDMatrix(train.get(), true); |
| 1146 | if (in_gpair->HasValueGrad()) { |
| 1147 | CHECK_EQ(this->learner_model_param_.OutputLength(), in_gpair->NumTargets()) |
| 1148 | << "Value gradient should have the same number of targets as the overall model."; |
| 1149 | } else { |
| 1150 | CHECK_EQ(this->learner_model_param_.OutputLength(), in_gpair->NumSplitTargets()) |
| 1151 | << "The number of columns in gradient should be equal to the number of " |
| 1152 | "targets/classes in the model."; |
| 1153 | } |
| 1154 | auto predt = prediction_container_.Cache(train, ctx_.Device()); |
| 1155 | this->gbm_->DoBoost(train.get(), in_gpair, predt.get(), obj_.get()); |
| 1156 | this->monitor_.Stop(__func__); |
| 1157 | } |
| 1158 | |
| 1159 | std::string EvalOneIter(int iter, const std::vector<std::shared_ptr<DMatrix>>& data_sets, |
| 1160 | const std::vector<std::string>& data_names) override { |