-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
[MRG+2] add validation for non-empty input data #4214
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
Conversation
Sounds like a plan :) |
check_is_fitted) | ||
NotFittedError, | ||
has_fit_parameter, | ||
check_is_fitted) |
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.
STY: One import per line?
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.
I agree. I did not intend to change those import lines as part of this PR but apparently my editor fixed the indenting without asking me :)
LGTM. |
This needs a common test, right? |
Yes I started adding some in edcd079 although I think the content of this PR only is already an improvement in its current state. Let me first rebase it on master. |
388c844
to
d16e9ee
Compare
I added the failing common tests in a separate PR at #4245. |
LGTM +1 for merge |
[MRG+2] add validation for non-empty input data
This follows the discussion in #4206. This makes
check_array
andcheck_X_y
reject input arrays with less than 1 samples and less than 1 feature for 2D inputs while providing informative error message to the caller.FYI I also have implemented some common checks based on this PR in edcd079 but this reveals some missing input validation in several estimators. Those missing validation checks should better be added once @amueller's own #4136 is merged in master to avoid conflict resolution pain and redundant work.