Closed mpitropov closed 3 years ago
great idea
Sorry for the super late response. This is a great question!
Here's how you can do it using functions in utils.py. First, get the bins by calling get_equal_bins or get_equal_prob_bins (standard reliability diagrams typically use get_equal_prob_bins). Then we have a function bin, which you can call with bin(data, bins) which bins the data. The value returned is of type BinnedData, which is a list of length num_bins, where each element is a list of (prob, label) pairs in that bin. Averaging over the bin, you get the probability and the average accuracy in that bin, which is what you want in a reliability diagram.
We could also create a wrapper script for this. If you want to submit a PR for it, with a couple of simple of unit tests to check that it produces the right thing, that'd be amazing! Let me know if you have any other questions.
Closing for now, but feel free to reopen if you have follow-up questions!
Within the Verified Uncertainty Calibration paper I noticed there are no reliability diagrams. Would it be possible to return the bin accuracies in order for users to create the reliability diagram? If the bin sizes are different, I think that would also have to be returned.
For example in my current codebase to create a reliability diagram for ECE I have the following:
I have these variables
Send it to my plotting function
To create a diagram like this: