三层神经网络计算实例

三层神经网络 0.15
w1 0.20
w2 0.25
w3 0.30
w4 0.40
w5 0.45
w6 0.50
w7 0.55
w8 h1 0.05
i1 0.01
i2 h2 0.01
o1 0.99
o2 0.35
b1 0.60
b2

已知: 输入: i 1 = 0.05 , i 2 = 0.01 目标输出: o 1 = 0.01 , o 2 = 0.99 初始权重: w 1 = 0.15 , w 2 = 0.20 , w 3 = 0.25 , w 4 = 0.30 w 5 = 0.40 , w 6 = 0.45 , w 7 = 0.50 , w 8 = 0.55 转置: b 1 = 0.35 , b 2 = 0.60 \begin{aligned} & 已知:\\ & 输入:\\ & & i_1 &= 0.05,i_2=0.01\\ & 目标输出:\\ & & o_1 &=0.01,o_2=0.99\\ & 初始权重: \\ & & w_1 &=0.15,w_2=0.20,w_3 =0.25,w_4=0.30\\ & & w_5 &=0.40,w_6=0.45,w_7 =0.50,w_8=0.55\\ & 转置: \\ & & b_1 &=0.35,b_2=0.60 \end{aligned} 已知:输入:目标输出:初始权重:转置:i1o1w1w5b1=0.05,i2=0.01=0.01,o2=0.99=0.15,w2=0.20,w3=0.25,w4=0.30=0.40,w6=0.45,w7=0.50,w8=0.55=0.35,b2=0.60
Step 1 前向传播
1.输入层-->隐藏层

计算神经元 h~1~的输入加权和:
n e t h 1 = w 1 ∗ i 1 + w 2 ∗ i 2 + b 1 ∗ 1 n e t h 1 = 0.15 ∗ 0.05 + 0.20 ∗ 0.1 + 0.35 ∗ 1 = 0.3775 \begin{aligned} & net_{h1}=w_1*i_1+w_2*i_2+b_1*1\\ & net_{h1}=0.15*0.05+0.20*0.1+0.35*1=0.3775 \end{aligned} neth1=w1∗i1+w2∗i2+b1∗1neth1=0.15∗0.05+0.20∗0.1+0.35∗1=0.3775

计算神经元 h~1~的输出:
o u t h 1 = 1 1 + e − n e t h 1 = 1 1 + e − 0.3775 = 0.593269992 out_{h1}=\frac{1}{1+e^{-net_{h1}}}=\frac{1}{1+e^{-0.3775}}=0.593269992 outh1=1+e−neth11=1+e−0.37751=0.593269992

计算神经元 h~2~的输入加权和:
n e t h 2 = w 3 ∗ i 1 + w 4 ∗ i 2 + b 1 ∗ 1 n e t h 2 = 0.25 ∗ 0.05 + 0.30 ∗ 0.1 + 0.35 ∗ 1 = 0.3925 \begin{aligned} & net_{h2}=w3*i1+w4*i2+b1*1\\ & net_{h2}=0.25*0.05+0.30*0.1+0.35*1=0.3925 \end{aligned} neth2=w3∗i1+w4∗i2+b1∗1neth2=0.25∗0.05+0.30∗0.1+0.35∗1=0.3925

计算神经元 h~2~的输出:
o u t h 2 = 1 1 + e − n e t h 1 = 1 1 + e − 0.3925 = 0.596884378 out_{h2}=\frac{1}{1+e^{-net_{h1}}}=\frac{1}{1+e^{-0.3925}}=0.596884378 outh2=1+e−neth11=1+e−0.39251=0.596884378
2.隐藏层-->输出层

计算神经元 o~1~的输出:
n e t o 1 = w 5 ∗ o u t h 1 + w 6 ∗ o u t h 2 + b 2 ∗ 1 n e t o 1 = 0.4 ∗ 0.593269992 + 0.45 ∗ 0.596884378 + 0.6 ∗ 1 = 1.105905967 o u t o 1 = 1 1 + e − n e t o 1 = 1 1 + e − 1.105905967 = 0.75136507 \begin{aligned} & & net_{o1} &=w_5*out_{h1}+w_6*out_{h2}+b2*1\\ & & net_{o1} &=0.4*0.593269992+0.45*0.596884378+0.6*1=1.105905967\\ & & out_{o1} &=\frac{1}{1+e^{-net_{o1}}}=\frac{1}{1+e^{-1.105905967}}=0.75136507 \end{aligned} neto1neto1outo1=w5∗outh1+w6∗outh2+b2∗1=0.4∗0.593269992+0.45∗0.596884378+0.6∗1=1.105905967=1+e−neto11=1+e−1.1059059671=0.75136507

