Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[MRG+1] Clarify error message for min_samples_split. - #8167

Merged
jnothman merged 1 commit into
scikit-learn:masterfrom
mikebenfield:error_message
Jan 8, 2017
Merged

[MRG+1] Clarify error message for min_samples_split.#8167
jnothman merged 1 commit into
scikit-learn:masterfrom
mikebenfield:error_message

Conversation

@mikebenfield

Copy link
Copy Markdown
Contributor

I found the error message for a tree when min_samples_split == 1 (an int) confusing. There was a earlier commit 25 days ago that I think was supposed to resolve this problem, but maybe this change will be still clearer?

Without this commit, we get this:

~ $ cat example.py 
from sklearn.tree import DecisionTreeClassifier
dtc = DecisionTreeClassifier(min_samples_split=1)
dtc.fit([[0]], [0])
~ $ python example.py 
Traceback (most recent call last):
  File "example.py", line 3, in <module>
    dtc.fit([[0]], [0])
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/sklearn/tree/tree.py", line 739, in fit
    X_idx_sorted=X_idx_sorted)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/sklearn/tree/tree.py", line 199, in fit
    % self.min_samples_split)
ValueError: min_samples_split must be at least 2 or in (0, 1.0], got 1

@jnothman

jnothman commented Jan 7, 2017

Copy link
Copy Markdown
Member

LGTM

@jnothman jnothman changed the title Clarify error message for min_samples_split. [MRG+1] Clarify error message for min_samples_split. Jan 7, 2017

@nelson-liu nelson-liu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM as well, when I was writing the other PR I thought people would differentiate between the integer 1 and the float range but I agree it is unclear.

@jnothman
jnothman merged commit 84cc67b into scikit-learn:master Jan 8, 2017
@jnothman

jnothman commented Jan 8, 2017

Copy link
Copy Markdown
Member

Thanks

sergeyf pushed a commit to sergeyf/scikit-learn that referenced this pull request Feb 28, 2017
@Przemo10 Przemo10 mentioned this pull request Mar 17, 2017
Sundrique pushed a commit to Sundrique/scikit-learn that referenced this pull request Jun 14, 2017
NelleV pushed a commit to NelleV/scikit-learn that referenced this pull request Aug 11, 2017
paulha pushed a commit to paulha/scikit-learn that referenced this pull request Aug 19, 2017
maskani-moh pushed a commit to maskani-moh/scikit-learn that referenced this pull request Nov 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants