When there are missing classes represented in the ground truth the calibration error cannot be computed.
To reproduce:
>>> cal.get_ece([[0.9,0.1], [0.8,0.2]], [0,0])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/dist-packages/calibration/utils.py", line 196, in get_ece
binning_scheme=get_equal_prob_bins, mode=mode)
File "/usr/local/lib/python3.6/dist-packages/calibration/utils.py", line 162, in lower_bound_scaling_ce
return _get_ce(probs, labels, p, debias, num_bins, binning_scheme, mode=mode)
File "/usr/local/lib/python3.6/dist-packages/calibration/utils.py", line 232, in _get_ce
raise ValueError('labels should be between 0 and num_classes - 1.')
ValueError: labels should be between 0 and num_classes - 1.
When there are missing classes represented in the ground truth the calibration error cannot be computed.
To reproduce: