吴恩达逻辑回归课后编程作业错误

吴恩达逻辑回归课后编程作业错误,在将所有函数整合到一起的时候出错,提示是矩阵维度的问题? 之前所有的步骤的结果都可以和答案相同呀,有大神帮忙看一下吗 感激不信

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)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值