The current code creates some floating point precision problems when subtracting a probability of 0.9 for a positive sample, in which ECE should be 0.1 but it seems to be 0.09999999999999. I had to round the number and print it in order to pass the doctest, but I wonder if this precision issue can be avoided.
https://github.com/perellonieto/PyCalib/blob/master/pycalib/metrics.py#L460