Greetings Teachers,
I am doing the Practical lab titled: C2_W4_Decision_Tree_with_Markdown.
In Exercise 1, I’ve entered my code. On running the test code section : … # UNIT TESTS
compute_entropy_test(compute_entropy) …, it fails for me.
This is the case even though my output (Entropy at root node: 1.0) is the same as shown in the ‘Expected Output’ cell below.
Below is copy paste of error and cells above and below:
print("Entropy at root node: ", compute_entropy(y_train))
# UNIT TESTS
compute_entropy_test(compute_entropy)
Entropy at root node: 1.0
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
<ipython-input-58-05098bb5d0e3> in <module>
5
6 # UNIT TESTS
----> 7 compute_entropy_test(compute_entropy)
~/work/public_tests.py in compute_entropy_test(target)
5 result = target(y)
6
----> 7 assert result == 0, "Entropy must be 0 with array of ones"
8
9 y = np.array([0] * 10)
AssertionError: Entropy must be 0 with array of ones
Expected Output:
Entropy at root node: 1.0
Any thoughts why I didnt pass the Tests for this exercise 1. Your assistence will be greatly appreciated. Please advise. Sincerely.
Thank you