-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
[MRG] Deprecate min_samples_leaf #11280
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
Closed
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b11a56e
Deprecate min_samples_leaf
lasagnaman 4d38180
catch deprecation warnings for min_samples_leaf
lasagnaman 842918b
fix flake8
lasagnaman 54a14d3
use 'deprecated' as sentinel value over None
lasagnaman 4d0d95a
Remove min_samples_leaf from doc/ and examples/
lasagnaman 17c6b61
Add reason for deprecation. Update whats_new
lasagnaman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -330,15 +330,12 @@ Tips on practical use | |
| for each additional level the tree grows to. Use ``max_depth`` to control | ||
| the size of the tree to prevent overfitting. | ||
|
|
||
| * Use ``min_samples_split`` or ``min_samples_leaf`` to control the number of | ||
| samples at a leaf node. A very small number will usually mean the tree | ||
| will overfit, whereas a large number will prevent the tree from learning | ||
| the data. Try ``min_samples_leaf=5`` as an initial value. If the sample size | ||
| varies greatly, a float number can be used as percentage in these two parameters. | ||
| The main difference between the two is that ``min_samples_leaf`` guarantees | ||
| a minimum number of samples in a leaf, while ``min_samples_split`` can | ||
| create arbitrary small leaves, though ``min_samples_split`` is more common | ||
| in the literature. | ||
| * Use ``min_samples_split`` to control the number of samples at a leaf node. | ||
| A very small number will usually mean the tree will overfit, whereas a | ||
| large number will prevent the tree from learning the data. If the sample | ||
| size varies greatly, a float number can be used as percentage in this | ||
| parameter. Note that ``min_samples_split`` can create arbitrarily | ||
| small leaves. | ||
|
|
||
| * Balance your dataset before training to prevent the tree from being biased | ||
| toward the classes that are dominant. Class balancing can be done by | ||
|
|
@@ -347,7 +344,7 @@ Tips on practical use | |
| class to the same value. Also note that weight-based pre-pruning criteria, | ||
| such as ``min_weight_fraction_leaf``, will then be less biased toward | ||
| dominant classes than criteria that are not aware of the sample weights, | ||
| like ``min_samples_leaf``. | ||
| like ``min_samples_split``. | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My understanding leads me to believe this change is grammatical, but please check? |
||
|
|
||
| * If the samples are weighted, it will be easier to optimize the tree | ||
| structure using weight-based pre-pruning criterion such as | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check whether my rephrasing of this paragraph is acceptable.