Skip to content

Conversation

varunkumar-dev
Copy link
Contributor

Please review.

@MechCoder
Copy link
Member

lgtm thanks

@MechCoder
Copy link
Member

umm can you add a test?

@varunkumar-dev
Copy link
Contributor Author

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)
Copy link
Member

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?

Copy link
Contributor Author

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 ?

Copy link
Member

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.

Copy link
Contributor Author

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 .

@MechCoder MechCoder changed the title BUG :#5782 check_classification_targets returns y instead of y_type [MRG] BUG :#5782 check_classification_targets returns y instead of y_type Nov 10, 2015
# 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)
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

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.

Copy link
Member

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.

@amueller amueller changed the title [MRG] BUG :#5782 check_classification_targets returns y instead of y_type [MRG + 1] BUG :#5782 check_classification_targets returns y instead of y_type Nov 14, 2015
@amueller
Copy link
Member

LGTM

MechCoder added a commit that referenced this pull request Nov 14, 2015
[MRG + 1] BUG :#5782  check_classification_targets returns y instead of y_type
@MechCoder MechCoder merged commit 0820731 into scikit-learn:master Nov 14, 2015
@MechCoder
Copy link
Member

Thanks !

@varunkumar-dev varunkumar-dev deleted the check_classification_bug branch November 17, 2015 01:15
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