Ex 8 model wrong type(d['costs'])

Course 1, week 2, exercice 8
Hi all,

I have an error message in the model function. I get the following:

IndexError: only integers, slices (:), ellipsis (...), numpy.newaxis (None) and integer or boolean arrays are valid indices

I know this question has already come up many times, but I after trying all of the suggested solutions, I still cannot get this right. This is what I have tried/double-checked:

  1. correct shape of w and X:
    w.shape=(4, 1)
    X_train.shape=(4, 3)
  2. iteration number: I have removed every default values hard-coded in optimize and model
  3. params and not parameters
  4. use X_train and Y_train in optimize
  5. double checked type and length of costs(see in image how I have checked that)

I still get the error. However, I have run the following cell and get the expected train and test accuracy. Can anyone help?

Thank you!

Hi, I think you have changed the return statement, the definition of the model function states:

    d -- dictionary containing information about the model

You are returning w.

Thank you for spotting that :slight_smile: it now works