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
Prevent faulty data
  • Loading branch information
Atanas Dimitrov committed Aug 8, 2024
commit a07f1a237a0bfb3acf7aa26d3f8c1f8adf20f091
3 changes: 3 additions & 0 deletions python-package/lightgbm/basic.py
Original file line number Diff line number Diff line change
@@ -4936,6 +4936,9 @@ def refit_tree_manual(
"""
values = _list_to_1d_numpy(values, dtype=np.float64, name="leaf_values")

if len(values) != self.num_leaves(tree_id):
raise ValueError("Length of values should be equal to the number of leaves in the tree")

_safe_call(
_LIB.LGBM_BoosterRefitTreeManual(
self._handle,