W4-Practice Lab: Decision Trees

I am reposting my question. The auto-grader keeps on failing me (happy to post error that I am getting) even though the code i have written appears to be correct [I even recreated it with all the hints that are available]. I think there is an error that I am not able to get around. How can I restart? I have been stuck and cannot complete this week and move on to the next course. Help!

1 Like

Hello Sandeep,

Can you share the screenshot of the error without sharing the codes. In case submission failure, you can share grader output screenshot.

Regards
DP

Please see below.

Hello Sandeep,

Codes to have a review.

Your codes for split dataset needs correction(your indices choice is incorrect)

Your if X statement should be under for statement.

Your result codes has incorrect target

This could be again because of your incorrect code for if X statement and further left indices being out of the for loop

Regards
DP

Thanks, Deepti.

I can confirm that my If X is under for statement. The split dataset code also passes the unit test. I am happy to offline share code - if helpful.

Best,

Ok Sandeep DM your codes

Sent. Do let me know if you need any additional information.

Thanks,

Kindly send me the your notebook as error can be other grader cell too via personal DM

Hello @Sandeep_Mangaraj,

If X [i, feature] == 1 this is incorrectly written, placing index and feature together is incorrect, creating index error.

Regards
DP