DeepLearning.ai深度学习课程笔记
More
Search
Ctrl + K
4.2 前向传播和反向传播(Forward and backward propagation)
正向传播过程
z
[
l
]
=
W
[
l
]
a
[
l
−
1
]
+
b
[
l
]
z^{[l]}=W^{[l]}a^{[l-1]}+b^{[l]}
z
[
l
]
=
W
[
l
]
a
[
l
−
1
]
+
b
[
l
]
a
[
l
]
=
g
[
l
]
(
z
[
l
]
)
a^{[l]}=g^{[l]}(z^{[l]})
a
[
l
]
=
g
[
l
]
(
z
[
l
]
)
m
m
m
个训练样本,向量化形式为:
Z
[
l
]
=
W
[
l
]
A
[
l
−
1
]
+
b
[
l
]
Z^{[l]}=W^{[l]}A^{[l-1]}+b^{[l]}
Z
[
l
]
=
W
[
l
]
A
[
l
−
1
]
+
b
[
l
]
A
[
l
]
=
g
[
l
]
(
Z
[
l
]
)
A^{[l]}=g^{[l]}(Z^{[l]})
A
[
l
]
=
g
[
l
]
(
Z
[
l
]
)
反向传播过程
d
z
[
l
]
=
d
a
[
l
]
∗
g
[
l
]
′
(
z
[
l
]
)
dz^{[l]}=da^{[l]}\ast g^{[l]'}(z^{[l]})
d
z
[
l
]
=
d
a
[
l
]
∗
g
[
l
]
′
(
z
[
l
]
)
d
W
[
l
]
=
d
z
[
l
]
⋅
a
[
l
−
1
]
T
dW^{[l]}=dz^{[l]}\cdot {a^{[l-1]}}^T
d
W
[
l
]
=
d
z
[
l
]
⋅
a
[
l
−
1
]
T
d
b
[
l
]
=
d
z
[
l
]
db^{[l]}=dz^{[l]}
d
b
[
l
]
=
d
z
[
l
]
d
a
[
l
−
1
]
=
W
[
l
]
T
⋅
d
z
[
l
]
da^{[l-1]}=W^{[l]T}\cdot dz^{[l]}
d
a
[
l
−
1
]
=
W
[
l
]
T
⋅
d
z
[
l
]
得到:
d
z
[
l
]
=
W
[
l
+
1
]
T
⋅
d
z
[
l
+
1
]
∗
g
[
l
]
′
(
z
[
l
]
)
dz^{[l]}=W^{[l+1]T}\cdot dz^{[l+1]}\ast g^{[l]'}(z^{[l]})
d
z
[
l
]
=
W
[
l
+
1
]
T
⋅
d
z
[
l
+
1
]
∗
g
[
l
]
′
(
z
[
l
]
)
m
m
m
个训练样本,向量化形式为:
d
Z
[
l
]
=
d
A
[
l
]
∗
g
[
l
]
′
(
Z
[
l
]
)
dZ^{[l]}=dA^{[l]}\ast g^{[l]'}(Z^{[l]})
d
Z
[
l
]
=
d
A
[
l
]
∗
g
[
l
]
′
(
Z
[
l
]
)
d
W
[
l
]
=
1
m
d
Z
[
l
]
⋅
A
[
l
−
1
]
T
dW^{[l]}=\frac1mdZ^{[l]}\cdot A^{[l-1]T}
d
W
[
l
]
=
m
1
d
Z
[
l
]
⋅
A
[
l
−
1
]
T
d
b
[
l
]
=
1
m
n
p
.
s
u
m
(
d
Z
[
l
]
,
a
x
i
s
=
1
,
k
e
e
p
d
i
m
=
T
r
u
e
)
db^{[l]}=\frac1mnp.sum(dZ^{[l]},axis=1,keepdim=True)
d
b
[
l
]
=
m
1
n
p
.
s
u
m
(
d
Z
[
l
]
,
a
x
i
s
=
1
,
k
ee
p
d
im
=
T
r
u
e
)
d
A
[
l
−
1
]
=
W
[
l
]
T
⋅
d
Z
[
l
]
dA^{[l-1]}=W^{[l]T}\cdot dZ^{[l]}
d
A
[
l
−
1
]
=
W
[
l
]
T
⋅
d
Z
[
l
]
d
Z
[
l
]
=
W
[
l
+
1
]
T
⋅
d
Z
[
l
+
1
]
∗
g
[
l
]
′
(
Z
[
l
]
)
dZ^{[l]}=W^{[l+1]T}\cdot dZ^{[l+1]}\ast g^{[l]'}(Z^{[l]})
d
Z
[
l
]
=
W
[
l
+
1
]
T
⋅
d
Z
[
l
+
1
]
∗
g
[
l
]
′
(
Z
[
l
]
)
Previous
4.1 深层神经网络(Deep L-layer neural network)
Next
4.3 深层网络中的前向传播(Forward propagation in a Deep Network )
Last updated
5 years ago