-
-
Notifications
You must be signed in to change notification settings - Fork 26.2k
[MRG + 1] BUG :#5782 check_classification_targets returns y instead of y_type #5783
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
[MRG + 1] BUG :#5782 check_classification_targets returns y instead of y_type #5783
Conversation
lgtm thanks |
umm can you add a test? |
Have added test case . Please review. |
def test_check_classification_targets(): | ||
# Test that check_classification_target return correct type. #5782 | ||
y = np.array([0.0, 1.1, 2.0, 3.0]) | ||
assert_raises(ValueError, check_classification_targets, y) |
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.
This would pass previously as well. Can you use assert_warns
_message` and check that y_type is present in the message?
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.
Can I use assert_warns_message with ValueError ?
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.
Sorry, can you catch the error message and check. You could look at the tests in sklearn/tests/test_common.py
for inspiration.
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 have modified test case.
Please review .
# Test that check_classification_target return correct type. #5782 | ||
y = np.array([0.0, 1.1, 2.0, 3.0]) | ||
msg = type_of_target(y) | ||
assert_raise_message(ValueError, msg, check_classification_targets, y) |
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.
Can you do something similar to this? (https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/utils/estimator_checks.py#L351)
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.
why? This one is much nicer, I think.
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.
right. I did not read this properly.
LGTM |
[MRG + 1] BUG :#5782 check_classification_targets returns y instead of y_type
Thanks ! |
Please review.