-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
Setting min_samples_split=1 in DecisionTreeClassifier does not raise exception #25481
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
Comments
I think that this is on purpose. Otherwise, we would have used At least this is not a regression since the code in the past would have failed and now we allow it to be considered as 100% of the train set. If we exclude |
Note that with sklearn 1.0, |
Reading the docstring, I agree it is strange to interpret the integer scikit-learn/sklearn/tree/_classes.py Lines 635 to 638 in baefe83
From the docstring, I think we should be able to specify "1.0" but not "1" in our parameter validation framework. @jeremiedbb What do you think of having a way to reject Interval(Real, 0.0, 1.0, closed="right", invalid_type=Integral), If we have a way to specify a |
Also note that scikit-learn/sklearn/tree/_classes.py Lines 257 to 263 in baefe83
If min_samples_split = max(min_samples_split, 2 * min_samples_leaf) If min_samples_split = int(ceil(self.min_samples_split * n_samples)) |
Describe the bug
If
min_samples_split
is set to 1, an exception should be raised according to the paramter's constraints:scikit-learn/sklearn/tree/_classes.py
Lines 100 to 103 in e2e7050
However,
DecisionTreeClassifier
acceptsmin_samples_split=1
without complaining.With scikit-survival 1.0, this raises an exception as expected:
I suspect that this has to do with the Intervals of the constraints overlapping.
min_samples_split=1
satisfies theReal
constraint, whereas theIntegral
constraint should have precedence.Steps/Code to Reproduce
Expected Results
Actual Results
No exception is raised.
Versions
The text was updated successfully, but these errors were encountered: