python - Andrew Ng 的 ML 课程(在 python 中)- 对多个变量应用梯度下降,对直觉感到困惑
问题描述
我正在尝试创建具有多个变量的梯度下降方程。方程图片: https ://www.holehouse.org/mlclass/04_Linear_Regression_with_multiple_variables_files/Image%20[3].png
最终解决方案是:
theta = theta - alpha *((np.dot((np.dot(X,theta)-y), X))*(1/m)).
我通过添加额外的“np.sum”犯了一个错误:
theta = theta - alpha *((`np.sum`(((np.dot((np.dot(X,theta)-y), X))*(1/m))))*(1/m))
我很困惑为什么解决方案不需要np.sum
求和,或者求和何时发生?
解决方案
推荐阅读
- spring - 将多个参数(对象)从角度传递到弹簧/休眠状态
- javascript - SocketIO 发出函数记录但无法正常工作
- ios - Flutter ios一启动就崩溃
- sparql - 带有标签的 Wikidata SPARQL 查询不起作用
- android - Android - 工具栏 - 更改按钮顺序
- android - 在按钮单击Android的片段中隐藏菜单项
- unit-testing - 忽略大小写的 MSTest V2 集合断言
- pagespeed - 如何避免 Google Ads 降低我的网站速度(尤其是移动网站)?
- python - 使用 imageio 制作 gif 时的图像顺序
- build - 构建解决方案将大量系统程序集复制到输出目录