Bug in the First lab in the advanced learning algorithms

Hello dear community,

Please can you help me identify where do i have a problem ? I get the correct value for entropy but i get this error, please see pics below:

thank you so much !

{moderator edit - solution code removed}

Please do not post your code on the forum. That is not allowed by the Code of Conduct.

Posting a question or error message is fine.

Hello TMosh,

Thanks for letting me know. But then how will I know where the error is ?

The error message about the entopy value has the clue you need for debugging.

Thank you for pointing that out to me. I did update my code to put zero in the entropy if p1=0 or p1=1, but it still gives me the same error.

Sorry that I am not able to investigate this issue at this time. Perhaps another mentor can help.

Thank you so much ! i really appreciate it. You already been a great help to me thanks :slight_smile:

@paulinpaloalto, do you have a few moments for this topic?

In principle I’d be happy to help, but I don’t currently have access to the course materials for MLS. I will contact Manal by DM.

Thank you :smiling_face_with_three_hearts: :face_holding_back_tears:

@manalchetouani, was @paulinpaloalto able to help you? I suspect a rounding error in calculating p_1. One approach to avoid rounding errors would be to count the number of 1’s in y and compare that with the length of y.

I think I found a less subtle problem in the code, but am waiting to hear back whether my suggestion was enough to get to a solution.

Dear @Wendy

Thank you so much for your willingness to help me. Mr @paulinpaloalto was really kind and saw through my code, which happened to have a negative sign “-” which should not be there :laughing: thank you to you both and to Mr @paulinpaloalto for his valuable time :smiling_face_with_three_hearts: