My all test before this passes successfully. but for 5.2 section I am getting the below error. If really there is an error in computing cost, so why the earlier cases were passed?
I am getting the below error while testing:
ValueError Traceback (most recent call last)
in
1 # Build a model with a n_h-dimensional hidden layer
----> 2 parameters = nn_model(X, Y, n_h = 4, num_iterations = 10000, print_cost=True)
3 print(parameters)
4 # Plot the decision boundary
5 plot_decision_boundary(lambda x: predict(parameters, x.T), X, Y)
in nn_model(X, Y, n_h, num_iterations, print_cost)
45 # YOUR CODE STARTS HERE
46 A2, cache = forward_propagation(t_X, parameters)
—> 47 cost = compute_cost(A2, Y)
48 grads = backward_propagation(parameters, cache, X, Y)
49 parameters = update_parameters(parameters, grads)
in compute_cost(A2, Y)
24 #cost = - np.sum(logprobs)
25 #cost = np.dot(np.log(A2),Y.T)
—> 26 cost = -np.sum( np.dot(Y, np.log(A2.T)) + np.dot(1-Y, np.log(1-A2.T)) )/m
27 # YOUR CODE ENDS HERE
28 print(cost)
<array_function internals> in dot(*args, **kwargs)
ValueError: shapes (1,400) and (3,1) not aligned: 400 (dim 1) != 3 (dim 0)