Getting error on Exercise 8 - loop of ufunc does not support argument 0 of type numpy.ndarray which has no callable exp method


Hi Mentors,

I am getting an error, highlighted below, when I am merging all functions in the model in exercise 8.
"loop of ufunc does not support argument 0 of type numpy.ndarray which has no callable exp method"

I did some googling and found that this error happens because of float and int mismatch but I am not able to fix this and lost. Please help!

Thanks

Assuming that you are referring W2A2,
There are three potential problems.

  1. In model(), you need to initialize w and b at first. This is done by just calling initialize_with_zeros() with an appropriate parameter. You need to check this at first.
  2. When you call optimize(), you are referring global variables, X and Y. You need to use parameters passed. See arguments for model() carefully.
  3. When you call optimize(), you seem to set values for num_iteration, learning_rate, and print_cost. Those need to be the ones that are passed to model(). Don’t override them, since test programs changes those every time.

The above are starting points. Hope this helps.

Hi Nobu,
No. I am getting this error for Week 2 Assignment 2 - Logistic Regression with a Neural Network mindset. I did the following and was able to pass all tests.

Actually, I realized it, and edited to W2A2. :sweat_smile:
Glad to hear that you passed all tests with those.