My code passed all tests in exercises 1 -8, including “model_test(model)” but after that the running the cell:
logistic_regression_model = model(train_set_x, train_set_y, test_set_x, test_set_y, num_iterations=2000, learning_rate=0.005, print_cost=True)
shows a message:
ValueError Traceback (most recent call last)
in
----> 1 logistic_regression_model = model(train_set_x, train_set_y, test_set_x, test_set_y, num_iterations=2000, learning_rate=0.005, print_cost=True)
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[0])
39
—> 40 params, grads, costs = optimize(w, b, X_train, Y_test, num_iterations, learning_rate, print_cost=False)
41
42 w = params[“w”]
in optimize(w, b, X, Y, num_iterations, learning_rate, print_cost)
36 # YOUR CODE STARTS HERE
37
—> 38 grads, cost = propagate(w, b, X, Y)
39
40 # YOUR CODE ENDS HERE
in propagate(w, b, X, Y)
31
32 A = 1/(1+np.exp(-(np.dot(w.T,X)+b)))
—> 33 cost = - np.sum(Y * np.log(A) + (1-Y) * np.log(1-A)) / m
34
35 # YOUR CODE ENDS HERE
ValueError: operands could not be broadcast together with shapes (1,50) (1,209)