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

怎么给网站做超链接网站原型设计和版式设计

怎么给网站做超链接,网站原型设计和版式设计,贵阳网站开发,做旅游网站怎么样文章目录 [toc]数据数据集实际值估计值 梯度下降算法估计误差代价函数学习率参数更新 Python实现导包数据预处理迭代过程结果可视化完整代码 结果可视化线性拟合结果代价变化 数据 数据集 ( x ( i ) , y ( i ) ) , i 1 , 2 , ⋯ , m \left(x^{(i)} , y^{(i)}\right) , i 1 ,… 文章目录 [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​) $$ \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] $$ [ ∂ 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 ) x ( 1 ) e ( 2 ) x ( 2 ) ⋯ e ( m ) x ( m ) ) ] 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)} x^{(1)} e^{(2)} x^{(2)} \cdots e^{(m)} x^{(m)}\right) \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)x(1)e(2)x(2)⋯e(m)x(m))​ ​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)迭代过程 alpha 0.01 # 学习率 iter_cnt 1000 # 迭代次数 cost np.zeros(iter_cnt) # 代价数据 theta np.zeros((2, 1))for i in range(iter_cnt):h x.dot(theta) # 估计值error h - y # 误差值cost[i] 1 / (2 * m) * error.T.dot(error) # 代价值# cost[i] 1 / (2 * m) * np.sum(np.square(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.savefig(../pic/fit.png) plt.show()# 代价结果 plt.plot(cost) plt.savefig(../pic/cost.png) 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)alpha 0.01 # 学习率 iter_cnt 1000 # 迭代次数 cost np.zeros(iter_cnt) # 代价数据 theta np.zeros((2, 1))for i in range(iter_cnt):h x.dot(theta) # 估计值error h - y # 误差值cost[i] 1 / (2 * m) * error.T.dot(error) # 代价值# cost[i] 1 / (2 * m) * np.sum(np.square(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.savefig(../pic/fit.png) plt.show()# 代价结果 plt.plot(cost) plt.savefig(../pic/cost.png) plt.show()结果可视化 线性拟合结果 代价变化
http://www.hkea.cn/news/14529627/

相关文章:

  • 网站建设东莞长安镇百度网站源码优化检测
  • 数码产品在哪里做网站广东高端网站设计公司价格
  • 怎么做网站流量统计分析免费ppt模板 网站开发
  • 个人做外贸网站平台有哪些物流公司 网站模板
  • 外贸网站建设大概多少钱下载百度2023最新版
  • 柴沟堡做网站一个网站的制作步骤
  • 网站栏目建设评活动个人网站搭建wordpress
  • 网站交易平台中小学网站建设建议
  • 大学生做网站赚钱硬件开发是什么专业
  • 网站app 开发网站建设实训心得体会
  • 杭州专业的网站制作公司网站关键词分析
  • 建筑设计资料网站centos启动wordpress
  • 汽车租赁网站设计wordpress固定链接404 nginx
  • 怎么做网站生意企业如何网络推广
  • 书籍封面设计网站网站做可信认证多少钱
  • 自己做网站可以赚钱么墨鱼网站建设
  • 网站推广seo北京网站建设推广
  • 旅游做的视频网站做淘宝客找商品网站有哪些
  • 网站开发设计思想工业和信息化部网站备案系统是什么
  • 网站 备案 固话成都响应式网站
  • 做社区网站怎么做网页设计与制作实验报告心得体会
  • 深圳网站建设推广方案品牌建设与管理
  • 网站建设谢词网站搭建三部曲是什么?
  • 绥化市建设工程网站招投标设计招聘网站
  • 中山做网站的大公司WordPress发图册
  • 西城专业网站建设公司wordpress个人博客主题模板中文
  • 当阳建设中学网站查域名
  • 单页面 网站怎么做的wordpress接erp
  • 拿品牌做网站算侵权吗seo最新技巧
  • 中台网站开发wordpress ie8