-
-
Notifications
You must be signed in to change notification settings - Fork 26.1k
ENH/DOC clearer sample weight validation error msg #31873
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
ENH/DOC clearer sample weight validation error msg #31873
Conversation
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.
Thanks for the PR @kapslock123
Co-authored-by: Adrin Jalali <adrin.jalali@gmail.com>
I can't work out why one of the required test is failing, is there anything I can change to fix it? test name: |
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.
The filename still doesn't match the PR name, although my comment explicitly had the new filename in it.
Oops I've edited it now I thought the convention was to have issue number followed by bug/ enhancement etc .rst |
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.
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.
LGTM. Thanks @kapslock123
Amazing thank you for approving my PR. Is there anything else I need to do? |
Reference Issues/PRs
Fixes #31712
What does this implement/fix? Explain your changes.
sklearn.utils._check_sample_weight used to raise
ValueError: Sample weights must be 1D array or scalar,
which was misleading (scalars are accepted) and gave no clue about the bad input.
This PR replaces that with a string
"Sample weights must be a scalar or a 1-D array-like of length n_samples. "
f"Got ndim={sample_weight.ndim} instead."
Any other comments?