| 352 | } |
| 353 | |
| 354 | double GBDT::BoostFromAverage(int class_id, bool update_scorer) { |
| 355 | // boosting from average label; or customized "average" if implemented for the current objective |
| 356 | if (models_.empty() && !train_score_updater_->has_init_score() && objective_function_ != nullptr) { |
| 357 | if (config_->boost_from_average || (train_data_ != nullptr && train_data_->num_features() == 0)) { |
| 358 | double init_score = ObtainAutomaticInitialScore(objective_function_, class_id); |
| 359 | if (std::fabs(init_score) > kEpsilon) { |
| 360 | if (update_scorer) { |
| 361 | train_score_updater_->AddScore(init_score, class_id); |
| 362 | for (auto& score_updater : valid_score_updater_) { |
| 363 | score_updater->AddScore(init_score, class_id); |
| 364 | } |
| 365 | } |
| 366 | Log::Info("Start training from score %lf", init_score); |
| 367 | return init_score; |
| 368 | } |
| 369 | } else if (std::string(objective_function_->GetName()) == std::string("regression_l1") |
| 370 | || std::string(objective_function_->GetName()) == std::string("quantile") |
| 371 | || std::string(objective_function_->GetName()) == std::string("mape")) { |
| 372 | Log::Warning("Disabling boost_from_average in %s may cause the slow convergence", objective_function_->GetName()); |
| 373 | } |
| 374 | } |
| 375 | return 0.0f; |
| 376 | } |
| 377 | |
| 378 | bool GBDT::TrainOneIter(const score_t* gradients, const score_t* hessians) { |
| 379 | GBDT::TrainOneIter_old(gradients, hessians); |
nothing calls this directly
no test coverage detected