From f60471984c0fc928038d28cf4d0767dd6ddb9c2e Mon Sep 17 00:00:00 2001 From: Henry Webel Date: Mon, 21 Oct 2024 13:25:47 +0200 Subject: [PATCH] :bug: fix order of example more explicitly. --- tests/pandas/test_calc_errors.py | 44 +++++++++++++++++--------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/tests/pandas/test_calc_errors.py b/tests/pandas/test_calc_errors.py index d1fb8befe..8af9ffd6f 100644 --- a/tests/pandas/test_calc_errors.py +++ b/tests/pandas/test_calc_errors.py @@ -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', @@ -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