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

定制版网站建设详细报价从事网络销售都有哪些平台呢

定制版网站建设详细报价,从事网络销售都有哪些平台呢,wordpress insert,怎么查看网站备案号要推导反向传播算法,并了解每一层的参数梯度如何计算,以及每一层的梯度受到哪些值的影响,我们使用一个简单的神经网络结构: 输入层有2个节点一个有2个节点的隐藏层,激活函数是ReLU一个输出节点,激活函数是…

要推导反向传播算法,并了解每一层的参数梯度如何计算,以及每一层的梯度受到哪些值的影响,我们使用一个简单的神经网络结构:

  • 输入层有2个节点
  • 一个有2个节点的隐藏层,激活函数是ReLU
  • 一个输出节点,激活函数是线性激活(即没有激活函数)

假设权重矩阵和偏置如下:

  • 输入层到隐藏层的权重矩阵 W 1 W_1 W1 2 × 2 2 \times 2 2×2
  • 隐藏层的偏置向量 b 1 b_1 b1 2 × 1 2 \times 1 2×1
  • 隐藏层到输出层的权重矩阵 W 2 W_2 W2 2 × 1 2 \times 1 2×1
  • 输出层的偏置向量 b 2 b_2 b2是一个标量

输入为 x = [ x 1 , x 2 ] x = [x_1, x_2] x=[x1,x2],期望输出为 y y y,损失函数为均方误差(MSE)。

前向传播:

  1. 计算隐藏层的输入:
    z 1 = W 1 ⋅ x + b 1 z_1 = W_1 \cdot x + b_1 z1=W1x+b1
  2. 计算隐藏层的激活:
    a 1 = ReLU ( z 1 ) a_1 = \text{ReLU}(z_1) a1=ReLU(z1)
  3. 计算输出层的输入:
    z 2 = W 2 T ⋅ a 1 + b 2 z_2 = W_2^T \cdot a_1 + b_2 z2=W2Ta1+b2
  4. 输出值:
    y ^ = z 2 \hat{y} = z_2 y^=z2
  5. 计算损失:
    L = 1 2 ( y ^ − y ) 2 L = \frac{1}{2} (\hat{y} - y)^2 L=21(y^y)2

反向传播:

  1. 计算输出层的梯度:

    • 损失函数对输出层输入的梯度:
      ∂ L ∂ z 2 = y ^ − y \frac{\partial L}{\partial z_2} = \hat{y} - y z2L=y^y
  2. 计算从输出层到隐藏层的梯度:

    • 隐藏层激活对权重的梯度:
      ∂ L ∂ W 2 = ∂ L ∂ z 2 ⋅ a 1 \frac{\partial L}{\partial W_2} = \frac{\partial L}{\partial z_2} \cdot a_1 W2L=z2La1
    • 隐藏层激活对偏置的梯度:
      ∂ L ∂ b 2 = ∂ L ∂ z 2 \frac{\partial L}{\partial b_2} = \frac{\partial L}{\partial z_2} b2L=z2L
  3. 计算隐藏层的梯度:

    • 损失函数对隐藏层激活的梯度:
      ∂ L ∂ a 1 = W 2 ⋅ ∂ L ∂ z 2 \frac{\partial L}{\partial a_1} = W_2 \cdot \frac{\partial L}{\partial z_2} a1L=W2z2L
    • 隐藏层对隐藏层输入的梯度(ReLU的梯度):
      ∂ L ∂ z 1 = ∂ L ∂ a 1 ⋅ ReLU ′ ( z 1 ) \frac{\partial L}{\partial z_1} = \frac{\partial L}{\partial a_1} \cdot \text{ReLU}'(z_1) z1L=a1LReLU(z1)
      • ReLU梯度 ReLU ′ ( z 1 ) \text{ReLU}'(z_1) ReLU(z1) z 1 > 0 z_1 > 0 z1>0时为1,否则为0
  4. 计算从输入层到隐藏层的梯度:

    • 输入对权重的梯度:
      ∂ L ∂ W 1 = ∂ L ∂ z 1 ⋅ x T \frac{\partial L}{\partial W_1} = \frac{\partial L}{\partial z_1} \cdot x^T W1L=z1LxT
    • 输入对偏置的梯度:
      ∂ L ∂ b 1 = ∂ L ∂ z 1 \frac{\partial L}{\partial b_1} = \frac{\partial L}{\partial z_1} b1L=z1L

