Hi,
I got a strange error there, the computed information matches to the expected output, but still the unit test fails. However exercise 4, which builds on top of exercise 3, works perfectly fine. Here’s the output:
Information Gain from splitting the root on brown cap: 0.034851554559677034
Information Gain from splitting the root on tapering stalk shape: 0.12451124978365313
Information Gain from splitting the root on solitary: 0.2780719051126377
AssertionError Traceback (most recent call last)
in
9
10 # UNIT TESTS
—> 11 compute_information_gain_test(compute_information_gain)
~/work/public_tests.py in compute_information_gain_test(target)
101 node_indexes = list(range(4))
102 result = target(X, y, node_indexes, 0)
→ 103 assert np.isclose(result, 0.311278, atol=1e-6), f"Wrong information gain. Expected {0.311278} got: {result}"
104
105 result = target(X, y, node_indexes, 1)
AssertionError: Wrong information gain. Expected 0.311278 got: 0.44902249956730633
Expected Output:
Information Gain from splitting the root on brown cap: 0.034851554559677034
Information Gain from splitting the root on tapering stalk shape: 0.12451124978365313
Information Gain from splitting the root on solitary: 0.2780719051126377