C2_W4_Decision_Tree lab bug's

There are two undefined functions in the codes provided by Coursera that we can not modify but causes the lab to crash:
compute_informarion_gain_test
get_best_split_test
When the lab is graded it returns 0 grade because of the bugs
That is unfair to say the least.
Franklin Viloria

The tests are detecting defects in your code.

Or you did not run all of the cells in the notebook after you opened it.

even though my first two exercises came back with all test passed, but my grade was 0,
the other two the results matched the expected outcome but detected bug’s

1 Like

The grader uses different tests.

Moderator edit, code removed.

TMosh,
Attached is my C2_W4 lab done outside your lab environment, all 4 graded exercises are correct, results matched what it was expected, I did them in Jupyter notebook from anaconda navigator.
Please help me get a correct grading, your system is not working right

Hello @FViloria!

If the Coursera grading system failed you, it means your code is incorrect, the grader is working correctly. Furthermore, sharing your code and notebook publicly is not allowed and no one is going to check it (until they ask to share privately). So, it is better to avoid sharing it. Just share your full error and our mentors will guide you.

When graded gives you 0, it also gives you the reason. You can check it by clicking grader output. Share that here.

Another possibility is if you renamed the notebook file.

I am also facing the issue when run the test for Exercise 4.
When we run “get_best_split_test(get_best_split)” it is giving the error below:
“IndexError: index 5 is out of bounds for axis 0 with size 5”.

But, when I checked the code it is correctly printing the ‘best_feature’ and ‘max_info_gain’.
Can someone help please?

Thanks in advance,
Balaji

Your code must work for any size of data set.

Yes. I don’t know why I am getting the error above.
I think there is some bug in the function “get_best_split_test” which was created by course instructors to validate our code.

Can you please suggest how to get further help on this.

The test case found a bug in your get_best_split function.

Specifically, when a data set has a size of 5 items, your code attempts to access an item at index 5, which does not exist.

1 Like

I believe you are doing a wrong judgment, I am not sharing coursera code but my codes with coursera mentors, I am a retired 77 years old engineer, my only interest is curiosity and keep my brain working, i am not pursuing any career advancement or a new job, this is only for fun. you shouldn’t judge anyone so lightly.
What I said is that I ran the same codes as in exercise 1 to 4 outside the coursera lab environment and run them in my Jupyter notebook from anaconda navigator and got all results correct as expected in the exercises but the grader machine return 0 grade for me.
please be more respectful, I was considering to leave coursera for good with mentors like you
Franklin Viloria

Thank you, Mujassim, I will look into it, I made a X_train & y_train of 5 items and tested myself to check

Franklin Viloria

The tests are designed to do that, so you don’t have to.

If a mentor needs to see your code, we will ask you to send it via a private messsge.

Please do not post your code on the forum, regardless of your motivation.

Thanks!

Understood, I thought when you hit reply, it was only getting back to sender only

~WRD3990.jpg

There was a wrong entropy handler function, unable to process empty arrays. I corrected and problem solved.
thank you for your help
Franklin Viloria