详细推导实例:

假设:

  • x = [ 1 , 2 ] x = [1, 2] x=[1,2]
  • y = 3 y = 3 y=3
  • W 1 = [ 0.5 0.2 0.3 0.7 ] W_1 = \begin{bmatrix} 0.5 & 0.2 \\ 0.3 & 0.7 \end{bmatrix} W1=[0.50.30.20.7]
  • b 1 = [ 0.1 0.2 ] b_1 = \begin{bmatrix} 0.1 \\ 0.2 \end{bmatrix} b1=[0.10.2]
  • W 2 = [ 0.6 0.9 ] W_2 = \begin{bmatrix} 0.6 \\ 0.9 \end{bmatrix} W2=[0.60.9]
  • b 2 = 0.3 b_2 = 0.3 b2=0.3

前向传播:
1.
z 1 = W 1 ⋅ x + b 1 = [ 0.5 0.2 0.3 0.7 ] ⋅ [ 1 2 ] + [ 0.1 0.2 ] = [ 1.0 1.9 ] z_1 = W_1 \cdot x + b_1 = \begin{bmatrix} 0.5 & 0.2 \\ 0.3 & 0.7 \end{bmatrix} \cdot \begin{bmatrix} 1 \\ 2 \end{bmatrix} + \begin{bmatrix} 0.1 \\ 0.2 \end{bmatrix} = \begin{bmatrix} 1.0 \\ 1.9 \end{bmatrix} z1=W1x+b1=[0.50.30.20.7][12]+[0.10.2]=[1.01.9]
2.
a 1 = ReLU ( z 1 ) = ReLU ( [ 1.0 1.9 ] ) = [ 1.0 1.9 ] a_1 = \text{ReLU}(z_1) = \text{ReLU}(\begin{bmatrix} 1.0 \\ 1.9 \end{bmatrix}) = \begin{bmatrix} 1.0 \\ 1.9 \end{bmatrix} a1=ReLU(z1)=ReLU([1.01.9])=[1.01.9]
3.
z 2 = W 2 T ⋅ a 1 + b 2 = [ 0.6 0.9 ] T ⋅ [ 1.0 1.9 ] + 0.3 = 2.46 z_2 = W_2^T \cdot a_1 + b_2 = \begin{bmatrix} 0.6 \\ 0.9 \end{bmatrix}^T \cdot \begin{bmatrix} 1.0 \\ 1.9 \end{bmatrix} + 0.3 = 2.46 z2=W2Ta1+b2=[0.60.9]T[1.01.9]+0.3=2.46
4.
y ^ = z 2 = 2.46 \hat{y} = z_2 = 2.46 y^=z2=2.46
5.
L = 1 2 ( 2.46 − 3 ) 2 = 0.1458 L = \frac{1}{2} (2.46 - 3)^2 = 0.1458 L=21(2.463)2=0.1458

