I think I have them all… grads, cost = propagate(w, b, X, Y), I also removed everything marked in pink. new error ypeError Traceback (most recent call last)
in
1 from public_tests import *
2
----> 3 model_test(model)
~/work/release/W2A2/public_tests.py in model_test(target)
123 y_test = np.array([[0, 1, 0]])
124
→ 125 d = target(X, Y, x_test, y_test, num_iterations=50, learning_rate=0.01)
126
127 assert type(d[‘costs’]) == list, f"Wrong type for d[‘costs’]. {type(d[‘costs’])} != list"
in model(X_train, Y_train, X_test, Y_test, num_iterations, learning_rate, print_cost)
36 # YOUR CODE STARTS HERE
37 w, b = initialize_with_zeros(X_train.shape[0])
—> 38 params, grads, costs = optimize(num_iterations, learning_rate, print_cost)
39 Y_prediction_test = predict(w, b, X_test)
40 Y_prediction_train = predict(w, b, X_train)
I recommend you look at the function definition for optimize() - it is the first line in the cell that has the function - and look at the order of the arguments.
So, you are working on Ex. 6: optimize.
You can see from Ex. 5 that propagate function can take only 4 arguments. So, you have to pass only 4 arguments.
Previously, you shared an error from Ex. 8 where you have to call the optimize function which can take 7 arguments, and that is what Tom mentioned.
So in Ex. 6 I have propagate written now with only four arguments (w, b, X, Y)
and in Ex. 8 I have optimize written with seven positional arguments as written above. But I still get an assertion error regarding w.
I am, and I have read through all 10,000 threads regarding the topic. I just don’t understand how to access the true parameters versus the default parameters. I’m also not sure that I haven’t committed a hardcode error.
To access the default value of the model function to the optimize function, you just don’t pass that argument to the optimize function. And if you pass like learning_rate = 0.1, this is hard coding.
So, you don’t have to pass default and hard-coded.
Understood, so I removed any numerical value associated with the keyword arguments. The error still persists,
I think I am not extracting the returned values from the dictionary, after the call to initialize_with_zeros, and I’m not sure how I would precede in doing so.
Did you read the template code that they gave you which creates the return values from the function?
But the higher level conclusion here is that the best course of action might be to put this course on hold and go take an “intro to python” course first. This course assumes you already know python.