吴恩达逻辑回归课后编程作业错误,在将所有函数整合到一起的时候出错,提示是矩阵维度的问题? 之前所有的步骤的结果都可以和答案相同呀,有大神帮忙看一下吗 感激不信
ValueError Traceback (most recent call last)
in ()
—-> 1 d = 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)
24
25 # Gradient descent (≈ 1 line of code)
—> 26 parameters, grads, costs =optimize(w, b, X_train, Y_train, num_iterations, learning_rate, print_cost)
27
28 # Retrieve parameters w and b from dictionary “parameters”
in optimize(w, b, X, Y, num_iterations, learning_rate, print_cost)
32 # Cost and gradient calculation (≈ 1-4 lines of code)
33 ### START CODE HERE ###
—> 34 grads, cost = propagate(w,b,X,Y)
35 ### END CODE HERE ###
36
in propagate(w, b, X, Y)
24 # FORWARD PROPAGATION (FROM X TO COST)
25 ### START CODE HERE ### (≈ 2 lines of code)
—> 26 A = sigmoid(np.dot(w.T,X)+b) # compute activation
27 cost = -(1/m)*np.sum(Y*np.log(A)+(1-Y)*np.log(1-A)) # compute cost
28 ### END CODE HERE ###
ValueError: shapes (1,209) and (209,64,64,3) not aligned: 209 (dim 1) != 64 (dim 2)