In cases where the label cardinality is low and there are few test instances at the same time, calibrateThreshold throws an IndexOutOfBounds Exception.
This PR adds an additional check if to avoid the IndexOutOfBounds Exception by using the mean of the last two obtained probabilities.
Additionally within the existing edge case the bracketing seemed to be wrong and is fixed as well together with the removal of unnecessary casts.
In cases where the label cardinality is low and there are few test instances at the same time, calibrateThreshold throws an IndexOutOfBounds Exception.
This PR adds an additional check if to avoid the IndexOutOfBounds Exception by using the mean of the last two obtained probabilities.
Additionally within the existing edge case the bracketing seemed to be wrong and is fixed as well together with the removal of unnecessary casts.