Skip to content

Ensure consistentcy between labels and probabilities #599

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

emilioMaddalena
Copy link
Contributor

Fixes #587.

Problem: In certain cases (see issue), self.labels and self.model_head.classes_ are not in the same order. When calling self.predict_proba, the returned probabilities are ordered as per the model's head labels. This however contradicts the model's attribute order and is very counter intuitive.

Solution: I'm simply reordering the probabilities to ensure consistency. This completely solved the problem I had described in my issue.

First notebook to try and reproduce the error.
- In predict_proba, probs were consistent with the model head's labels order
- Now we make sure probs are always consistent with self.labels
@emilioMaddalena
Copy link
Contributor Author

Hi @tomaarsen! Let me know if you've liked the solution or not. There are ofc multiple ways of tackling this...

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.

predict and predict_proba give conflicting predictions
1 participant