Course 1 week 2: bias 'b' value type in model vs initialize_with_zeros

Hello @thiyanesh!

Thank you so much for your interest in this topic :smiley:
Sorry for my away from keyboard, I was offline over the weekend.

Just as you have pointed out in your post, given how the code and tests work, you need to change the w and b params inside def model to use the new values from params[w] and params[b], after the call to optimize (and thus also after the call initialize_with_zeros has been made):

I guess that might have been what was missing from the solution code when some of you encountered this particular data type error from running the tests.

If you read the comments carefully, it specifically specifies the following steps:

# (≈ 1 line of code)   
# initialize parameters with zeros 
# w, b = ...

#(≈ 1 line of code)
# Gradient descent 
# parameters, grads, costs = ...

# Retrieve parameters w and b from dictionary "parameters"
# w = ...
# b = ...

# Predict test/train set examples (≈ 2 lines of code)
# Y_prediction_test = ...
# Y_prediction_train = ...

A solution could thus be built with the following lines:

# YOUR CODE STARTS HERE
w, b = 
parameters, grads, costs =
w =
b =
Y_prediction_test =
Y_prediction_train =
# YOUR CODE ENDS HERE

In that case, there is no need to update or change inside

d = {"costs": costs,
     "Y_prediction_test": Y_prediction_test, 
     "Y_prediction_train" : Y_prediction_train, 
     "w" : w, 
     "b" : b,
     "learning_rate" : learning_rate,
     "num_iterations": num_iterations}

Is it any clearer now @Enrique and @thiyanesh?

As to how to make sure you have the latest version, I recommend you to follow the steps in