I changed it to dimension of w,
w,b=initialize_with_zeros(X_train.shape[1])
But got the same error
ValueError Traceback (most recent call last)
in
----> 1 model_test(model)
~/work/release/W2A2/public_tests.py in model_test(target)
109 y_test = np.array([1, 0, 1])
110
→ 111 d = target(X, Y, x_test, y_test, num_iterations=50, learning_rate=1e-4)
112
113 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)
38 w,b=initialize_with_zeros(X_train.shape[1])
39
—> 40 parameters, grads, costs =optimize(w, b, X_train, Y_train, num_iterations, learning_rate, print_cost)
41
42 w=params[“w”]
in optimize(w, b, X, Y, num_iterations, learning_rate, print_cost)
35 # grads, cost = …
36 # YOUR CODE STARTS HERE
—> 37 grads, cost = propagate(w, b, X, Y)
38
39 # YOUR CODE ENDS HERE
in propagate(w, b, X, Y)
29 # cost = …
30 # YOUR CODE STARTS HERE
—> 31 A=sigmoid(np.dot(w.T,X)+b)
32 cost=-1/m*np.sum((np.dot(np.log(A),Y.T),(np.dot(np.log(1-A),(1-Y).T))))
33 # YOUR CODE ENDS HERE
<array_function internals> in dot(*args, **kwargs)
ValueError: shapes (1,3) and (4,3) not aligned: 3 (dim 1) != 4 (dim 0)