C2W4 Practice Lab - Division by zero error

I encountered a ‘division by zero’ error in the final lab of the course Advance Learning Algorithms. Although compute_entropy function passed the test, compute_information_gain gave a zero divisor error related to compute_entropy. Furthermore, expected output are the same with the function output.

{Code image removed - not allowed by the Code of Conduct}

Could please you help me with this issue?

Hi @tugcemrc

You should ensure thatcompute_entropy is not called on an empty set of labels. For this, you must do exactly what rhe instructions say.

Hope it helps! Feel free to ask if you need further assistance.

Thanks @Alireza_Saei . It has been solved.

1 Like

can you please help how can i solve because i am facing same issue

1 Like

Please post a screen capture image that shows whatever error messages you’re seeing.

1 Like