Skip to content
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: move get_true_label_position to utils in classification #427

Conversation

BaptisteCalot
Copy link
Collaborator

@BaptisteCalot BaptisteCalot commented Apr 9, 2024

Description

1- Move get_true_label_position function from classification.py to a new utils file
2- Add a test for this function

How Has This Been Tested?

1- Check if the return of my function is correct
2- Check if the shape of my function's return is correct

@@ -1865,8 +1869,7 @@ def test_get_true_label_position(
y_pred_proba = y_true_proba_place[1]
place = y_true_proba_place[2]

mapie = MapieClassifier(random_state=random_state)
found_place = mapie._get_true_label_position(y_pred_proba, y_true)
found_place = get_true_label_position(y_pred_proba, y_true)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This test should be implemented directly in test_utils_classification_conformity_scores

expected_position = np.array([[0], [0], [1], [1]])

assert np.array_equal(position, expected_position)
assert position.shape == y.shape
Copy link
Collaborator

Choose a reason for hiding this comment

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

Your tests must test only one thing at a time. For the test on the shape, you can take some random np arrays with larger sizes

@LacombeLouis
Copy link
Collaborator

Hey @BaptisteCalot,
Thank you for this PR! For the moment it doesn't pass some tests, but we have fixed the issue. So you can git merge upstream/main and everything should work!
Thank you!

Copy link
Collaborator

@thibaultcordier thibaultcordier left a comment

Choose a reason for hiding this comment

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

Thank you for your first PR, which is appropriate for the problem to be solved.

@thibaultcordier thibaultcordier merged commit 1b57a04 into master May 14, 2024
8 checks passed
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.

Move some methods of MapieClassifier to a utils file
4 participants