# 机器学习笔记——人工神经网络（1）

### 模型表示

${x}_{0}$$x_0$为偏置单元，它的值总是等于1

$\left[\begin{array}{c}{x}_{0}\\ {x}_{1}\\ {x}_{2}\\ {x}_{3}\end{array}\right]\to \left[\begin{array}{c}{a}_{1}^{\left(2\right)}\\ {a}_{2}^{\left(2\right)}\\ {a}_{3}^{\left(2\right)}\end{array}\right]\to {h}_{\theta }\left(x\right)$

$\begin{array}{rl}{a}_{1}^{\left(2\right)}& =g\left({\mathrm{\Theta }}_{10}^{\left(1\right)}{x}_{0}+{\mathrm{\Theta }}_{11}^{\left(1\right)}{x}_{1}+{\mathrm{\Theta }}_{12}^{\left(1\right)}{x}_{2}+{\mathrm{\Theta }}_{13}^{\left(1\right)}{x}_{3}\right)\\ {a}_{2}^{\left(2\right)}& =g\left({\mathrm{\Theta }}_{20}^{\left(1\right)}{x}_{0}+{\mathrm{\Theta }}_{21}^{\left(1\right)}{x}_{1}+{\mathrm{\Theta }}_{22}^{\left(1\right)}{x}_{2}+{\mathrm{\Theta }}_{23}^{\left(1\right)}{x}_{3}\right)\\ {a}_{3}^{\left(2\right)}& =g\left({\mathrm{\Theta }}_{30}^{\left(1\right)}{x}_{0}+{\mathrm{\Theta }}_{31}^{\left(1\right)}{x}_{1}+{\mathrm{\Theta }}_{32}^{\left(1\right)}{x}_{2}+{\mathrm{\Theta }}_{33}^{\left(1\right)}{x}_{3}\right)\\ {h}_{\mathrm{\Theta }}\left(x\right)={a}_{1}^{\left(3\right)}& =g\left({\mathrm{\Theta }}_{10}^{\left(2\right)}{a}_{0}^{\left(2\right)}+{\mathrm{\Theta }}_{11}^{\left(2\right)}{a}_{1}^{\left(2\right)}+{\mathrm{\Theta }}_{12}^{\left(2\right)}{a}_{2}^{\left(2\right)}+{\mathrm{\Theta }}_{13}^{\left(2\right)}{a}_{3}^{\left(2\right)}\right)\end{array}$

$\begin{array}{rl}{z}_{1}^{\left(2\right)}& ={\mathrm{\Theta }}_{10}^{\left(1\right)}{x}_{0}+{\mathrm{\Theta }}_{11}^{\left(1\right)}{x}_{1}+{\mathrm{\Theta }}_{12}^{\left(1\right)}{x}_{2}+{\mathrm{\Theta }}_{13}^{\left(1\right)}{x}_{3}\\ {z}_{2}^{\left(2\right)}& ={\mathrm{\Theta }}_{20}^{\left(1\right)}{x}_{0}+{\mathrm{\Theta }}_{21}^{\left(1\right)}{x}_{1}+{\mathrm{\Theta }}_{22}^{\left(1\right)}{x}_{2}+{\mathrm{\Theta }}_{23}^{\left(1\right)}{x}_{3}\\ {z}_{3}^{\left(2\right)}& ={\mathrm{\Theta }}_{30}^{\left(1\right)}{x}_{0}+{\mathrm{\Theta }}_{31}^{\left(1\right)}{x}_{1}+{\mathrm{\Theta }}_{32}^{\left(1\right)}{x}_{2}+{\mathrm{\Theta }}_{33}^{\left(1\right)}{x}_{3}\end{array}$

$\begin{array}{r}{a}_{1}^{\left(2\right)}=g\left({z}_{1}^{\left(2\right)}\right)\\ {a}_{2}^{\left(2\right)}=g\left({z}_{2}^{\left(2\right)}\right)\\ {a}_{3}^{\left(2\right)}=g\left({z}_{3}^{\left(2\right)}\right)\end{array}$

$x$$x$${z}_{j}$$z_j$的向量形式为
$\begin{array}{rl}x=\left[\begin{array}{c}{x}_{0}\\ {x}_{1}\\ \cdots \\ {x}_{n}\end{array}\right],& {z}^{\left(j\right)}=\left[\begin{array}{c}{z}_{1}^{\left(j\right)}\\ {z}_{2}^{\left(j\right)}\\ \cdots \\ {z}_{n}^{\left(j\right)}\end{array}\right]\end{array}$

$x={a}^{\left(1\right)}$$x=a^{(1)}$,可以写出向量表示的等式${z}^{j}={\mathrm{\Theta }}^{\left(j-1\right)}{a}^{\left(j-1\right)}$$z^{j}=\Theta^{(j-1)}a^{(j-1)}$,${\mathrm{\Theta }}^{\left(j-1\right)}$$\Theta^{(j-1)}$${s}_{j}×\left(n+1\right)$$s_j\times (n+1)$的矩阵，${a}^{\left(j-1\right)}$$a^{(j-1)}$$\left(n+1\right)×1$$(n+1)\times1$的矩阵，得出${z}^{j}$$z^{j}$${s}_{j}×1$$s_j\times1$的矩阵，${a}^{\left(j\right)}=g\left({z}^{\left(j\right)}\right)$$a^{(j)}=g(z^{(j)})$把函数g作用到${z}^{\left(j\right)}$$z^{(j)}$的每一个元素上。

${h}_{\mathrm{\Theta }}\left(x\right)={a}^{\left(j+1\right)}=g\left({z}^{\left(j+1\right)}\right)$

### Example XNOR

$\begin{array}{r}AND:\\ {\mathrm{\Theta }}^{\left(1\right)}& =\left[\begin{array}{ccc}-30& 20& 20\end{array}\right]\\ NOR:\\ {\mathrm{\Theta }}^{\left(1\right)}& =\left[\begin{array}{ccc}10& -20& -20\end{array}\right]\\ OR:\\ {\mathrm{\Theta }}^{\left(1\right)}& =\left[\begin{array}{ccc}-10& 20& 20\end{array}\right]\end{array}$

$\begin{array}{r}\left[\begin{array}{c}{x}_{0}\\ {x}_{1}\\ {x}_{2}\end{array}\right]\to \left[\begin{array}{c}{a}_{1}^{\left(2\right)}\\ {a}_{2}^{\left(2\right)}\end{array}\right]\to \left[\begin{array}{c}{a}^{\left(3\right)}\end{array}\right]\to {h}_{\mathrm{\Theta }}\left(x\right)\end{array}$

• 广告
• 抄袭
• 版权
• 政治
• 色情
• 无意义
• 其他

120