计算神经元 o~2~的输出:
n e t o 2 = w 7 ∗ o u t h 1 + w 8 ∗ o u t h 2 + b 2 ∗ 1 n e t o 1 = 0.5 ∗ 0.593269992 + 0.55 ∗ 0.596884378 + 0.6 ∗ 1 = 1.2249214039 o u t o 2 = 1 1 + e − n e t o 2 = 1 1 + e − 1.2249214039 = 0.772928465 \begin{aligned} & & net_{o2} &=w_7*out_{h1}+w_8*out_{h2}+b2*1\\ & & net_{o1} &=0.5*0.593269992+0.55*0.596884378+0.6*1=1.2249214039\\ & & out_{o2} &=\frac{1}{1+e^{-net_{o2}}}=\frac{1}{1+e^{-1.2249214039}}=0.772928465 \end{aligned} neto2neto1outo2=w7∗outh1+w8∗outh2+b2∗1=0.5∗0.593269992+0.55∗0.596884378+0.6∗1=1.2249214039=1+e−neto21=1+e−1.22492140391=0.772928465
Step 2 反向传播
1.总误差

E t o t a l = ∑ 1 2 ( t a r g e t − o u t p u t ) 2 E o 1 = 1 2 ( t a r g e t o 1 − o u t o 1 ) 2 = 1 2 ( 0.01 − 0.75136507 ) 2 = 0.274811083 E o 2 = 1 2 ( t a r g e t o 2 − o u t o 2 ) 2 = 1 2 ( 0.99 − 0.772928465 ) 2 = 0.023560026 E t o t a l = E o 1 + E o 2 = 0.274811083 + 0.023560026 = 0.298371109 \begin{aligned} & & E_{total} &=\sum\frac{1}{2}(target-output)^2\\ & & E_{o1} &=\frac{1}{2}(target_{o1}-out{o1})^2=\frac{1}{2}(0.01-0.75136507)^2=0.274811083\\ & & E_{o2} &=\frac{1}{2}(target_{o2}-out{o2})^2=\frac{1}{2}(0.99-0.772928465)^2=0.023560026\\ & & E_{total} &=E_{o1}+E_{o2}=0.274811083+0.023560026=0.298371109 \end{aligned} EtotalEo1Eo2Etotal=∑21(target−output)2=21(targeto1−outo1)2=21(0.01−0.75136507)2=0.274811083=21(targeto2−outo2)2=21(0.99−0.772928465)2=0.023560026=Eo1+Eo2=0.274811083+0.023560026=0.298371109
2.隐藏层-->输出层的权值更新( w~5~、 w~6~、 w~7~、 w~8~)

