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

added wrapper function in utils.py for getting accuracy of bins #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sdelcore
Copy link

@sdelcore sdelcore commented May 7, 2021

Related to #3

Hello! I've implemented a wrapper function in utils.py to get the accuracy of each bin given the prediction prob and labels along with a unit test. Please let me know if this is sufficient or if changes should be made

@AnanyaKumar
Copy link
Member

AnanyaKumar commented May 27, 2021

Thanks for the PR, we really appreciate contributions to this project!

On line 339 the code takes the average of the labels, which may not be the same as the accuracy. For example, consider a test case where we have probs_labels = np.array([[0.0, 0], [0.0, 0], [0.0, 0]]). As per the documentation, the first number is the probability that the label is 1 (predicted by the model). So in this case the accuracy in this bin should be 100% because the model is very confident the label is not 1, and the label is in fact not 1 in any of these cases. I think the code will take the average of the 0s and output 0% accuracy.

The accuracy within a bin can be tricky to define if for example 0.5 is contained inside one of the bins. That is, if the model is calibrated we would normally classify all examples x where P(Y = 1 | x) > 0.5, as class 1. But what if one of the bins is [0.45, 0.55]? Are these examples classifier as 0 or 1? So I'm not sure if there's a right way to do this. It might need to depend on the application.

It might help if we understand what's your use case for this, and how we can improve the library for that?

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.

2 participants