Hi, after I passed all tests and moved to exercise 8, I always got
AssertionError: Wrong values for d[‘w’]. [[ 0.14449502]
[-0.1429235 ]
[-0.19867517]
[ 0.21265053]] != [[ 0.08639757]
[-0.08231268]
[-0.11798927]
[ 0.12866053]]
but I can’t find where did I mistake. This is my code for model function
params, grads, costs = optimize(w, b, X_train, Y_train)
I don’t think my optimize() is incorrect, so I checked propagate() and here is my code.
[deleted]
Welcome to the community !
Please set appropriate parameters to call optimize() function in model(). It takes “num_iterations,”, “learning_rate” and “print_cost” in addition to what you specified.
As you see, most of functions have “default” values. A test program may set “default” values at first, then, tends to use different ones to check whether the function is implemented properly or not.
By the way, in this community, pasting any code is not recommended. Could you please remove those ? Thank you.
I used parameters of model num_iterations=2000, learning_rate=0.5 and got error due to size of cost. Otherwise it should be 100 iterations, so it’s basically default of optimize() (changing LR 0.5 to 0.009 stills not work).
Those parameters are passed from a caller when model() is called. Those are not what you set.
def model(X_train, Y_train, X_test, Y_test, num_iterations=2000, learning_rate=0.5, print_cost=False):
Just for clarifications of arguments for model().
You see some default values in here. For example, “learning_rate=0.5”. This is to set “learning_rate” if a caller did not set any. What you are expected is just passing given parameters to optimize() function, just like you did for X_train and so on.
I had this exact same problem.
Thank you very much.