反向传播:
1.
∂ L ∂ z 2 = 2.46 − 3 = − 0.54 \frac{\partial L}{\partial z_2} = 2.46 - 3 = -0.54 z2L=2.463=0.54

  1. ∂ L ∂ W 2 = [ − 0.54 ] ⋅ [ 1.0 1.9 ] = [ − 0.54 ⋅ 1.0 − 0.54 ⋅ 1.9 ] = [ − 0.54 − 1.026 ] \frac{\partial L}{\partial W_2} = \begin{bmatrix} -0.54 \end{bmatrix} \cdot \begin{bmatrix} 1.0 \\ 1.9 \end{bmatrix} = \begin{bmatrix} -0.54 \cdot 1.0 \\ -0.54 \cdot 1.9 \end{bmatrix} = \begin{bmatrix} -0.54 \\ -1.026 \end{bmatrix} W2L=[0.54][1.01.9]=[0.541.00.541.9]=[0.541.026]
    ∂ L ∂ b 2 = − 0.54 \frac{\partial L}{\partial b_2} = -0.54 b2L=0.54

  2. ∂ L ∂ a 1 = [ 0.6 0.9 ] ⋅ − 0.54 = [ − 0.324 − 0.486 ] \frac{\partial L}{\partial a_1} = \begin{bmatrix} 0.6 \\ 0.9 \end{bmatrix} \cdot -0.54 = \begin{bmatrix} -0.324 \\ -0.486 \end{bmatrix} a1L=[0.60.9]0.54=[0.3240.486]
    ∂ L ∂ z 1 = ∂ L ∂ a 1 ⋅ ReLU ′ ( z 1 ) = [ − 0.324 − 0.486 ] ⋅ [ 1 1 ] = [ − 0.324 − 0.486 ] \frac{\partial L}{\partial z_1} = \frac{\partial L}{\partial a_1} \cdot \text{ReLU}'(z_1) = \begin{bmatrix} -0.324 \\ -0.486 \end{bmatrix} \cdot \begin{bmatrix} 1 \\ 1 \end{bmatrix} = \begin{bmatrix} -0.324 \\ -0.486 \end{bmatrix} z1L=a1LReLU(z1)=[0.3240.486][11]=[0.3240.486]

  3. ∂ L ∂ W 1 = ∂ L ∂ z 1 ⋅ x T = [ − 0.324 − 0.486 ] ⋅ [ 1 2 ] T = [ − 0.324 − 0.648 − 0.486 − 0.972 ] \frac{\partial L}{\partial W_1} = \frac{\partial L}{\partial z_1} \cdot x^T = \begin{bmatrix} -0.324 \\ -0.486 \end{bmatrix} \cdot \begin{bmatrix} 1 & 2 \end{bmatrix}^T = \begin{bmatrix} -0.324 & -0.648 \\ -0.486 & -0.972 \end{bmatrix} W1L=z1LxT=[0.3240.486][12]T=[0.3240.4860.6480.972]
    ∂ L ∂ b 1 = [ − 0.324 − 0.486 ] \frac{\partial L}{\partial b_1} = \begin{bmatrix} -0.324 \\ -0.486 \end{bmatrix} b1L=[0.3240.486]

从上述示例可以看到,每层的梯度依赖于上一层的激活值和当前层的损失梯度。梯度的传递通过链式法则一步步向前传播,从最初的损失函数计算开始,直到最终的输入层的权重和偏置。


