File size: 729 Bytes
b81628e
3f722df
 
b81628e
9d4511f
 
 
 
 
 
 
 
 
 
b81628e
3257c6c
9d4511f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
test_cases = [
    {"predictions": [[0, 1], [1, 0]], "references": [1, 0], "result": {"ECE": 0}},
    {"predictions": [[0, 1], [1, 0]], "references": [0, 1], "result": {"ECE": 1}},
    {
        "predictions": [[0.6, 0.2, 0.2], [0, 0.95, 0.05], [0.75, 0.05 ,0.2]],
        "references": [0, 1, 2],
        "result": {"ECE": ((abs((0==0)-0.7) + abs((1==1)-1) + abs((2==0)-0.8))/3)}, 
        #all predictions in separate bins
    },
    {
        "predictions": [[0.6, 0.2, 0.2], [0, 0.95, 0.05], [0.7, 0.1 ,0.2]],
        "references": [0, 1, 2],
        "result": {"ECE": abs((0==0)-0.7 + (2==0)-0.7)/3 + abs((1==1)-1)/3}, 
        #some predictions in same bin
    },

# DEV: make more advanced tests including differing kwargs