Configuration for init estimation. (#8343)
* Configuration for init estimation. * Check whether the model needs configuration based on const attribute `ModelFitted` instead of a mutable state. * Add parameter `boost_from_average` to tell whether the user has specified base score. * Add tests.
This commit is contained in:
@@ -95,6 +95,8 @@ class GBLinear : public GradientBooster {
|
||||
return model_.num_boosted_rounds;
|
||||
}
|
||||
|
||||
bool ModelFitted() const override { return BoostedRounds() != 0; }
|
||||
|
||||
void Load(dmlc::Stream* fi) override {
|
||||
model_.Load(fi);
|
||||
}
|
||||
|
||||
@@ -252,6 +252,10 @@ class GBTree : public GradientBooster {
|
||||
return model_.trees.size() / this->LayerTrees();
|
||||
}
|
||||
|
||||
bool ModelFitted() const override {
|
||||
return !model_.trees.empty() || !model_.trees_to_update.empty();
|
||||
}
|
||||
|
||||
void PredictBatch(DMatrix *p_fmat, PredictionCacheEntry *out_preds,
|
||||
bool training, unsigned layer_begin, unsigned layer_end) override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user