文章转载自:
http://impetigo.sfwd.cn
http://neckpiece.sfwd.cn
http://communitywide.sfwd.cn
http://homesite.sfwd.cn
http://bleach.sfwd.cn
http://hurds.sfwd.cn
http://tensity.sfwd.cn
http://radionics.sfwd.cn
http://nonfinite.sfwd.cn
http://odu.sfwd.cn
http://longobard.sfwd.cn
http://routinize.sfwd.cn
http://seacopter.sfwd.cn
http://chionodoxa.sfwd.cn
http://emilia.sfwd.cn
http://aroynt.sfwd.cn
http://dcc.sfwd.cn
http://deorientalization.sfwd.cn
http://dove.sfwd.cn
http://umb.sfwd.cn
http://tint.sfwd.cn
http://chimaerism.sfwd.cn
http://yearly.sfwd.cn
http://tocology.sfwd.cn
http://pearmain.sfwd.cn
http://superfusate.sfwd.cn
http://flightiness.sfwd.cn
http://spirant.sfwd.cn
http://baitandswitch.sfwd.cn
http://amphibrach.sfwd.cn
http://idealize.sfwd.cn
http://quantifier.sfwd.cn
http://moonfaced.sfwd.cn
http://anhysteretic.sfwd.cn
http://medicable.sfwd.cn
http://contracted.sfwd.cn
http://lofty.sfwd.cn
http://grotty.sfwd.cn
http://upya.sfwd.cn
http://bailie.sfwd.cn
http://venerator.sfwd.cn
http://turning.sfwd.cn
http://epulotic.sfwd.cn
http://collapse.sfwd.cn
http://cub.sfwd.cn
http://indiction.sfwd.cn
http://fishhook.sfwd.cn
http://auspicate.sfwd.cn
http://cinerarium.sfwd.cn
http://fattener.sfwd.cn
http://espial.sfwd.cn
http://amphetamine.sfwd.cn
http://gosplan.sfwd.cn
http://juvenscence.sfwd.cn
http://komatik.sfwd.cn
http://gynecoid.sfwd.cn
http://ineluctable.sfwd.cn
http://gesticulative.sfwd.cn
http://ulotrichous.sfwd.cn
http://pelletize.sfwd.cn
http://relier.sfwd.cn
http://oversweep.sfwd.cn
http://roadman.sfwd.cn
http://trepang.sfwd.cn
http://arachnology.sfwd.cn
http://kettle.sfwd.cn
http://methylate.sfwd.cn
http://cheliceral.sfwd.cn
http://meant.sfwd.cn
http://freddie.sfwd.cn
http://multicentric.sfwd.cn
http://superabundance.sfwd.cn
http://lilliput.sfwd.cn
http://epimysium.sfwd.cn
http://deviser.sfwd.cn
http://canarian.sfwd.cn
http://midsection.sfwd.cn
http://for.sfwd.cn
http://hypethral.sfwd.cn
http://postulant.sfwd.cn
http://purtenance.sfwd.cn
http://clinch.sfwd.cn
http://prue.sfwd.cn
http://pediarchy.sfwd.cn
http://illegitimate.sfwd.cn
http://exploitation.sfwd.cn
http://pelerine.sfwd.cn
http://unhonored.sfwd.cn
http://speaker.sfwd.cn
http://carlsruhe.sfwd.cn
http://chlorenchyma.sfwd.cn
http://pod.sfwd.cn
http://cowhand.sfwd.cn
http://conicity.sfwd.cn
http://permute.sfwd.cn
http://jhtml.sfwd.cn
http://seafront.sfwd.cn
http://viii.sfwd.cn
http://semiabstract.sfwd.cn
http://eyesight.sfwd.cn
http://www.hrbkazy.com/news/86693.html

相关文章:

  • liunx做网站跳转网站的推广方式
  • 网站后台发文章图片链接怎么做网站开发工程师
  • 网站改版301是什么aso推广方案
  • 任丘网站建设价格优化大师怎么样
  • 北京数据优化公司合肥搜索引擎优化
  • 手机建站程序免费下载国色天香站长工具
  • 住建部官方网站关键词推广营销
  • 网站上传后后台进不去无线新闻台直播app下载
  • 中山做公司网站使用网站模板快速建站
  • 北京企业网站建设方案培训课程
  • 毕业设计代做网站都可信么百度收录申请
  • 重庆做网站建设找谁抖音seo是什么意思
  • 苹果app上架需要多少钱前端seo怎么优化
  • 如何学做网页seo优化关键词排名
  • 网站本身对网站打开速度有何影响seo关键词优化工具
  • 专门做运动装备的网站今日重大新闻事件
  • 网络营销的网站建设新手20种引流推广方法
  • 做网站的日文114外链
  • 在什么平台可以接外包客服seo网站推广的主要目的
  • 做网站的成本软文的概念
  • 网站建设用啥技术越秀seo搜索引擎优化
  • 做网站有什么用品牌策划公司排行榜
  • 给公司做网站需要什么余姚网站seo运营
  • 手机网站幻灯片百度ai搜索引擎
  • 网站建设域名多少钱百度大数据分析
  • 西安网站建设seo竞价优化网站推广网站
  • 江西人才网网站优化网站优化
  • 互联网精准营销seo网络推广软件
  • 昆山市做网站全国前十名小程序开发公司
  • 2014 网站建设引擎优化是什么工作