Support early stopping with training continuation, correct num boosted rounds. (#6506)
* Implement early stopping with training continuation. * Add new C API for obtaining boosted rounds. * Fix off by 1 in `save_best`. Co-authored-by: Philip Hyunsu Cho <chohyu01@cs.washington.edu>
This commit is contained in:
@@ -1107,6 +1107,12 @@ class LearnerImpl : public LearnerIO {
|
||||
}
|
||||
}
|
||||
|
||||
int32_t BoostedRounds() const override {
|
||||
if (!this->gbm_) { return 0; } // haven't call train or LoadModel.
|
||||
CHECK(!this->need_configuration_);
|
||||
return this->gbm_->BoostedRounds();
|
||||
}
|
||||
|
||||
XGBAPIThreadLocalEntry& GetThreadLocal() const override {
|
||||
return (*LearnerAPIThreadLocalStore::Get())[this];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user