w~5~权重更新
∂ E t o t a l ∂ w 5 = ∂ E t o t a l ∂ o u t o 1 ∗ ∂ o u t o 1 ∂ n e t o 1 ∗ ∂ n e t o 1 ∂ w 5 E t o t a l = 1 2 ( t a r g e t o 1 − o u t p u t o 1 ) 2 + 1 2 ( t a r g e t o 2 − o u t p u t o 2 ) 2 ∂ E t o t a l ∂ o u t o 1 = 2 ∗ 1 2 ( t a r g e t o 1 − o u t p u t o 1 ) 2 − 1 ∗ − 1 + 0 ∂ E t o t a l ∂ o u t o 1 = − ( t a r g e t o 1 − o u t p u t o 1 ) = − ( 0.01 − 0.75136507 ) = 0.74136507 o u t o 1 = 1 1 + e − n e t o 1 ∂ o u t o 1 ∂ n e t o 1 = o u t o 1 ( 1 − o u t o 1 ) = 0.75136507 ( 1 − 0.75136507 ) = 0.186815602 n e t o 1 = w 5 ∗ o u t h 1 + w 6 ∗ o u t h 2 + b 2 ∗ 1 ∂ n e t o 1 ∂ w 5 = 1 ∗ o u t h 1 ∗ w 5 ( 1 − 1 ) + 0 + 0 = o u t h 1 = 0.5932699992 ∂ E t o t a l ∂ w 5 = ∂ E t o t a l ∂ o u t o 1 ∗ ∂ o u t o 1 ∂ n e t o 1 ∗ ∂ n e t o 1 ∂ w 5 = 0.74136507 ∗ 0.186815602 ∗ 0.5932699992 = 0.082167041 ∂ E t o t a l ∂ w 5 = − ( t a r g e t o 1 − o u t o 1 ) ∗ o u t o 1 ( 1 − o u t o 1 ) ∗ o u t h 1 w 5 + = w 5 − η ∗ ∂ E t o t a l ∂ w 5 = 0.4 − 0.5 ∗ 0.082167041 = 0.35891648 \newcommand{\fp}[2]{\frac{\partial #1}{\partial #2}} \begin{aligned} & & \fp{E_{total}}{w_5} &=\fp{E_{total}}{out_{o_1}}*\fp{out_{o_1}}{net_{o_1}}*\fp{net_{o_1}}{w_5}\\ & & E_{total} &=\frac{1}{2}(target_{o_1}-output_{o_1})^2+\frac{1}{2}(target_{o_2}-output_{o_2})^2\\ & & \fp{E_{total}}{out_{o_1}} &=2*\frac{1}{2}(target_{o_1}-output_{o_1})^{2-1}*-1+0\\ & & \fp{E_{total}}{out_{o_1}} &=-(target_{o_1}-output_{o_1})=-(0.01-0.75136507)=0.74136507\\ & & out_{o_1} &=\frac{1}{1+e^{-net_{o_1}}}\\ & & \textcolor{red}{\fp{out_{o_1}}{net_{o_1}}} &\textcolor{red}{=out_{o_1}(1-out_{o_1})}=0.75136507(1-0.75136507)=0.186815602\\ & & net_{o_1} &=w_5*out_{h_1}+w_6*out_{h_2}+b_2*1\\ & & \fp{net_{o_1}}{w_5} &=1*out_{h_1}*w_5^{(1-1)}+0+0=out_{h_1}=0.5932699992\\ & & \fp{E_{total}}{w_5} &=\fp{E_{total}}{out_{o_1}}*\fp{out_{o_1}}{net_{o_1}}*\fp{net_{o_1}}{w_5}\\ & & &=0.74136507*0.186815602*0.5932699992\\ & & &=0.082167041\\ & & \textcolor{red}{\fp{E_{total}}{w_5}} &\textcolor{red}{=-(target_{o_1}-out_{o_1})*out_{o_1}(1-out_{o_1})*out_{h_1}}\\ & & w^+5 &=w_5-\eta*\fp{E{total}}{w_5}=0.4-0.5*0.082167041=0.35891648 \end{aligned} ∂w5∂EtotalEtotal∂outo1∂Etotal∂outo1∂Etotalouto1∂neto1∂outo1neto1∂w5∂neto1∂w5∂Etotal∂w5∂Etotalw5+=∂outo1∂Etotal∗∂neto1∂outo1∗∂w5∂neto1=21(targeto1−outputo1)2+21(targeto2−outputo2)2=2∗21(targeto1−outputo1)2−1∗−1+0=−(targeto1−outputo1)=−(0.01−0.75136507)=0.74136507=1+e−neto11=outo1(1−outo1)=0.75136507(1−0.75136507)=0.186815602=w5∗outh1+w6∗outh2+b2∗1=1∗outh1∗w5(1−1)+0+0=outh1=0.5932699992=∂outo1∂Etotal∗∂neto1∂outo1∗∂w5∂neto1=0.74136507∗0.186815602∗0.5932699992=0.082167041=−(targeto1−outo1)∗outo1(1−outo1)∗outh1=w5−η∗∂w5∂Etotal=0.4−0.5∗0.082167041=0.35891648

w~6~权重更新
∂ E t o t a l ∂ w 6 = ∂ E t o t a l ∂ o u t o 1 ∗ ∂ o u t o 1 ∂ n e t o 1 ∗ ∂ n e t o 1 ∂ w 6 n e t o 1 = w 5 ∗ o u t h 1 + w 6 ∗ o u t h 2 + b 2 ∗ 1 ∂ n e t o 1 ∂ w 6 = 1 ∗ o u t h 2 ∗ w 6 ( 1 − 1 ) + 0 + 0 = o u t h 2 = 0.596884378 ∂ E t o t a l ∂ w 6 = ∂ E t o t a l ∂ o u t o 1 ∗ ∂ o u t o 1 ∂ n e t o 1 ∗ ∂ n e t o 1 ∂ w 6 = 0.74136507 ∗ 0.186815602 ∗ 0.596884378 = 0.08266762794 w 6 + = w 6 − η ∗ ∂ E t o t a l ∂ w 6 = 0.45 − 0.5 ∗ 0.08266762794 = 0.408666186 \newcommand{\fp}[2]{\frac{\partial #1}{\partial #2}} \begin{aligned} & & \fp{E_{total}}{w_6} &=\fp{E_{total}}{out_{o_1}}*\fp{out_{o_1}}{net_{o_1}}*\fp{net_{o_1}}{w_6}\\ & & net_{o_1} &=w_5*out_{h_1}+w_6*out_{h_2}+b_2*1\\ & & \fp{net_{o_1}}{w_6} &=1*out_{h_2}*w_6^{(1-1)}+0+0\\ & & &=out_{h_2}\\ & & &=0.596884378\\ & & \fp{E_{total}}{w_6} &=\fp{E_{total}}{out_{o_1}}*\fp{out_{o_1}}{net_{o_1}}*\fp{net_{o_1}}{w_6}\\ & & &=0.74136507*0.186815602*0.596884378\\ & & &=0.08266762794\\ & & w^+6 &=w_6-\eta*\fp{E{total}}{w_6}=0.45-0.5*0.08266762794=0.408666186 \end{aligned} ∂w6∂Etotalneto1∂w6∂neto1∂w6∂Etotalw6+=∂outo1∂Etotal∗∂neto1∂outo1∗∂w6∂neto1=w5∗outh1+w6∗outh2+b2∗1=1∗outh2∗w6(1−1)+0+0=outh2=0.596884378=∂outo1∂Etotal∗∂neto1∂outo1∗∂w6∂neto1=0.74136507∗0.186815602∗0.596884378=0.08266762794=w6−η∗∂w6∂Etotal=0.45−0.5∗0.08266762794=0.408666186

w~7~权重更新
∂ E t o t a l ∂ w 7 = ∂ E t o t a l ∂ o u t o 2 ∗ ∂ o u t o 2 ∂ n e t o 2 ∗ ∂ n e t o 2 ∂ w 7 ∂ E t o t a l ∂ o u t o 2 = − ( t a r g e t o 2 − o u t p u t o 2 ) = − ( 0.99 − 0.772928465 ) = − 0.217071535 ∂ o u t o 2 ∂ n e t o 2 = o u t o 2 ( 1 − o u t o 2 ) = 0.772928465 ∗ ( 1 − 0.772928465 ) = 0.175510053 n e t o 2 = w 7 ∗ o u t h 1 + w 8 ∗ o u t h 2 + b 2 ∗ 1 ∂ n e t o 2 ∂ w 7 = 1 ∗ o u t h 1 ∗ w 7 ( 1 − 1 ) + 0 + 0 = o u t h 1 = 0.5932699992 ∂ E t o t a l ∂ w 7 = ∂ E t o t a l ∂ o u t o 2 ∗ ∂ o u t o 2 ∂ n e t o 2 ∗ ∂ n e t o 2 ∂ w 7 = − 0.217071535 ∗ 0.175510053 ∗ 0.5932699992 = − 0.022602540804 w 7 + = w 7 − η ∗ ∂ E t o t a l ∂ w 7 = 0.5 − 0.5 ∗ ( − 0.022602540804 ) = 0.511301270 \newcommand{\fp}[2]{\frac{\partial #1}{\partial #2}} \begin{aligned} & & \fp{E_{total}}{w_7} &=\fp{E_{total}}{out_{o_2}}*\fp{out_{o_2}}{net_{o_2}}*\fp{net_{o_2}}{w_7}\\ & & \fp{E_{total}}{out_{o_2}} &=-(target_{o_2}-output_{o_2})=-(0.99-0.772928465)=-0.217071535\\ & & \fp{out_{o_2}}{net_{o_2}} &=out_{o_2}(1-out_{o_2})=0.772928465*(1-0.772928465)=0.175510053\\ & & net_{o_2} &=w_7*out_{h_1}+w_8*out_{h_2}+b_2*1\\ & & \fp{net_{o_2}}{w_7} &=1*out_{h_1}*w_7^{(1-1)}+0+0\\ & & &=out_{h_1}\\ & & &=0.5932699992\\ & & \fp{E_{total}}{w_7} &=\fp{E_{total}}{out_{o_2}}*\fp{out_{o_2}}{net_{o_2}}*\fp{net_{o_2}}{w_7}\\ & & &=-0.217071535*0.175510053*0.5932699992\\ & & &=-0.022602540804\\ & & w^+7 &=w_7-\eta*\fp{E{total}}{w_7}=0.5-0.5*(-0.022602540804)=0.511301270 \end{aligned} ∂w7∂Etotal∂outo2∂Etotal∂neto2∂outo2neto2∂w7∂neto2∂w7∂Etotalw7+=∂outo2∂Etotal∗∂neto2∂outo2∗∂w7∂neto2=−(targeto2−outputo2)=−(0.99−0.772928465)=−0.217071535=outo2(1−outo2)=0.772928465∗(1−0.772928465)=0.175510053=w7∗outh1+w8∗outh2+b2∗1=1∗outh1∗w7(1−1)+0+0=outh1=0.5932699992=∂outo2∂Etotal∗∂neto2∂outo2∗∂w7∂neto2=−0.217071535∗0.175510053∗0.5932699992=−0.022602540804=w7−η∗∂w7∂Etotal=0.5−0.5∗(−0.022602540804)=0.511301270

w~8~权重更新
∂ E t o t a l ∂ w 8 = ∂ E t o t a l ∂ o u t o 2 ∗ ∂ o u t o 2 ∂ n e t o 2 ∗ ∂ n e t o 2 ∂ w 8 ∂ E t o t a l ∂ o u t o 2 = − ( t a r g e t o 2 − o u t p u t o 2 ) = − ( 0.99 − 0.772928465 ) = − 0.217071535 ∂ o u t o 2 ∂ n e t o 2 = o u t o 2 ( 1 − o u t o 2 ) = 0.772928465 ∗ ( 1 − 0.772928465 ) = 0.175510053 n e t o 2 = w 7 ∗ o u t h 1 + w 8 ∗ o u t h 2 + b 2 ∗ 1 ∂ n e t o 2 ∂ w 8 = 1 ∗ o u t h 2 ∗ w 8 ( 1 − 1 ) + 0 + 0 = o u t h 2 = 0.596884378 ∂ E t o t a l ∂ w 8 = ∂ E t o t a l ∂ o u t o 2 ∗ ∂ o u t o 2 ∂ n e t o 2 ∗ ∂ n e t o 2 ∂ w 8 = − 0.217071535 ∗ 0.175510053 ∗ 0.596884378 = − 0.022740242263433 w 8 + = w 8 − η ∗ ∂ E t o t a l ∂ w 8 = 0.55 − 0.5 ∗ ( − 0.0227402422634 ) = 0.561370121 \newcommand{\fp}[2]{\frac{\partial #1}{\partial #2}} \begin{aligned} & & \fp{E_{total}}{w_8} &=\fp{E_{total}}{out_{o_2}}*\fp{out_{o_2}}{net_{o_2}}*\fp{net_{o_2}}{w_8}\\ & & \fp{E_{total}}{out_{o_2}} &=-(target_{o_2}-output_{o_2})=-(0.99-0.772928465)=-0.217071535\\ & & \fp{out_{o_2}}{net_{o_2}} &=out_{o_2}(1-out_{o_2})=0.772928465*(1-0.772928465)=0.175510053\\ & & net_{o_2} &=w_7*out_{h_1}+w_8*out_{h_2}+b_2*1\\ & & \fp{net_{o_2}}{w_8} &=1*out_{h_2}*w_8^{(1-1)}+0+0\\ & & &=out_{h_2}\\ & & &=0.596884378\\ & & \fp{E_{total}}{w_8} &=\fp{E_{total}}{out_{o_2}}*\fp{out_{o_2}}{net_{o_2}}*\fp{net_{o_2}}{w_8}\\ & & &=-0.217071535*0.175510053*0.596884378\\ & & &=-0.022740242263433\\ & & w^+8 &=w_8-\eta*\fp{E{total}}{w_8}=0.55-0.5*(-0.0227402422634)=0.561370121 \end{aligned} ∂w8∂Etotal∂outo2∂Etotal∂neto2∂outo2neto2∂w8∂neto2∂w8∂Etotalw8+=∂outo2∂Etotal∗∂neto2∂outo2∗∂w8∂neto2=−(targeto2−outputo2)=−(0.99−0.772928465)=−0.217071535=outo2(1−outo2)=0.772928465∗(1−0.772928465)=0.175510053=w7∗outh1+w8∗outh2+b2∗1=1∗outh2∗w8(1−1)+0+0=outh2=0.596884378=∂outo2∂Etotal∗∂neto2∂outo2∗∂w8∂neto2=−0.217071535∗0.175510053∗0.596884378=−0.022740242263433=w8−η∗∂w8∂Etotal=0.55−0.5∗(−0.0227402422634)=0.561370121
[释: ∂ o u t o 1 ∂ n e t o 1 = o u t o 1 ( 1 − o u t o 1 ) \newcommand{\fp}[2]{\frac{\partial #1}{\partial #2}} \fp{out_{o_1}}{net_{o_1}}=out_{o_1}(1-out_{o_1}) ∂neto1∂outo1=outo1(1−outo1)](#1}{\partial #2}} \fp{out_{o_1}}{net_{o_1}}=out_{o_1}(1-out_{o_1}) ∂neto1∂outo1=outo1(1−outo1))

3.隐藏层-->隐藏层的权值更新( w~1~、 w~2~、 w~3~、 w~4~)

a . 求 ∂ E t o t a l ∂ o u t h 1 解: ∂ E o 1 ∂ o u t h 1 = ∂ E o 1 ∂ n e t o 1 ∗ ∂ n e t o 1 ∂ o u t h 1 n e t o 1 = w 5 ∗ o u t h 1 + w 6 ∗ o u t h 2 + b 2 ∗ 1 ∂ E o 1 ∂ n e t o 1 = ∂ E o 1 ∂ o u t o 1 ∗ ∂ o u t o 1 ∂ n e t o 1 = 0.74136507 ∗ 0.186815602 = 0.138498562 n e t o 1 = w 5 ∗ o u t h 1 + w 6 ∗ o u t h 2 + b 2 ∗ 1 ∂ n e t o 1 ∂ o u t h 1 = w 5 = 0.4 ∂ E o 1 ∂ o u t h 1 = 0.138498562 ∗ 0.4 = 0.055399425 ∂ E o 2 ∂ o u t h 1 = ∂ E o 2 ∂ n e t o 2 ∗ ∂ n e t o 2 ∂ o u t h 1 = ∂ E o 2 ∂ o u t o 2 ∗ ∂ o u t o 2 ∂ n e t o 2 ∗ w 7 = − 0.217071535 ∗ 0.175510053 ∗ 0.5 = − 0.019049119 ∂ E t o t a l ∂ o u t h 1 = ∂ E o 1 ∂ o u t h 1 + ∂ E o 2 ∂ o u t h 1 = 0.055399425 − 0.019049119 = 0.036350306 b . 求 ∂ o u t h 1 ∂ n e t h 1 o u t h 1 = 1 1 + e − n e t h 1 ∂ o u t h 1 ∂ n e t h 1 = o u t h 1 ∗ ( 1 − o u t h 1 ) = 0.593269992 ∗ ( 1 − 0.593269992 ) = 0.241300709 c . 求 ∂ n e t h 1 ∂ w 1 n e t h 1 = w 1 ∗ i 1 + w 2 ∗ i 2 + b 1 ∗ 1 ∂ n e t h 1 ∂ w 1 = i 1 = 0.05 d . 求 ∂ E t o t a l ∂ w 1 = ∂ E t o t a l ∂ o u t h 1 ∗ ∂ o u t h 1 ∂ n e t h 1 ∗ ∂ n e t h 1 ∂ w 1 ∂ E t o t a l ∂ w 1 = 0.036350306 ∗ 0.241300709 ∗ 0.05 = 0.000438568 e . 求 w 1 + = w 1 − η ∗ ∂ E t o t a l ∂ w 1 = 0.15 − 0.5 ∗ 0.000438568 = 0.149780716 f . 同理可得 w 2 + = 0.19956143 w 2 + = 0.24975114 w 2 + = 0.29950229 总结: ∂ E t o t a l ∂ w 1 = ∂ E t o t a l ∂ o u t h 1 ∗ ∂ o u t h 1 ∂ n e t h 1 ∗ ∂ n e t h 1 ∂ w 1 = ( ∂ E o 1 ∂ o u t h 1 + ∂ E o 2 ∂ o u t h 1 ) ∗ ∂ o u t h 1 ∂ n e t h 1 ∗ ∂ n e t h 1 ∂ w 1 = ( ∂ E o 1 ∂ n e t o 1 ∗ ∂ n e t o 1 ∂ o u t h 1 + ∂ E o 2 ∂ n e t o 2 ∗ ∂ n e t o 2 ∂ o u t h 1 ) ∗ ∂ o u t h 1 ∂ n e t h 1 ∗ ∂ n e t h 1 ∂ w 1 = ( ∂ E o 1 ∂ o u t o 1 ∗ ∂ o u t o 1 ∂ n e t o 1 ∗ ∂ n e t o 1 ∂ o u t h 1 + ∂ E o 2 ∂ o u t o 2 ∗ ∂ o u t o 2 ∂ n e t o 2 ∗ ∂ n e t o 2 ∂ o u t h 1 ) ∗ ∂ o u t h 1 ∂ n e t h 1 ∗ ∂ n e t h 1 ∂ w 1 = ( ( o u t o 1 − t a r g e t o 1 ) ∗ ( o u t o 1 − o u t o 1 2 ) ∗ ( ∂ w 5 ∗ o u t h 1 + w 6 ∗ o u t h 2 + b 2 ∗ 1 ∂ o u t h 1 ) + ( o u t p u t o 2 − t a r g e t o 2 ) ∗ ( o u t o 2 − o u t o 2 2 ) ∗ ( ∂ ( w 5 ∗ o u t h 1 + w 6 ∗ o u t h 2 + b 2 ∗ 1 ) ∂ o u t h 2 ) ) ∗ ( o u t h 1 − o u t h 1 2 ) ∗ ( ∂ ( w 1 ∗ i 1 + w 2 ∗ i 2 + b 1 ∗ 1 ) ∂ w 1 ) \newcommand{\fp}[2]{\frac{\partial #1}{\partial #2}} \begin{aligned} &a.求 & \fp{E_{total}}{out_{h_1}}\\ &解: & \fp{E_{o_1}}{out_{h_1}} &=\fp{E_{o_1}}{net_{o_1}}*\fp{net_{o_1}}{out_{h1}}\\ & & net_{o_1} &= w_5*out_{h_1}+w_6*out_{h_2}+b2*1\\ & & \fp{E_{o_1}}{net_{o_1}} &=\fp{E_{o_1}}{out_{o_1}}*\fp{out_{o_1}}{net_{o_1}}\\ & & &=0.74136507*0.186815602\\ & & &=0.138498562\\ & & net_{o_1} &=w_5*out_{h_1}+w6*out_{h_2}+b2*1\\ & & \fp{net_{o_1}}{out_{h1}} &=w5=0.4\\ & & \fp{E_{o_1}}{out_{h_1}} &=0.138498562*0.4\\ & & &=0.055399425\\ & & \fp{E_{o_2}}{out_{h_1}} &=\fp{E_{o_2}}{net_{o_2}}*\fp{net_{o_2}}{out_{h1}}\\ & & &=\fp{E_{o_2}}{out_{o_2}}*\fp{out_{o_2}}{net_{o_2}}*w_7\\ & & &=−0.217071535*0.175510053*0.5\\ & & &=-0.019049119\\ & & \fp{E_{total}}{out_{h_1}} &=\fp{E_{o_1}}{out_{h_1}}+\fp{E_{o_2}}{out_{h_1}}\\ & & &=0.055399425 -0.019049119\\ & & &=0.036350306\\ \\ &b.求 & \fp{out_{h1}}{net_{h1}}\\ & & out_{h_1} &=\frac{1}{1+e^{-net_{h_1}}}\\ & & \fp{out_{h1}}{net_{h1}} &=out_{h_1}*(1-out_{h_1})\\ & & &=0.593269992*(1-0.593269992)\\ & & &=0.241300709\\ \\ &c.求 & \fp{net_{h1}}{w_1}\\ & & net_{h_1} &=w_1*i_1+w2*i_2+b_1*1\\ & & \fp{net_{h1}}{w_1}&=i_1\\ & & &=0.05\\ \\ &d.求 & \fp{E_{total}}{w_1} &=\fp{E_{total}}{out_{h_1}}*\fp{out_{h_1}}{net_{h_1}}*\fp{net_{h_1}}{w_1}\\ & & \fp{E_{total}}{w_1} &=0.036350306*0.241300709*0.05\\ & & &=0.000438568\\ \\ &e.求 & w^+1 &=w_1-\eta*\fp{E{total}}{w_1}\\ & & &=0.15-0.5*0.000438568\\ & & &=0.149780716\\ \\ &f.同理可得 \\ & &w^+2 &=0.19956143\\ & &w^+2 &=0.24975114\\ & &w^+2 &=0.29950229\\ \\ & 总结:\\ & & \fp{E{total}}{w_1} &=\fp{E{total}}{out{h_1}}*\fp{out_{h_1}}{net_{h_1}}*\fp{net_{h_1}}{w_1}\\ & & &=(\fp{E_{o_1}}{out_{h1}}+\fp{E_{o_2}}{out_{h1}})*\fp{out_{h_1}}{net_{h_1}}*\fp{net_{h_1}}{w_1}\\ & & &=(\fp{E_{o_1}}{net_{o_1}}*\fp{net_{o_1}}{out_{h1}}+\fp{E_{o_2}}{net_{o_2}}*\fp{net_{o_2}}{out_{h1}})*\fp{out_{h_1}}{net_{h_1}}*\fp{net_{h_1}}{w_1}\\ & & &=(\fp{E_{o_1}}{out_{o_1}}*\fp{out_{o_1}}{net_{o_1}}*\fp{net_{o_1}}{out_{h1}}+\fp{E_{o_2}}{out_{o_2}}*\fp{out_{o_2}}{net_{o_2}}*\fp{net_{o_2}}{out_{h1}})*\fp{out_{h_1}}{net_{h_1}}*\fp{net_{h_1}}{w_1}\\ & & &=((out_{o_1}-target_{o_1})*(out_{o_1}-out_{o_1}^2)*(\fp{w_5*out_{h_1}+w6*out_{h_2}+b2*1}{out_{h_1}})+(output_{o_2}-target_{o_2})*(out_{o_2}-out_{o_2}^2)*(\fp{(w_5*out_{h_1}+w6*out_{h_2}+b2*1)}{out_{h_2}}))*(out_{h_1}-out_{h_1}^2)*(\fp{(w_1*i_1+w2*i_2+b_1*1)}{w_1}) \end{aligned} a.求解:b.求c.求d.求e.求f.同理可得总结:∂outh1∂Etotal∂outh1∂Eo1neto1∂neto1∂Eo1neto1∂outh1∂neto1∂outh1∂Eo1∂outh1∂Eo2∂outh1∂Etotal∂neth1∂outh1outh1∂neth1∂outh1∂w1∂neth1neth1∂w1∂neth1∂w1∂Etotal∂w1∂Etotalw1+w2+w2+w2+∂w1∂Etotal=∂neto1∂Eo1∗∂outh1∂neto1=w5∗outh1+w6∗outh2+b2∗1=∂outo1∂Eo1∗∂neto1∂outo1=0.74136507∗0.186815602=0.138498562=w5∗outh1+w6∗outh2+b2∗1=w5=0.4=0.138498562∗0.4=0.055399425=∂neto2∂Eo2∗∂outh1∂neto2=∂outo2∂Eo2∗∂neto2∂outo2∗w7=−0.217071535∗0.175510053∗0.5=−0.019049119=∂outh1∂Eo1+∂outh1∂Eo2=0.055399425−0.019049119=0.036350306=1+e−neth11=outh1∗(1−outh1)=0.593269992∗(1−0.593269992)=0.241300709=w1∗i1+w2∗i2+b1∗1=i1=0.05=∂outh1∂Etotal∗∂neth1∂outh1∗∂w1∂neth1=0.036350306∗0.241300709∗0.05=0.000438568=w1−η∗∂w1∂Etotal=0.15−0.5∗0.000438568=0.149780716=0.19956143=0.24975114=0.29950229=∂outh1∂Etotal∗∂neth1∂outh1∗∂w1∂neth1=(∂outh1∂Eo1+∂outh1∂Eo2)∗∂neth1∂outh1∗∂w1∂neth1=(∂neto1∂Eo1∗∂outh1∂neto1+∂neto2∂Eo2∗∂outh1∂neto2)∗∂neth1∂outh1∗∂w1∂neth1=(∂outo1∂Eo1∗∂neto1∂outo1∗∂outh1∂neto1+∂outo2∂Eo2∗∂neto2∂outo2∗∂outh1∂neto2)∗∂neth1∂outh1∗∂w1∂neth1=((outo1−targeto1)∗(outo1−outo12)∗(∂outh1∂w5∗outh1+w6∗outh2+b2∗1)+(outputo2−targeto2)∗(outo2−outo22)∗(∂outh2∂(w5∗outh1+w6∗outh2+b2∗1)))∗(outh1−outh12)∗(∂w1∂(w1∗i1+w2∗i2+b1∗1))

1、求证 ∂ o u t o 1 ∂ n e t o 1 = o u t o 1 ( 1 − o u t o 1 ) \frac{\partial out_{o_1}}{\partial net_{o_1}}=out_{o_1}(1-out_{o_1}) ∂neto1∂outo1=outo1(1−outo1)
已知: ( f ( x ) / g ( x ) ) ′ = ( f ′ ( x ) ∗ g ( x ) − f ( x ) ∗ g ′ ( x ) ) / g ( x ) 2 , o u t o 1 = 1 1 + e − n e t o 1 证明: ∂ o u t o 1 ∂ n e t o 1 = o u t o 1 ( 1 − o u t o 1 ) 令 x = − n e t o 1 , y = o u t o 1 , g ( x ) = e − x 得 f ( g ( x ) ) = y = 1 1 + e − x , 1 y = 1 + e − x , 1 y − 1 = e − x ∂ f ( g ( x ) ) ∂ x = f ′ ( g ( x ) ) ∗ g ′ ( x ) = ( 1 1 + g ( x ) ) ′ ∗ ( e − x ) ′ = ( − 1 ( 1 + e − x ) 2 ) ∗ e − x = − 1 y − 1 ( 1 y ) 2 = y 2 − y = o u t o 1 2 − o u t o 1 \newcommand{\fp}[2]{\frac{\partial #1}{\partial #2}} \begin{aligned} & 已知: & \hspace{-100pt}(f(x)/g(x))' &=(f'(x)*g(x)-f(x)*g'(x))/g(x)^2,\\ & & out_{o_1} &=\frac{1}{1+e^{-net_{o_1}}}\\ & 证明:& \fp{out_{o_1}}{net_{o_1}} &=out_{o_1}(1-out_{o_1})\\ & 令 & x &= -net_{o_1},y=out_{o_1},g(x)=e^{-x}\\ & 得 & f(g(x)) &=y=\frac{1}{1+e^{-x}},\\ & & \frac{1}{y} &=1+e^{-x},\\ & & \frac{1}{y}-1 &=e^{-x}\\ & &\fp{f(g(x))}{x} &=f'(g(x))*g'(x)\\ & & &=(\frac{1}{1+g(x)})'*(e^{-x})'\\ & & &=(\frac{-1}{(1+e^{-x})^2})*e^{-x}\\ & & &=-\frac{\frac{1}{y}-1}{(\frac{1}{y})^2}\\ & & &=y^2-y\\ & & &=out_{o_1}^2-out_{o_1} \end{aligned} 已知:证明:令得(f(x)/g(x))′outo1∂neto1∂outo1xf(g(x))y1y1−1∂x∂f(g(x))=(f′(x)∗g(x)−f(x)∗g′(x))/g(x)2,=1+e−neto11=outo1(1−outo1)=−neto1,y=outo1,g(x)=e−x=y=1+e−x1,=1+e−x,=e−x=f′(g(x))∗g′(x)=(1+g(x)1)′∗(e−x)′=((1+e−x)2−1)∗e−x=−(y1)2y1−1=y2−y=outo12−outo1

相关推荐
2401_8991041131 分钟前
手机壁纸设计技巧:打造个性化视觉盛宴
人工智能·区块链
小李学AI42 分钟前
基于YOLOv8的卫星图像中船只检测系统
人工智能·深度学习·神经网络·yolo·目标检测·机器学习·计算机视觉
Sherlock Ma1 小时前
Cosmos:英伟达发布世界基础模型,为机器人及自动驾驶开发加速!
人工智能·深度学习·机器人·自动驾驶·aigc
明明真系叻1 小时前
2025.1.12机器学习笔记:GAN文献阅读
人工智能·笔记·深度学习·机器学习·1024程序员节
livefan1 小时前
机器狗:科技新宠,未来已来
人工智能
刘争Stanley2 小时前
量子计算:从薛定谔的猫到你的生活
人工智能·yolo·搜索引擎·生活·scikit-learn·量子计算·dall·e 2
IT古董2 小时前
【漫话机器学习系列】044.热点对特性的影响(Effect Of One Hot On Feature Importance)
人工智能·机器学习
微学AI3 小时前
人工智能任务19-基于BERT、ELMO模型对诈骗信息文本进行识别与应用
人工智能·深度学习·bert
wit_@3 小时前
什么是docker?关于docker容器的全面详细介绍
人工智能·docker·容器·eureka·aigc·agi
科技前沿资讯3 小时前
走出实验室的人形机器人,将复刻ChatGPT之路?
人工智能