Skip to content

Commit

Permalink
🐛 fix order of example more explicitly.
Browse files Browse the repository at this point in the history
  • Loading branch information
enryH committed Oct 21, 2024
1 parent 5f6bee8 commit f604719
Showing 1 changed file with 23 additions and 21 deletions.
44 changes: 23 additions & 21 deletions tests/pandas/test_calc_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def example_data():
data['freq_feat'] = [4, 4, 5, 5, 5, 6, 7, 9, 8, 6]
return data


def test_get_absolute_error(example_data):
expected = {'feat': {0: 'feat_0',
1: 'feat_0',
Expand Down Expand Up @@ -147,55 +148,56 @@ def test_calc_errors_per_bin(example_data):
expected = {'feat': {0: 'feat_0',
1: 'feat_0',
2: 'feat_1',
3: 'feat_2',
4: 'feat_5',
3: 'feat_5',
4: 'feat_2',
5: 'feat_4',
6: 'feat_3',
7: 'feat_1',
8: 'feat_1',
9: 'feat_6'},
8: 'feat_6',
9: 'feat_1'},
'model_1': {0: 1.7588900899999977,
1: 0.408312930000001,
2: 0.03497017999999841,
3: 1.0785032900000004,
4: 0.35989225000000147,
3: 0.35989225000000147,
4: 1.0785032900000004,
5: 0.25562937999999846,
6: 0.5197284500000023,
7: 0.31798253999999915,
8: 0.7990367599999999,
9: 0.3581477100000008},
8: 0.3581477100000008,
9: 0.7990367599999999},
'model_2': {0: 0.9619296899999981,
1: 0.34984830000000144,
2: 0.04799503999999999,
3: 0.6079609700000006,
4: 0.3109490500000014,
3: 0.3109490500000014,
4: 0.6079609700000006,
5: 0.24097977999999998,
6: 0.48225405000000166,
7: 0.055784630000001556,
8: 0.7969851200000022,
9: 0.10481768000000002},
8: 0.10481768000000002,
9: 0.7969851200000022},
'model_3': {0: 2.9334374200000006,
1: 0.7514138499999987,
2: 0.023260270000001526,
3: 1.3011469200000008,
4: 0.749302710000002,
3: 0.749302710000002,
4: 1.3011469200000008,
5: 0.04352294999999984,
6: 0.6282909300000021,
7: 0.18840471000000036,
8: 0.6975732299999997,
9: 0.025569629999999677},
8: 0.025569629999999677,
9: 0.6975732299999997},
'model_4': {0: 2.1805211699999987,
1: 0.46094297999999867,
2: 0.1140570700000012,
3: 1.2042582899999985,
4: 0.5444545000000005,
3: 0.5444545000000005,
4: 1.2042582899999985,
5: 0.06842009000000004,
6: 0.8281038200000026,
7: 0.7145071600000001,
8: 0.9842914200000017,
9: 0.1415143900000011},
8: 0.1415143900000011,
9: 0.9842914200000017},
'bin': {0: 25, 1: 30, 2: 31, 3: 26, 4: 26, 5: 29, 6: 29, 7: 28, 8: 28, 9: 28},
'n_obs': {0: 1, 1: 1, 2: 1, 3: 2, 4: 2, 5: 2, 6: 2, 7: 3, 8: 3, 9: 3}}
actual = calc_errors.calc_errors_per_bin(
example_data.drop('freq_feat', axis=1)).sort_values(["n_obs", "bin"]).reset_index().to_dict()
example_data.drop('freq_feat', axis=1)
).sort_values(["n_obs", "bin", "model_1"]).reset_index().to_dict()
assert actual == expected

0 comments on commit f604719

Please sign in to comment.