test(tree): pin min_samples_split boundary and assert depth after #464 - #466
Merged
Merged
Conversation
Add min_samples_split_boundary regression tests for DecisionTreeClassifier and BaseTreeRegressor: a node holding exactly min_samples_split samples must still split, and a node with fewer samples must stay a leaf. The full_depth tests now also assert tree depth (3), guarding the public DecisionTreeClassifier::depth accessor. Bump patch version to 0.6.15. Fixes #465
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 #465
Checklist
Current behaviour
Follow-up to #464 (off-by-one fix in the tree growth loop). Review feedback left two coverage gaps:
min_samples_splitboundary. A node of exactly 3 samples withmin_samples_split: 3must still split under the fixedn >= min_samples_splitrule; withmin_samples_split: 4it must stay a single leaf.full_depthtest assertsnodes().len() == 7and accuracy but nevertree.depth(), althoughDecisionTreeClassifier::depth()is public API and the growth loop no longer drives the depth counter directly.New expected behaviour
min_samples_split_boundarytests (classifier and base regressor):min_samples_split: 3on a 3-sample node yields 3 nodes anddepth == 2;min_samples_split: 4yields 1 node anddepth == 0.full_depthtests now also assertdepth == 3for both the classifier (tree.depth(), public API) and the base regressor.CHANGELOG.mdentry. Library code is unchanged.Change logs
Fixed
tree: regression tests pinning themin_samples_splitboundary and the treedepthafter the Fix off-by-one in tree growth loop for DecisionTreeClassifier and BaseTreeRegressor #464 growth-loop fix.