Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[python-package] Introduce refit_tree_manual to Booster class. #6617

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Appease linter
  • Loading branch information
Atanas Dimitrov committed Sep 3, 2024
commit bdc173baae9c248a9716ecf87b83107f4371535f
6 changes: 3 additions & 3 deletions src/boosting/gbdt.cpp
Original file line number Diff line number Diff line change
@@ -290,9 +290,9 @@ void GBDT::RefitTree(const int* tree_leaf_prediction, const size_t nrow, const s
}

void GBDT::RefitTreeManual(int tree_idx, const double *vals, const int vals_size) {
CHECK(tree_idx >= 0);
CHECK(static_cast<size_t>(tree_idx) < models_.size());
CHECK(vals_size == models_[tree_idx]->num_leaves());
CHECK_GE(tree_idx, 0);
CHECK_LT(static_cast<size_t>(tree_idx), models_.size());
CHECK_EQ(vals_size, models_[tree_idx]->num_leaves());
// reset score by adding the difference
for (int leaf_id = 0; leaf_id < models_[tree_idx]->num_leaves(); ++leaf_id) {
models_[tree_idx]->SetLeafOutput(leaf_id, vals[leaf_id] - models_[tree_idx]->LeafOutput(leaf_id));
Loading
Oops, something went wrong.