Hi I’ve completed up and through the model definition in Exercise 8, creating and passing the model() definition exercise, inclurding the model_test(model). However when I try to run the next line, “logistic_regression_model = model(…” I get an mismatch error on operands, captured below. I didn’t add any new lines and I guess a previous function was created incorrectly and somehow still passed the check. Any advice?
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)
26 # Gradient descent
27 # parameters, grads, costs = …
—> 28 params, grads, costs = optimize(w, b, X_train, Y_test, num_iterations, learning_rate, print_cost)
29 # Retrieve parameters w and b from dictionary “parameters”
30 # 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)
31 # print("w is shape " + str(w.shape))
32 A = sigmoid(np.dot(w.T, X) + b)
—> 33 cost = -1 / m * np.sum( Y * np.log(A) + (1-Y) * np.log(1-A))
34 # YOUR CODE ENDS HERE
35
ValueError: operands could not be broadcast together with shapes (1,50) (1,209)

