当前位置: 首页 > news >正文

中元建设集团网站镇江做网站多少钱

中元建设集团网站,镇江做网站多少钱,wordpress wp_redirect,如何更改网站关键词文章目录 [toc]数据集实际值估计值估计误差代价函数学习率参数更新Python实现导包数据预处理迭代过程数据可视化完整代码 线性拟合结果代价结果 个人主页#xff1a;丷从心 系列专栏#xff1a;机器学习 数据集 ( x ( i ) , y ( i ) ) , i 1 , 2 , ⋯ , m \left(x^{(i)} , … 文章目录 [toc]数据集实际值估计值估计误差代价函数学习率参数更新Python实现导包数据预处理迭代过程数据可视化完整代码 线性拟合结果代价结果 个人主页丷从心 系列专栏机器学习 数据集 ( x ( i ) , y ( i ) ) , i 1 , 2 , ⋯ , m \left(x^{(i)} , y^{(i)}\right) , i 1 , 2 , \cdots , m (x(i),y(i)),i1,2,⋯,m 实际值 y ( i ) y^{(i)} y(i) 估计值 h θ ( x ( i ) ) θ 0 θ 1 x ( i ) h_{\theta}\left(x^{(i)}\right) \theta_{0} \theta_{1} x^{(i)} hθ​(x(i))θ0​θ1​x(i) 估计误差 h θ ( x ( i ) ) − y ( i ) h_{\theta}\left(x^{(i)}\right) - y^{(i)} hθ​(x(i))−y(i) 代价函数 J ( θ ) J ( θ 0 , θ 1 ) 1 2 m ∑ i 1 m ( h θ ( x ( i ) ) − y ( i ) ) 2 1 2 m ∑ i 1 m ( θ 0 θ 1 x ( i ) − y ( i ) ) 2 J(\theta) J(\theta_{0} , \theta_{1}) \cfrac{1}{2m} \displaystyle\sum\limits_{i 1}^{m}{\left(h_{\theta}\left(x^{(i)}\right) - y^{(i)}\right)^{2}} \cfrac{1}{2m} \displaystyle\sum\limits_{i 1}^{m}{\left(\theta_{0} \theta_{1} x^{(i)} - y^{(i)}\right)^{2}} J(θ)J(θ0​,θ1​)2m1​i1∑m​(hθ​(x(i))−y(i))22m1​i1∑m​(θ0​θ1​x(i)−y(i))2 学习率 α \alpha α是学习率一个大于 0 0 0的很小的经验值决定代价函数下降的程度 参数更新 Δ θ j ∂ ∂ θ j J ( θ 0 , θ 1 ) \Delta{\theta_{j}} \cfrac{\partial}{\partial{\theta_{j}}} J(\theta_{0} , \theta_{1}) Δθj​∂θj​∂​J(θ0​,θ1​) θ j : θ j − α Δ θ j θ j − α ∂ ∂ θ j J ( θ 0 , θ 1 ) \theta_{j} : \theta_{j} - \alpha \Delta{\theta_{j}} \theta_{j} - \alpha \cfrac{\partial}{\partial{\theta_{j}}} J(\theta_{0} , \theta_{1}) θj​:θj​−αΔθj​θj​−α∂θj​∂​J(θ0​,θ1​) [ θ 0 θ 1 ] : [ θ 0 θ 1 ] − α [ ∂ J ( θ 0 , θ 1 ) ∂ θ 0 ∂ J ( θ 0 , θ 1 ) ∂ θ 1 ] \left[ \begin{matrix} \theta_{0} \\ \theta_{1} \end{matrix} \right] : \left[ \begin{matrix} \theta_{0} \\ \theta_{1} \end{matrix} \right] - \alpha \left[ \begin{matrix} \cfrac{\partial{J(\theta_{0} , \theta_{1})}}{\partial{\theta_{0}}} \\ \cfrac{\partial{J(\theta_{0} , \theta_{1})}}{\partial{\theta_{1}}} \end{matrix} \right] [θ0​θ1​​]:[θ0​θ1​​]−α ​∂θ0​∂J(θ0​,θ1​)​∂θ1​∂J(θ0​,θ1​)​​ ​ [ ∂ J ( θ 0 , θ 1 ) ∂ θ 0 ∂ J ( θ 0 , θ 1 ) ∂ θ 1 ] [ 1 m ∑ i 1 m ( h θ ( x ( i ) ) − y ( i ) ) 1 m ∑ i 1 m ( h θ ( x ( i ) ) − y ( i ) ) x ( i ) ] [ 1 m ∑ i 1 m e ( i ) 1 m ∑ i 1 m e ( i ) x ( i ) ] e ( i ) h θ ( x ( i ) ) − y ( i ) \left[ \begin{matrix} \cfrac{\partial{J(\theta_{0} , \theta_{1})}}{\partial{\theta_{0}}} \\ \cfrac{\partial{J(\theta_{0} , \theta_{1})}}{\partial{\theta_{1}}} \end{matrix} \right] \left[ \begin{matrix} \cfrac{1}{m} \displaystyle\sum\limits_{i 1}^{m}{\left(h_{\theta}\left(x^{(i)}\right) - y^{(i)}\right)} \\ \cfrac{1}{m} \displaystyle\sum\limits_{i 1}^{m}{\left(h_{\theta}\left(x^{(i)}\right) - y^{(i)}\right) x^{(i)}} \end{matrix} \right] \left[ \begin{matrix} \cfrac{1}{m} \displaystyle\sum\limits_{i 1}^{m}{e^{(i)}} \\ \cfrac{1}{m} \displaystyle\sum\limits_{i 1}^{m}{e^{(i)} x^{(i)}} \end{matrix} \right] \kern{2em} e^{(i)} h_{\theta}\left(x^{(i)}\right) - y^{(i)} ​∂θ0​∂J(θ0​,θ1​)​∂θ1​∂J(θ0​,θ1​)​​ ​ ​m1​i1∑m​(hθ​(x(i))−y(i))m1​i1∑m​(hθ​(x(i))−y(i))x(i)​ ​ ​m1​i1∑m​e(i)m1​i1∑m​e(i)x(i)​ ​e(i)hθ​(x(i))−y(i) [ ∂ J ( θ 0 , θ 1 ) ∂ θ 0 ∂ J ( θ 0 , θ 1 ) ∂ θ 1 ] [ 1 m ∑ i 1 m e ( i ) 1 m ∑ i 1 m e ( i ) x ( i ) ] [ 1 m ( e ( 1 ) e ( 2 ) ⋯ e ( m ) ) 1 m ( e ( 1 ) e ( 2 ) ⋯ e ( m ) ) x ( i ) ] 1 m [ 1 1 ⋯ 1 x ( 1 ) x ( 2 ) ⋯ x ( m ) ] [ e ( 1 ) e ( 2 ) ⋮ e ( m ) ] 1 m X T e 1 m X T ( X θ − y ) \begin{aligned} \left[ \begin{matrix} \cfrac{\partial{J(\theta_{0} , \theta_{1})}}{\partial{\theta_{0}}} \\ \cfrac{\partial{J(\theta_{0} , \theta_{1})}}{\partial{\theta_{1}}} \end{matrix} \right] \left[ \begin{matrix} \cfrac{1}{m} \displaystyle\sum\limits_{i 1}^{m}{e^{(i)}} \\ \cfrac{1}{m} \displaystyle\sum\limits_{i 1}^{m}{e^{(i)} x^{(i)}} \end{matrix} \right] \left[ \begin{matrix} \cfrac{1}{m} \left(e^{(1)} e^{(2)} \cdots e^{(m)}\right) \\ \cfrac{1}{m} \left(e^{(1)} e^{(2)} \cdots e^{(m)}\right) x^{(i)} \end{matrix} \right] \\ \cfrac{1}{m} \left[ \begin{matrix} 1 1 \cdots 1 \\ x^{(1)} x^{(2)} \cdots x^{(m)} \end{matrix} \right] \left[ \begin{matrix} e^{(1)} \\ e^{(2)} \\ \vdots \\ e^{(m)} \end{matrix} \right] \cfrac{1}{m} X^{T} e \cfrac{1}{m} X^{T} (X \theta - y) \end{aligned} ​∂θ0​∂J(θ0​,θ1​)​∂θ1​∂J(θ0​,θ1​)​​ ​​ ​m1​i1∑m​e(i)m1​i1∑m​e(i)x(i)​ ​ ​m1​(e(1)e(2)⋯e(m))m1​(e(1)e(2)⋯e(m))x(i)​ ​m1​[1x(1)​1x(2)​⋯⋯​1x(m)​] ​e(1)e(2)⋮e(m)​ ​m1​XTem1​XT(Xθ−y)​ 由上述推导得 Δ θ 1 m X T e \Delta{\theta} \cfrac{1}{m} X^{T} e Δθm1​XTe θ : θ − α Δ θ θ − α 1 m X T e \theta : \theta - \alpha \Delta{\theta} \theta - \alpha \cfrac{1}{m} X^{T} e θ:θ−αΔθθ−αm1​XTe Python实现 导包 import numpy as np import matplotlib.pyplot as plt数据预处理 x np.array([4, 3, 3, 4, 2, 2, 0, 1, 2, 5, 1, 2, 5, 1, 3]) y np.array([8, 6, 6, 7, 4, 4, 2, 4, 5, 9, 3, 4, 8, 3, 6])m len(x)x np.c_[np.ones([m, 1]), x] y y.reshape(m, 1) theta np.zeros([2, 1])迭代过程 alpha 0.01 iter_cnt 1000 # 迭代次数 cost np.zeros([iter_cnt]) # 代价数据for i in range(iter_cnt):h x.dot(theta) # 估计值error h - y # 误差值cost[i] 1 / (2 * m) * error.T.dot(error) # 代价值# 更新参数delta_theta 1 / m * x.T.dot(error)theta - alpha * delta_theta数据可视化 # 回归结果 plt.scatter(x[:, 1], y, cblue) plt.plot(x[:, 1], h, r-) plt.show()# 代价结果 plt.plot(cost) plt.show()完整代码 import numpy as np import matplotlib.pyplot as pltx np.array([4, 3, 3, 4, 2, 2, 0, 1, 2, 5, 1, 2, 5, 1, 3]) y np.array([8, 6, 6, 7, 4, 4, 2, 4, 5, 9, 3, 4, 8, 3, 6])m len(x)x np.c_[np.ones([m, 1]), x] y y.reshape(m, 1) theta np.zeros([2, 1])alpha 0.01 iter_cnt 1000 # 迭代次数 cost np.zeros([iter_cnt]) # 代价数据for i in range(iter_cnt):h x.dot(theta) # 估计值error h - y # 误差值cost[i] 1 / (2 * m) * error.T.dot(error) # 代价值# 更新参数delta_theta 1 / m * x.T.dot(error)theta - alpha * delta_theta# 线性拟合结果 plt.scatter(x[:, 1], y, cblue) plt.plot(x[:, 1], h, r-) plt.show()# 代价结果 plt.plot(cost) plt.show()线性拟合结果 代价结果
http://www.dnsts.com.cn/news/223208.html

