Problem with Logistic Regression

I tried to write the code of Logistic Regression but every time this error just showed up I tried many times but didn’t figure it out and I tried to copy the code from the Optional lab but nothing changed

The error tells you that somewhere you are using a sequence when expecting a single value. You may need to resort to printing the shapes of the values passed to your compute_gradient_logistic() method and comparing with what you expect. (You can figure out expected shape either by looking at the shapes in the lab from the course, or by drilling deeper into your code and printing more shapes and types there, as needed.)

One thing that stands out as suspicious as I look at your code: Do you really mean to pass in y twice in the function call to compute_gradient_logistic(X, y, w, y)? Shouldn’t that last parameter be b?

Thank you for helping
please can you help me to understand what that RuntimeWarning means when I try the code with the data in the Optional lab it works but when I tried with another dataset that happened

The error “RuntimeWarning: divide by zero encountered in log” happens if you pass 0 to the np.log() function, since log(0) is undefined.

Check your calculation for f_wb_i and see if it’s reasonable that this might be 0. If so, then one work-around is to add a small epsilon to the value you’re passing to the log function.

For the future, probably the quickest way to find an answer if you get stuck on an error message that you’re unsure of like this is to just google the error message.