Deep Neural Networks - Forward Propagation in a Deep Network


Take a deep NN in figure-1 as an example,

Figure-1

  •  For a single training example x

z^{[l]}=W^{[l]}a^{[l-1]}+b^{[l]}

a^{[l]}=g^{[l]}(z^{[l]})

Note the dimensions of these variables:

\\z^{[l]}\in n^{[l]}\times 1 \\a^{[l]}\in n^{[l]}\times 1 \\W^{[l]}\in n^{[l]}\times n^{[l-1]} \\a^{[l-1]}\in n^{[l-1]}\times 1\\b^{[l]}\in n^{[l]}\times 1

Concretely,

z^{[1]}=W^{[1]}a^{[0]}+b^{[1]}\\=W^{[1]}x+b^{[1]}

a^{[1]}=g^{[1]}(z^{[1]})

z^{[2]}=W^{[2]}a^{[1]}+b^{[2]}

a^{[2]}=g^{[2]}(z^{[2]})

z^{[3]}=W^{[3]}a^{[2]}+b^{[3]}

a^{[3]}=g^{[3]}(z^{[3]})

z^{[4]}=W^{[4]}a^{[3]}+b^{[4]}

a^{[4]}=g^{[4]}(z^{[4]})=\hat{y}

  • For multiple (m) training examples.

Z^{[l]}=W^{[l]}A^{[l-1]}+b^{[l]}

A^{[l]}=g^{[l]}(Z^{[l]})

Note the dimentions of these variables:

\\Z^{[l]}\in n^{[l]}\times m \\A^{[l]}\in n^{[l]}\times m \\W^{[l]}\in n^{[l]}\times n^{[l-1]} \\A^{[l-1]}\in n^{[l-1]}\times m\\b^{[l]}\in n^{[l]}\times 1

b^{[l]} will be duplicated to n^{[l]}\times m in NumPy automatically through Python broadcasting.

Concretely,

Z^{[1]}=W^{[1]}A[0]+b^{[1]}\\= W^{[1]}X+b^{[1]}

A^{[1]}=g^{[1]}(Z^{[1]})

Z^{[2]}=W^{[2]}A[1]+b^{[2]}

A^{[2]}=g^{[2]}(Z^{[2]})

Z^{[3]}=W^{[3]}A^{[2]}+b^{[3]}

A^{[3]}=g^{[3]}(Z^{[3]})

Z^{[4]}=W^{[4]}A^{[3]}+b^{[4]}

A^{[4]}=g^{[4]}(Z^{[4]})=\hat{Y}

Note that we're using capital X, Z, A now which are all stacking values of m training examples together in columes. For example, here X looks like:

Figure-2

 <end>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值