相关文章:

  • 网站开发费用怎么做账肇庆制作企业网站
  • 网站开发结语企业开发网站用什么技术
  • 物业公司网站建设做面食专业网站
  • 网站建设制作文案网站响应方案
  • 婚恋网站建设成本彩票网站开发有连带
  • 网站做定向的作用佛山网站哪家最专业
  • 做网站的时候字体应该多大世界著名办公室设计
  • 北京的做网站的公司大名网站建设
  • 网站建设公司豆瓣nofollow标签对网站收录的影响
  • wordpress 全站不刷新洪山网站建设
  • 杭州网站开发公司排名龙华网站建设哪家公司好
  • 国外有什么网站是做服装的网站关键词几个最好
  • 慧聪网官方网站标志设计公司成都
  • 婚纱摄影网站源码下载企业网站建设渠道
  • 临湘网站设计公司做网站有用吗
  • 云南百度小程序开发平台seo什么意思
  • 专业做域名的网站吗海南e登记app官网下载
  • 网页游戏网站平台防控政策优化
  • php语言的网站建设电脑软件制作入门教程
  • 电子商务网站建设摘要旅游中山公司网站建设
  • 哪里做网站优化做网站编辑大专可以吗
  • 酒店类网站开发的策略手写签名设计免费版在线
  • 网站开发团队人数构成分析建设网站的可行性
  • 搭建什么网站好简单的企业网站的主页
  • 罗湖高端网站建设费用百度seo怎么样优化
  • 局域网视频网站开发wordpress网站部署
  • 建立网站纯文字版本主流的net快速开发框架
  • 网站建设需要的职位建设银行注册网站的用户名怎么写
  • 网站设置桌面快捷方式免费素材网站视频
  • 邢台提供网站建设公司报价浏览器大全列表下载