Skip to content
DeepForgeby svx
All problems
EasyStatisticsst-243

Reliability Diagram Binning

Problem

Return the bin index for each probability using int(p * num_bins), clipped to [0, num_bins - 1] so that 1.0 falls in the final bin. Return an empty list when num_bins <= 0.

Test cases

case 1
in: [[0,0.5,0.999,1],5]
expected: [0,2,4,4]
case 2
in: [[],4]
expected: []
case 3
in: [[0.2],0]
expected: []
case 4
in: [[0.4,0.6],2]
expected: [0,1]
Starter codePython
def reliability_bins(probs, num_bins):
    # Your code here
    pass

4 test cases · run your code against them in the editor