Question 3 - Compute Information Gain
Expected Result and my result is same but there is error of nan when unit tests are run. When I submit the assignment, I should at least get the marks for correct answers for Questions 1, 2 and 4. But I’m getting 0.
I don’t know how to solve the ‘nan’ issue. But it’s ok as long as I get marks for my correct answers for other questions
nan error - when running unit test
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)
113
114 result = target(X, y, node_indexes, 1)
→ 115 assert np.isclose(result, 0, atol=1e-6), f"Wrong information gain. Expected {0.0} got: {result}"
116
117 print(“\033[92m All tests passed.”)
AssertionError: Wrong information gain. Expected 0.0 got: nan
nan error - when submitting assignment
ell #11. Can’t compile the student’s code. Error: AssertionError(‘Wrong information gain. Expected 0.0 got: nan’)
Traceback (most recent call last):
File “/home/www/app/grading/exceptions.py”, line 112, in handle_solution_errors
yield {}
File “/home/www/app/grading/abstract.py”, line 393, in _grade
context = compiled_code.run(cell_index=cell.index)
File “/home/www/app/grading/submission/compiled_code.py”, line 195, in run
return list(self._code_items.values())[cell_num - 1].run()
File “/home/www/app/grading/submission/compiled_code.py”, line 54, in run
return import_module(self.import_statement, items)
File “/usr/local/lib/python3.7/importlib/init.py”, line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 1006, in _gcd_import
File “”, line 983, in _find_and_load
File “”, line 967, in _find_and_load_unlocked
File “”, line 677, in _load_unlocked