[python-package] clarify max_depth warning and limit when it is emitted #6402
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fixes #2898
fixes #5734
Modifies a warning that has historically been confusing for some LightGBM users. @shiyu1994 explained it very well in #2898 (comment):
This PR proposes an implementation of @shiyu1994 's proposal from further down in that comment.
As a side effect of this change, that also means the warning in question will never be raised from the
scikit-learn
estimators. They always passnum_leaves
in params, from this keyword argument:LightGBM/python-package/lightgbm/sklearn.py
Line 463 in 28536a0
I think that's ok. We have the docs in https://lightgbm.readthedocs.io/en/latest/Parameters-Tuning.html#tune-parameters-for-the-leaf-wise-best-first-tree. I'd rather have the
scikit-learn
estimators not emit this warning than take on the added complexity that'd be required to detect whether or notnum_leaves
was explicitly provided in the constructor keyword args.Notes for Reviewers
I would really like a review from @shiyu1994, to be sure I've interpreted #2898 (comment) correctly.
Would also appreciate feedback from any of the people involved in the previous discussions about this one whether this new warning is clearer.
cc @bfrobin446 @AlbertoEAF @dxyzx0 @aEgoist @memeplex @Wang-Yu-Qing @Cat2Li