神经网络
From Ufldl
(→神经网络模型) |
(→神经网络模型) |
||
Line 53: | Line 53: | ||
我们用 <math>\textstyle a^{(l)}_i</math> 表示第 <math>\textstyle l</math> 层第 <math>\textstyle i</math> 单元的'''激活值'''(输出值)。当 <math>\textstyle l=1</math> 时, <math>\textstyle a^{(1)}_i = x_i</math> ,也就是第 <math>\textstyle i</math> 个输入值(输入值的第 <math>\textstyle i</math> 个特征)。对于给定参数集合 <math>\textstyle W,b</math> ,我们的神经网络就可以按照函数 <math>\textstyle h_{W,b}(x)</math> 来计算输出结果。本例神经网络的计算步骤如下: | 我们用 <math>\textstyle a^{(l)}_i</math> 表示第 <math>\textstyle l</math> 层第 <math>\textstyle i</math> 单元的'''激活值'''(输出值)。当 <math>\textstyle l=1</math> 时, <math>\textstyle a^{(1)}_i = x_i</math> ,也就是第 <math>\textstyle i</math> 个输入值(输入值的第 <math>\textstyle i</math> 个特征)。对于给定参数集合 <math>\textstyle W,b</math> ,我们的神经网络就可以按照函数 <math>\textstyle h_{W,b}(x)</math> 来计算输出结果。本例神经网络的计算步骤如下: | ||
+ | |||
:<math> | :<math> | ||
Line 62: | Line 63: | ||
\end{align} | \end{align} | ||
</math> | </math> | ||
+ | |||
我们用 <math>\textstyle z^{(l)}_i</math> 表示第 <math>\textstyle l</math> 层第 <math>\textstyle i</math> 单元输入加权和(包括偏置单元),比如, <math>\textstyle z_i^{(2)} = \sum_{j=1}^n W^{(1)}_{ij} x_j + b^{(1)}_i</math> ,则 <math>\textstyle a^{(l)}_i = f(z^{(l)}_i)</math> 。 | 我们用 <math>\textstyle z^{(l)}_i</math> 表示第 <math>\textstyle l</math> 层第 <math>\textstyle i</math> 单元输入加权和(包括偏置单元),比如, <math>\textstyle z_i^{(2)} = \sum_{j=1}^n W^{(1)}_{ij} x_j + b^{(1)}_i</math> ,则 <math>\textstyle a^{(l)}_i = f(z^{(l)}_i)</math> 。 | ||
Line 67: | Line 69: | ||
这样我们就可以得到一种更简洁的表示法。这里我们将激活函数 <math>\textstyle f(\cdot)</math> 扩展为用向量(分量的形式)来表示,即 <math>\textstyle f([z_1, z_2, z_3]) = [f(z_1), f(z_2), f(z_3)]</math> ,那么,上面的等式可以更简洁地表示为: | 这样我们就可以得到一种更简洁的表示法。这里我们将激活函数 <math>\textstyle f(\cdot)</math> 扩展为用向量(分量的形式)来表示,即 <math>\textstyle f([z_1, z_2, z_3]) = [f(z_1), f(z_2), f(z_3)]</math> ,那么,上面的等式可以更简洁地表示为: | ||
+ | |||
:<math>\begin{align} | :<math>\begin{align} | ||
Line 74: | Line 77: | ||
h_{W,b}(x) &= a^{(3)} = f(z^{(3)}) | h_{W,b}(x) &= a^{(3)} = f(z^{(3)}) | ||
\end{align}</math> | \end{align}</math> | ||
+ | |||
我们将上面的计算步骤叫作'''前向传播'''。回想一下,之前我们用 <math>\textstyle a^{(1)} = x</math> 表示输入层的激活值,那么给定第 <math>\textstyle l</math> 层的激活值 <math>\textstyle a^{(l)}</math> 后,第 <math>\textstyle l+1</math> 层的激活值 <math>\textstyle a^{(l+1)}</math> 就可以按照下面步骤计算得到: | 我们将上面的计算步骤叫作'''前向传播'''。回想一下,之前我们用 <math>\textstyle a^{(1)} = x</math> 表示输入层的激活值,那么给定第 <math>\textstyle l</math> 层的激活值 <math>\textstyle a^{(l)}</math> 后,第 <math>\textstyle l+1</math> 层的激活值 <math>\textstyle a^{(l+1)}</math> 就可以按照下面步骤计算得到: | ||
+ | |||
:<math> \begin{align} | :<math> \begin{align} | ||
Line 90: | Line 95: | ||
神经网络也可以有多个输出单元。比如,下面的神经网络有两层隐藏层: <math>\textstyle L_2</math> 及 <math>\textstyle L_3</math> ,输出层 <math>\textstyle L_4</math> 有两个输出单元。 | 神经网络也可以有多个输出单元。比如,下面的神经网络有两层隐藏层: <math>\textstyle L_2</math> 及 <math>\textstyle L_3</math> ,输出层 <math>\textstyle L_4</math> 有两个输出单元。 | ||
+ | |||
[[Image:Network3322.png|500px|center]] | [[Image:Network3322.png|500px|center]] | ||
+ | |||
要求解这样的神经网络,需要样本集 <math>\textstyle (x^{(i)}, y^{(i)})</math> ,其中 <math>\textstyle y^{(i)} \in \Re^2</math> 。如果你想预测的输出是多个的,那这种神经网络很适用。(比如,在医疗诊断应用中,患者的体征指标就可以作为向量的输入值,而不同的输出值 <math>\textstyle y_i</math> 可以表示不同的疾病存在与否。) | 要求解这样的神经网络,需要样本集 <math>\textstyle (x^{(i)}, y^{(i)})</math> ,其中 <math>\textstyle y^{(i)} \in \Re^2</math> 。如果你想预测的输出是多个的,那这种神经网络很适用。(比如,在医疗诊断应用中,患者的体征指标就可以作为向量的输入值,而不同的输出值 <math>\textstyle y_i</math> 可以表示不同的疾病存在与否。) |