I am having a problem on a week 3 lab exercise

I am taking the coursera Supervised Machine Learning: Regression and Classification. I am taking the Week 3 practice lab: Logistic regression. I am stuck on the lab step Def Predict. The step tells us to do the Def Compute Cost as we earlier did.

The earlier step gave us the data (x, y, w, b). However the Def Predict only gives (x, w, b). I tried coding cost as I did earlier and followed the hints in the exercise, but I am getting errors. I need help.|

Please post a screen capture image that shows the error messages.

Here is my exercise 4 which is a DEF predict and the following error I am getting.

image

For future reference:
It would help much if your thread was posted in the correct forum area for the MLS course. You’ve posted in “AI Questions”, which isn’t specific to any course.

The course forums are in the “Course Q&A” area. Then pick the course forum and add a tag for the week number.

You can move your thread by using the ‘pencil’ icon in the thread title.

= = = = =

Sorry, I don’t know what that means.

The predict function is supposed to return a numpy ndarray data type. Yours appears to have been re-defined as integer type.

If you used an if-statement in your predict function, and set p[i] = 1, then that’s how your values became the wrong type.