The Exercise 2 in lab for decision tress seems like to have an incorrect assertion check which is not letting me pass the unit tests.
Specifically the below assertion seems incorrect, can someone please take a look and fix the lab,
~/work/public_tests.py in split_dataset_test(target)
44 assert type(right[0]) == int, f"Wrong type for elements in the right list. Expected: number got: {type(right[0])}"
45
—> 46 assert len(left) == 2, f"left must have 2 elements but got: {len(left)}"
47 assert len(right) == 3, f"right must have 3 elements but got: {len(right)}"
I would appreciate a quick reply as I am not able to complete the course and I have deadline approaching in couple of days. I will fail the course otherwise, please help!!!
This lab has not changed since August 2022.
No other student has reported an issue with that assert.
My code does not throw that assert.
So I suspect that the issue is in your code.
thanks for your help. I checked the hints, my code is exactly the same as in hints. The assertion error only occurs for 2nd unit test which I copied below. The question asks us to split based on color of mushroom cap - whether it is brown or not. The correct answer is
left_indices = [0 ,2,4]
right_indices = [6,8]
I verified it by simply looking at data set as well.
I get assertion error
AssertionError: left must have 2 elements but got: 3
But clearly left has 3 elements so why should it have 2?
I am not sure why no one else reported the issue. I have cleared the cookies/cache it still throws the assert. I have no idea how I can progress. If I don’t get help I won’t be able to pass