神经网络

From Ufldl

Jump to: navigation, search
 
Line 1: Line 1:
-
【原文】Consider a supervised learning problem where we have access to labeled training examples <math>(x(^ i),y(^ i))</math>. Neural networks give a way of defining a complex, non-linear form of hypotheses <math>h_{W,b}(x)</math>, with parameters W,b that we can fit to our data.
+
==概述==
-
【初译】处理监督学习问题时,我们使用了标记过的训练样本 <math>(x(^ i),y(^ i))</math>。神经网络提供了一个复杂的非线性假设函数<math>h_{W,b}(x)</math>,其中的参数W,b可以通过数据来调整。
+
以监督学习为例,假设我们有训练样本集  <math>\textstyle (x(^ i),y(^ i))</math> ,那么神经网络算法能够提供一种复杂且非线性的假设模型 <math>\textstyle h_{W,b}(x)</math> ,它具有参数 <math>\textstyle W, b</math> ,可以以此参数来拟合我们的数据。
-
【一审】举一个监督学习的例子,我们有样本集 <math>(x(^ i),y(^ i))</math>。神经网络算法提供了一种复杂又非线性的假设模型<math>h_{W,b}(x)</math>,它具有参数W,b,可以以此参数来拟合我们的数据。
 
-
【二审】举一个监督学习的例子,我们有样本集 <math>(x(^ i),y(^ i))</math>。神经网络算法提供了一种复杂又非线性的假设模型<math>h_{W,b}(x)</math>,它具有参数W,b,可以以此参数来拟合我们的数据。
+
为了描述神经网络,我们先从最简单的神经网络讲起,这个神经网络仅由一个“神经元”构成,以下即是这个“神经元”的图示:
-
 
+
-
【原文】To describe neural networks, we will begin by describing the simplest possible neural network, one which comprises a single "neuron." We will use the following diagram to denote a single neuron:
+
[[Image:SingleNeuron.png|300px|center]]
[[Image:SingleNeuron.png|300px|center]]
-
【初译】为了描述神经网络,我们先从最简单的神经网络讲起,它是一个单一的“神经元”。我们用下面的图来表示单一神经元:
 
-
【一审】为了描述神经网络,我们先从最简单的神经网络讲起,这个神经网络仅由一个“神经元”构成,以下即是单“神经元”图示:
+
这个“神经元”是一个以 <math>\textstyle x_1, x_2, x_3</math> 及截距 <math>\textstyle +1</math> 为输入值的运算单元,其输出为 <math>\textstyle h_{W,b}(x) = f(W^Tx) = f(\sum_{i=1}^3 W_{i}x_i +b)</math> ,其中函数 <math>\textstyle f : \Re \mapsto \Re</math> 被称为“激活函数”。在本教程中,我们选用sigmoid函数作为'''激活函数''' <math>\textstyle f(\cdot)</math>  
-
 
+
-
【二审】为了描述神经网络,我们先从最简单的神经网络讲起,这个神经网络仅由一个“神经元”构成,以下即是单个“神经元”图示:
+
-
 
+
-
【原文】This "neuron" is a computational unit that takes as input <math>x_1, x_2, x_3</math> (and a +1 intercept term), and outputs <math>\textstyle h_{W,b}(x) = f(W^Tx) = f(\sum_{i=1}^3 W_{i}x_i +b)</math>, where<math>f : \Re \mapsto \Re</math> is called the '''activation function'''. In these notes, we will choose <math>f(\cdot)</math> to be the sigmoid function:
+
:<math>
:<math>
f(z) = \frac{1}{1+\exp(-z)}.
f(z) = \frac{1}{1+\exp(-z)}.
-
</math>
+
</math>  
 +
可以看出,这个单一“神经元”的输入-输出映射关系其实就是一个逻辑回归(logistic regression)。
-
【初译】神经元是一个计算单元,输入为<math>x_1, x_2, x_3</math> (a +1为截距项,注这里a为多余?校对者注:这里a是“一个”的意思,不是变量) ,输出为<math>\textstyle h_{W,b}(x) = f(W^Tx) = f(\sum_{i=1}^3 W_{i}x_i +b)</math>,其中<math>f : \Re \mapsto \Re</math>为'''激活函数'''。在这里,我们选择<math>f(\cdot)</math>为S型函数:
 
-
 
+
虽然本系列教程采用sigmoid函数,但你也可以选择双曲正切函数(tanh):
-
:<math>
+
-
f(z) = \frac{1}{1+\exp(-z)}.
+
-
</math>
+
-
 
+
-
 
+
-
【一审】这个“神经元”是一个以<math>x_1, x_2, x_3</math> 及截距+1为输入值的运算单元,并输出<math>\textstyle h_{W,b}(x) = f(W^Tx) = f(\sum_{i=1}^3 W_{i}x_i +b)</math>,其中函数<math>f : \Re \mapsto \Re</math>称为“激活函数”。在本课程中,我们的'''激活函数'''将选用Sigmoid函数:(一审注:因为tanh也是S型函数,所以以下函数不知如何命名)
+
-
 
-
:<math>
 
-
f(z) = \frac{1}{1+\exp(-z)}.
 
-
</math>
 
-
 
-
 
-
【二审】这个“神经元”是一个以<math>x_1, x_2, x_3</math>及截距+1为输入值的运算单元,其输出为<math>\textstyle h_{W,b}(x) = f(W^Tx) = f(\sum_{i=1}^3 W_{i}x_i +b)</math>,其中函数<math>f : \Re \mapsto \Re</math>称为“激活函数”。在本课程中,我们的'''激活函数'''将选用Sigmoid函数:
 
-
 
-
 
-
:<math>
 
-
f(z) = \frac{1}{1+\exp(-z)}.
 
-
</math>
 
-
 
-
【原文】Thus, our single neuron corresponds exactly to the input-output mapping defined by logistic regression.
 
-
 
-
【初译】这样单一神经元就可以与输入输出之间的逻辑回归映射关系相对应。
 
-
 
-
【一审】因此,这个单一“神经元”的输入-输出映射关系就是一个逻辑回归。
 
-
 
-
【二审】因此,这个单一“神经元”的输入输出的映射关系其实就是一个逻辑回归。
 
-
 
-
【原文】Although these notes will use the sigmoid function, it is worth noting that another common choice for <math>f</math> is the hyperbolic tangent, or tanh, function:
 
:<math>
:<math>
f(z) = \tanh(z) = \frac{e^z - e^{-z}}{e^z + e^{-z}},   
f(z) = \tanh(z) = \frac{e^z - e^{-z}}{e^z + e^{-z}},   
-
</math>
+
</math>  
-
 
+
-
【初译】尽管我们在这里使用了S型函数,也可以使用双曲正切函数,用tanh表示:
+
-
 
+
-
:<math>
+
-
f(z) = \tanh(z) = \frac{e^z - e^{-z}}{e^z + e^{-z}}, 
+
-
</math>
+
-
 
+
-
【一审】虽然本系列教程将采用Sigmoid函数,但其它的选择还有双曲正切函数:
+
-
 
+
-
:<math>
+
-
f(z) = \tanh(z) = \frac{e^z - e^{-z}}{e^z + e^{-z}}, 
+
-
</math>
+
-
 
+
-
【二审】虽然本系列教程将采用Sigmoid函数,但你还可以选择双曲正切函数(tanh)
+
-
 
+
-
:<math>
+
-
f(z) = \tanh(z) = \frac{e^z - e^{-z}}{e^z + e^{-z}}, 
+
-
</math>
+
-
 
+
-
【原文】Here are plots of the sigmoid and <math>\tanh</math>  functions:
+
-
 
+
-
【初译】下面为S型函数图和双曲正切函数图:
+
-
 
+
-
【一审】以下是Sigmoid函数及双曲正切函数的图形:(一审注:这里sigmoid与tanh是区分开来的,所以sigmoid不是S型函数的总称)
+
-
【二审】以下是Sigmoid函数及tanh函数的图形:(二审注:在翻译中,既然可以用Sigmoid表示一种函数,就可以用tanh表示双曲正切函数,毕竟它们都是很特殊的函数,并且被广泛使用的)
+
以下分别是sigmoid及tanh的函数图像
<div align=center>
<div align=center>
Line 92: Line 32:
</div>
</div>
-
【原文】The <math>\tanh(z)</math> function is a rescaled version of the sigmoid, and its output range is <math>[-1,1]</math> instead of <math>[0,1]</math>.
+
<math>\textstyle \tanh(z)</math> 函数是sigmoid函数的一种变体,它的取值范围为 <math>\textstyle [-1,1]</math> ,而不是sigmoid函数的 <math>\textstyle [0,1]</math>
-
【初译】<math>\tanh(z)</math> 是S型函数的变形,输出范围为<math>[-1,1]</math>,而不是<math>[0,1]</math>。
 
-
【一审】<math>\tanh(z)</math> 函数是sigmoid函数的一种变体,它的取值范围为<math>[-1,1]</math>,而不是<math>[0,1]</math>
+
注意,与其它地方(包括OpenClassroom公开课以及斯坦福大学CS229课程)不同的是,这里我们不再令 <math>\textstyle x_0=1</math> 。取而代之,我们用单独的参数 <math>\textstyle b</math> 来表示截距。
-
【二审】<math>\tanh(z)</math> 函数是sigmoid函数的一种变体,它的取值范围为<math>[-1,1]</math>,而不是sigmoid函数的<math>[0,1]</math>。
 
-
【原文】Note that unlike some other venues (including the OpenClassroom videos, and parts of CS229), we are not using the convention here of <math>x_0=1</math>. Instead, the intercept term is handled separately by the parameter <math>b</math>.
+
最后要说明的是,有一个等式我们以后会经常用到:如果选择 <math>\textstyle f(z) = 1/(1+\exp(-z))</math> ,也就是sigmoid函数,那么它的导数就是 <math>\textstyle f'(z) = f(z) (1-f(z))</math> (如果选择tanh函数,那它的导数就是 <math>\textstyle f'(z) = 1- (f(z))^2</math> ,你可以根据sigmoid(或tanh)函数的定义自行推导这个等式。
-
【初译】不同于其他的情况(在开放性课程视频CS229中),我们不再令<math>x_0=1</math>。截距项通过参数<math>b</math>来单独处理。
 
-
【一审】注意,与其它地方(包括公开课程视频及教学讲义CS229)不同的是,这里我们并不令<math>x_0=1</math>,而是通过一个单独的参数<math>b</math>来表示截距。
+
==神经网络模型==
-
【二审】注意,与其它地方(包括一些公开课以及斯坦福大学CS229课程)不同的是,这里我们不再令<math>x_0=1</math>,而是通过一个单独的参数<math>b</math>来表示。
+
所谓神经网络就是将许多个单一“神经元”联结在一起,这样,一个“神经元”的输出就可以是另一个“神经元”的输入。例如,下图就是一个简单的神经网络:
-
 
+
-
【原文】Finally, one identity that'll be useful later: If <math>f(z) = 1/(1+\exp(-z))</math> is the sigmoid function, then its derivative is given by <math>f'(z) = f(z) (1-f(z))</math>. (If <math>f</math>  is the tanh function, then its derivative is given by <math>f'(z) = 1- (f(z))^2</math>.) You can derive this yourself using the definition of the sigmoid (or tanh) function.
+
-
+
-
【初译】最后,有一个恒等式很有用:如果<math>f(z) = 1/(1+\exp(-z))</math>为S型函数,那么它的导数为<math>f'(z) = f(z) (1-f(z))</math>。(如果<math>f</math>为双曲正切函数,那么导数为<math>f'(z) = 1- (f(z))^2</math>.)。上式可以通过S型(双曲正切)函数的定义自行推导。
+
-
 
+
-
【一审】最后,有一个等式之后会经常用到:如果sigmoid函数是<math>f(z) = 1/(1+\exp(-z))</math>,那么它的导数就是<math>f'(z) = f(z) (1-f(z))</math>(如果<math>f</math>是双曲正切函数,那它的导数就是<math>f'(z) = 1- (f(z))^2</math>.),你可以根据sigmoid(或双曲正切)函数的定义自行推导这个等式。
+
-
 
+
-
【二审】最后,有一个等式之后会经常用到:如果选择<math>f(z) = 1/(1+\exp(-z))</math>,也就是sigmoid函数,那么它的导数就是<math>f'(z) = f(z) (1-f(z))</math>(如果选择tanh函数,那它的导数就是<math>f'(z) = 1- (f(z))^2</math>.),你可以根据sigmoid(或tanh)函数的定义自行推导这个等式。
+
-
 
+
-
 
+
-
== Neural Network model ==
+
-
神经网络模型
+
-
 
+
-
【原文】A neural network is put together by hooking together many of our simple "neurons," so that the output of a neuron can be the input of another. For example, here is a small neural network:
+
[[Image:Network331.png|400px|center]]
[[Image:Network331.png|400px|center]]
-
【初译】神经网络就是很多个简单神经元的连接,一个神经元的输出可以是另一个神经元的输入。例如,下面是一个小的神经网络:
+
我们使用圆圈来表示神经网络的输入,标上“<math>\textstyle +1</math>”的圆圈被称为'''偏置节点''',也就是截距项。神经网络最左边的一层叫做'''输入层''',最右的一层叫做'''输出层'''(本例中,输出层只有一个节点)。中间所有节点组成的一层叫做'''隐藏层''',因为我们不能在训练样本集中观测到它们的值。同时可以看到,以上神经网络的例子中有3个'''输入单元'''(偏置单元不计在内),3个'''隐藏单元'''及一个'''输出单元'''。
-
【一审】神经网络就是将林林总总的单一“神经元”互相联结在一起,因此,一个“神经元”的输出就可能是另一个“神经元”的输入。例如,下图是一个简单的神经网络:
 
-
【二审】神经网络就是将许多个单一“神经元”联结在一起,这样,一个“神经元”的输出就可能是另一个“神经元”的输入。例如,下图是一个简单的神经网络:
+
我们用 <math>\textstyle {n}_l</math> 来表示网络的层数,本例中 <math>\textstyle n_l=3</math> ,我们将第 <math>\textstyle l</math> 层记为 <math>\textstyle L_l</math> ,于是 <math>\textstyle L_1</math> 是输入层,输出层是 <math>\textstyle L_{n_l}</math> 。本例神经网络有参数 <math>\textstyle (W,b) = (W^{(1)}, b^{(1)}, W^{(2)}, b^{(2)})</math> ,其中 <math>\textstyle W^{(l)}_{ij}</math> (下面的式子中用到)是第 <math>\textstyle l</math> 层第 <math>\textstyle j</math> 单元与第 <math>\textstyle l+1</math> 层第 <math>\textstyle i</math> 单元之间的联接参数(其实就是连接线上的权重,注意标号顺序), <math>\textstyle b^{(l)}_i</math> 是第 <math>\textstyle l+1</math> 层第 <math>\textstyle i</math> 单元的偏置项。因此在本例中, <math>\textstyle W^{(1)} \in \Re^{3\times 3}</math> , <math>\textstyle W^{(2)} \in \Re^{1\times 3}</math> 。注意,没有其他单元连向偏置单元(即偏置单元没有输入),因为它们总是输出 <math>\textstyle +1</math>。同时,我们用 <math>\textstyle s_l</math> 表示第 <math>\textstyle l</math> 层的节点数(偏置单元不计在内)。
-
【原文】In this figure, we have used circles to also denote the inputs to the network.  The circles labeled "+1" are called '''bias units''', and correspond to the intercept term.The leftmost layer of the network is called the '''input layer''', and the rightmost layer the '''output layer''' (which, in this example, has only one
 
-
node).  The middle layer of nodes is called the '''hidden layer''', because its values are not observed in the training set.  We also say that our example neural network has 3 '''input units''' (not counting the bias unit), 3 '''hidden units''', and 1 '''output unit'''.
 
-
【初译】在这个图中,我们用圆圈表示神经网络的输入。带有"+1"被称为'''偏置节点''',对应着截距项。神经网络最左边的层被称为'''输入层''',最右边的层被称为'''输出层'''(在这个例子中,只有一个节点)。中间层也称为'''隐层''',因为它的值不能在训练样本中看到。我们的神经网络例子有3个'''输入节点'''(不包含偏置节点),3个'''隐层节点'''和1个'''输出节点'''。
+
我们用 <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>  来计算输出结果。本例神经网络的计算步骤如下:
-
【一审】如图,我们使用圆圈来表示神经网络的输入,被标上“+1”的圆圈称为'''偏置单元''',也就是截距项。神经网络最左边的一层叫做'''输入层''',最右的一层叫做'''输出层'''(本例中,这层只有一个节点)。中间所有节点组成的一层叫做'''隐藏层''',因为在样本集中并没有它的值。也可以说,以上神经网络的例子有3个'''输入单元'''(偏置单元不计在内),3个'''隐藏单元'''以及一个'''输出单元'''。
 
-
【二审】如图,我们使用圆圈来表示神经网络的输入,被标上“+1”的圆圈称为'''偏置单元''',也就是截距项。神经网络最左边的一层叫做'''输入层''',最右的一层叫做'''输出层'''(本例中,输出层只有一个节点)。中间所有节点组成的一层叫做'''隐藏层''',因为我们不能在训练集中观测到它们的值。同时可以看到,以上神经网络的例子有3个'''输入单元'''(偏置单元不计在内),3个'''隐藏单元'''以及一个'''输出单元'''。
+
:<math>  
-
 
+
-
【原文】We will let <math>n_l</math>denote the number of layers in our network; thus <math>n_l=3</math> in our example.  We label layer <math>l</math> as <math>L_l</math>, so layer <math>L_1</math> is the input layer, and layer <math>L_{n_l}</math> the output layer.
+
-
Our neural network has parameters <math>(W,b) = (W^{(1)}, b^{(1)}, W^{(2)}, b^{(2)})</math>, where we write <math>W^{(l)}_{ij}</math> to denote the parameter (or weight) associated with the connection between unit <math>j</math> in layer <math>l</math>, and unit <math>i</math> in layer <math>l+1</math>.  (Note the order of the indices.)Also, <math>b^{(l)}_i</math> is the bias associated with unit <math>i</math> in layer <math>l+1</math>.Thus, in our example, we have <math>W^{(1)} \in \Re^{3\times 3}</math>, and <math>W^{(2)} \in \Re^{1\times 3}</math>.Note that bias units don't have inputs or connections going into them, since they always output
+
-
the value +1.  We also let <math>s_l</math> denote the number of nodes in layer <math>l</math> (not counting the bias unit).
+
-
 
+
-
【初译】标记<math>n_l</math>为网络的层数;这样<math>n_l=3</math>。标记层<math>l</math>为<math>L_l</math>,这样层<math>L_l</math>为输入层,层<math>L_{n_l}</math> 为输出层。神经网络参数,参数<math>(W,b) = (W^{(1)}, b^{(1)}, W^{(2)}, b^{(2)})</math>(或权重)<math>W^{(l)}_{ij}</math>表示层<math>l</math>节点<math>j</math>和层<math>l+1</math>节点<math>i</math>之间连接关系(注意角标的顺序。)<math>b^{(l)}_i</math>表示层<math>l+1</math>节点<math>i</math>与偏置节点之间的连接关系。这样,在我们的例子中, <math>W^{(1)} \in \Re^{3\times 3}</math>, 和<math>W^{(2)} \in \Re^{1\times 3}</math>。注意到偏置节点没有输入和连接,所以输出总是为值+1。我们标记为<math>s_l</math>层<math>l</math>的节点数目(不包含偏置节点数)。
+
-
 
+
-
【一审】我们用<math>n_l</math>表示网络的层数,因此,本例中<math>n_l=3</math>,将第<math>l</math>层记为<math>L_l</math>,于是<math>L_l</math>就是输入层,输出层记为<math>L_{n_l}</math>。本例神经网络有参数<math>(W,b) = (W^{(1)}, b^{(1)}, W^{(2)}, b^{(2)})</math>,这里第<math>l</math>层第<math>j</math>单元与第<math>l+1</math>层第<math>i</math>单元之间联接的参数就用<math>W^{(l)}_{ij}</math>来表示(注意标号顺序)。同样,<math>b^{(l)}_i</math>是第<math>l+1</math>层第<math>i</math>单元的偏置项。(二审注:这里有点问题)因此,本例中,<math>W^{(1)} \in \Re^{3\times 3}</math>,<math>W^{(2)} \in \Re^{1\times 3}</math>。注意,偏置单元并没有输入值或与其它单元反向相联,这是因为它们总是只有一个输出值+1。同时,我们用<math>s_l</math>表示第<math>l</math>层的节点数(偏置单元不计在内)。
+
-
 
+
-
【二审】我们用<math>n_l</math>表示网络的层数,因此,本例中<math>n_l=3</math>,将第<math>l</math>层记为<math>L_l</math>,于是<math>L_l</math>就是输入层,输出层记为<math>L_{n_l}</math>。本例神经网络的参数<math>(W,b) = (W^{(1)}, b^{(1)}, W^{(2)}, b^{(2)})</math>,其中<math>W^{(l)}_{ij}</math>第<math>l</math>层第<math>j</math>号单元与第<math>l+1</math>层第<math>i</math>号单元之间联接的参数(注意标号顺序),<math>b^{(l)}_i</math>是第层的偏置项与<math>l+1</math>层的第<math>i</math>号单元之间的参数。因此,本例中,<math>W^{(1)} \in \Re^{3\times 3}</math>,<math>W^{(2)} \in \Re^{1\times 3}</math>。注意,没有其他单元员连向偏置单元(也就是偏置单元没有输入),因为它们总是输出+1。同时,我们用<math>s_l</math>表示第<math>l</math>层的节点数(偏置单元不计在内)。
+
-
 
+
-
【原文】We will write <math>a^{(l)}_i</math> to denote the '''activation''' (meaning output value) of unit <math>i</math> in layer <math>l</math>.  For <math>l=1</math>, we also use <math>a^{(1)}_i = x_i</math> to denote the <math>i</math>-th input.Given a fixed setting of the parameters <math>W,b</math>, our neural
+
-
network defines a hypothesis <math>h_{W,b}(x)</math> that outputs a real number.  Specifically, the computation that this neural network represents is given by:
+
-
:<math>
+
\begin{align}
\begin{align}
a_1^{(2)} &= f(W_{11}^{(1)}x_1 + W_{12}^{(1)} x_2 + W_{13}^{(1)} x_3 + b_1^{(1)})  \\
a_1^{(2)} &= f(W_{11}^{(1)}x_1 + W_{12}^{(1)} x_2 + W_{13}^{(1)} x_3 + b_1^{(1)})  \\
Line 158: Line 63:
h_{W,b}(x) &= a_1^{(3)} =  f(W_{11}^{(2)}a_1^{(2)} + W_{12}^{(2)} a_2^{(2)} + W_{13}^{(2)} a_3^{(2)} + b_1^{(2)})  
h_{W,b}(x) &= a_1^{(3)} =  f(W_{11}^{(2)}a_1^{(2)} + W_{12}^{(2)} a_2^{(2)} + W_{13}^{(2)} a_3^{(2)} + b_1^{(2)})  
\end{align}
\end{align}
-
</math>
+
</math>  
-
【初译】用<math>a^{(l)}_i</math>表示层<math>l</math>节点<math>i</math>'''激活'''(意味着有输出值)。对于<math>l=1</math>时,我们用<math>a^{(1)}_i = x_i</math>表示第<math>i</math>个输入节点的输出值。给定参数<math>W,b</math>,神经网络就定义了一个假设函数<math>h_{W,b}(x)</math>,其输出为真实值。下面明确的给出这个神经网络的计算公式:
 
-
:<math>
 
-
\begin{align}
 
-
a_1^{(2)} &= f(W_{11}^{(1)}x_1 + W_{12}^{(1)} x_2 + W_{13}^{(1)} x_3 + b_1^{(1)})  \\
 
-
a_2^{(2)} &= f(W_{21}^{(1)}x_1 + W_{22}^{(1)} x_2 + W_{23}^{(1)} x_3 + b_2^{(1)})  \\
 
-
a_3^{(2)} &= f(W_{31}^{(1)}x_1 + W_{32}^{(1)} x_2 + W_{33}^{(1)} x_3 + b_3^{(1)})  \\
 
-
h_{W,b}(x) &= a_1^{(3)} =  f(W_{11}^{(2)}a_1^{(2)} + W_{12}^{(2)} a_2^{(2)} + W_{13}^{(2)} a_3^{(2)} + b_1^{(2)})
 
-
\end{align}
 
-
</math>
 
-
【一审】我们用<math>a^{(l)}_i</math>表示第<math>l</math>层第<math>i</math>单元的'''激活值'''(输出值)。当<math>l=1</math>时,同时也<math>a^{(1)}_i = x_i</math>表示第<math>i</math>个单元的输入。对于给定参数集合<math>W,b</math>,我们的神经网络就以函数<math>h_{W,b}(x)</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>
+
-
\begin{align}
+
-
a_1^{(2)} &= f(W_{11}^{(1)}x_1 + W_{12}^{(1)} x_2 + W_{13}^{(1)} x_3 + b_1^{(1)})  \\
+
-
a_2^{(2)} &= f(W_{21}^{(1)}x_1 + W_{22}^{(1)} x_2 + W_{23}^{(1)} x_3 + b_2^{(1)})  \\
+
-
a_3^{(2)} &= f(W_{31}^{(1)}x_1 + W_{32}^{(1)} x_2 + W_{33}^{(1)} x_3 + b_3^{(1)})  \\
+
-
h_{W,b}(x) &= a_1^{(3)} =  f(W_{11}^{(2)}a_1^{(2)} + W_{12}^{(2)} a_2^{(2)} + W_{13}^{(2)} a_3^{(2)} + b_1^{(2)})
+
-
\end{align}
+
-
</math>
+
-
【二审】我们用<math>a^{(l)}_i</math>表示第<math>l</math>层第<math>i</math>号单元的'''激活值'''(输出值)。当<math>l=1</math>时,<math>a^{(1)}_i = x_i</math>,也就是第<math>i</math>个特征的输入值。对于给定参数集合<math>W,b</math>,我们的神经网络就按照函数<math>h_{W,b}(x)</math>计算输出结果。本例神经网络的计算过程就由以下步骤表示:
+
-
:<math>
+
-
\begin{align}
+
-
a_1^{(2)} &= f(W_{11}^{(1)}x_1 + W_{12}^{(1)} x_2 + W_{13}^{(1)} x_3 + b_1^{(1)})  \\
+
-
a_2^{(2)} &= f(W_{21}^{(1)}x_1 + W_{22}^{(1)} x_2 + W_{23}^{(1)} x_3 + b_2^{(1)})  \\
+
-
a_3^{(2)} &= f(W_{31}^{(1)}x_1 + W_{32}^{(1)} x_2 + W_{33}^{(1)} x_3 + b_3^{(1)})  \\
+
-
h_{W,b}(x) &= a_1^{(3)} =  f(W_{11}^{(2)}a_1^{(2)} + W_{12}^{(2)} a_2^{(2)} + W_{13}^{(2)} a_3^{(2)} + b_1^{(2)})
+
-
\end{align}
+
-
</math>
+
-
【原文】In the sequel, we also let <math>z^{(l)}_i</math> denote the total weighted sum of inputs to unit <math>i</math> in layer <math>l</math>,
 
-
including the bias term (e.g., <math>\textstyle z_i^{(2)} = \sum_{j=1}^n W^{(1)}_{ij} x_j + b^{(1)}_i</math>), so that
 
-
<math>a^{(l)}_i = f(z^{(l)}_i)</math>.
 
-
【初译】下面,我们用表示层l节点i的加权后输入量与偏置项之和(例如,),这样。
+
这样我们就可以得到一种更简洁的表示法。这里我们将激活函数 <math>\textstyle f(\cdot)</math> 扩展为用向量(分量的形式)来表示,即 <math>\textstyle f([z_1, z_2, z_3]) = [f(z_1), f(z_2), f(z_3)]</math> ,那么,上面的等式可以更简洁地表示为:
-
【一审】我们用表示第  层第i单元输入的加权总和(包括偏置单元),比如,,则。
 
-
【二审】我们用表示第  层第i单元输入值的加权总和(包括偏置单元),比如,,则。
+
:<math>\begin{align}
 +
z^{(2)} &= W^{(1)} x + b^{(1)} \\
 +
a^{(2)} &= f(z^{(2)}) \\
 +
z^{(3)} &= W^{(2)} a^{(2)} + b^{(2)} \\
 +
h_{W,b}(x) &= a^{(3)} = f(z^{(3)})
 +
\end{align}</math>
-
【原文】Note that this easily lends itself to a more compact notation. Specifically, if we extend the activation function to apply to vectors in an element-wise fashion (i.e., f([z1,z2,z3]) = [f(z1),f(z2),f(z3)]), then we can write the equations above more compactly as:
 
-
【初译】这样可以推导出一个更简洁的表示法。特别地,如果我们扩展激活函数为向量形式(例如,f([z1,z2,z3]) = [f(z1),f(z2),f(z3)]),这样我们可以使等式更为简洁:
+
我们将上面的计算步骤叫作'''前向传播'''。回想一下,之前我们用 <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> 就可以按照下面步骤计算得到:
-
【一审】这样我们就可以很容易地找到一种更紧凑的表示法。特别是,如果我们将激活函数扩展为用向量(分量的形式)来表示,就如,f([z1,z2,z3]) = [f(z1),f(z2),f(z3)],那么,上面的等式我们就可以用一种更精简的方式表示:
 
-
【二审】这样我们就可以找到一种更简洁的表示法。这里我们将激活函数扩展为用向量(分量的形式)来表示,即是f([z1,z2,z3]) = [f(z1),f(z2),f(z3)],那么,上面的等式我们就可以表示为:
+
:<math> \begin{align}
 +
z^{(l+1)} &= W^{(l)} a^{(l)} + b^{(l)}  \\
 +
a^{(l+1)} &= f(z^{(l+1)})
 +
\end{align}</math>
-
【原文】We call this step forward propagation. More generally, recalling that we also use a(1) = x to also denote the values from the input layer, then given  layer  's activations a(l), we can compute layer + 1's activations a(l + 1) as:
 
-
【初译】我们称这个步骤为正向传播。更一般化,回想我们用到a(1) = x来表示输入层的输出值,给定层l激活(输出)值a(l),我们可以计算层l+1激活(输出)值a(l + 1)
+
将参数矩阵化,使用矩阵-向量运算方式,我们就可以利用线性代数的优势对神经网络进行快速求解。
-
【一审】我们将这种步骤叫作“前向传导”。回想一下,之前我们也用a(1) = x表示输入层的激活值,那么第  层的激活值更通用的表示就是a(l),而第  +1层的激活值a(l + 1)就可以由以下方式计算得到:
 
-
【二审】我们将这种步骤叫作“正向传播”。回想一下,之前我们也用a(1) = x表示输入层的激活值,那么第 层的激活值更通用的表示就是a(l),而第 +1层的激活值a(l + 1)就可以由以下方式计算得到:
+
目前为止,我们讨论了一种神经网络,我们也可以构建另一种'''结构'''的神经网络(这里结构指的是神经元之间的联接模式),也就是包含多个隐藏层的神经网络。最常见的一个例子是 <math>\textstyle  n_l</math> 层的神经网络,第 <math>\textstyle  1</math> 层是输入层,第 <math>\textstyle  n_l</math> 层是输出层,中间的每个层 <math>\textstyle l</math> 与层 <math>\textstyle  l+1</math> 紧密相联。这种模式下,要计算神经网络的输出结果,我们可以按照之前描述的等式,按部就班,进行前向传播,逐一计算第 <math>\textstyle  L_2</math> 层的所有激活值,然后是第 <math>\textstyle  L_3</math> 层的激活值,以此类推,直到第 <math>\textstyle  L_{n_l}</math> 层。这是一个'''前馈'''神经网络的例子,因为这种联接图没有闭环或回路。
-
【原文】By organizing our parameters in matrices and using matrix-vector operations, we can take advantage of fast linear algebra routines to quickly perform calculations in our network.
 
-
【初译】把参数矩阵化和使用矩阵-向量操作,我们可以利用线性代数性质来快速计算。
+
神经网络也可以有多个输出单元。比如,下面的神经网络有两层隐藏层: <math>\textstyle L_2</math>  及 <math>\textstyle L_3</math> ,输出层 <math>\textstyle L_4</math> 有两个输出单元。
-
【一审】将参数矩阵化,使用矩阵-向量运算,我们就可以利用线性代数的优势对神经网络进行快速地求解。
 
-
【二审】将参数矩阵化,使用矩阵-向量运算,我们就可以利用线性代数的优势对神经网络进行快速地求解。
+
[[Image:Network3322.png|500px|center]]
-
【原文】We have so far focused on one example neural network, but one can also build neural networks with other architectures (meaning patterns of connectivity between neurons), including ones with multiple hidden layers. The most common choice is a -layered network where layer is the input layer, layer is the output layer, and each layer is densely connected to layer . In this setting, to compute the output of the network, we can successively compute all the activations in layer , then layer , and so on, up to layer , using the equations above that describe the forward propagation step. This is one example of a feedforward neural network, since the connectivity graph does not have any directed loops or cycles.
 
-
【初译】目前为止我们着重描述了一个神经网络的例子,但是你也可以设计其他结构的神经网络(神经元之间连接模式不同),也可以设计包含多个隐层的神经网络。最常见的是层网络,l为输入层,层为输出层,每个层l密集的连接到层l+1.在这种设计中,为了计算网络的输出,我们可以逐步计算每层的激活值,层,层,最后为层。利用上面我们提及的正向传播步骤。这是一个前馈神经网络例子,因为神经元之间彼此连接不构成任何直接闭环或回路。
+
要求解这样的神经网络,需要样本集  <math>\textstyle (x^{(i)}, y^{(i)})</math>  ,其中 <math>\textstyle y^{(i)} \in \Re^2</math> 。如果你想预测的输出是多个的,那这种神经网络很适用。(比如,在医疗诊断应用中,患者的体征指标就可以作为向量的输入值,而不同的输出值 <math>\textstyle y_i</math> 可以表示不同的疾病存在与否。)
-
【一审】目前为止,我们讨论了一种神经网络的例子,但我们也可以构建一个另一种“结构”(这里结构指的是神经元之间的联接模式)的神经网络,包括具有多个隐藏层的神经网络。最常见的一种例子是层的神经网络,第1层是输入层,第层是输出层,中间的每个  层与层紧密相联。这种模式下,要计算神经网络的输出结果,我们可以通过之前的等式描述的那样,按部就班,进行前向传导,逐一计算第层的所有激活值,再者是第层的激活值,以此类推,直到第层。这是一个“前向传导”神经网络的样例,因为这种联接图并没有闭环或回路。
 
-
【二审】目前为止,我们讨论了一种神经网络的例子,但我们也可以构建一个另一种“结构”的神经网络(这里结构指的是神经元之间的联接模式),包括具有多个隐藏层的神经网络。最常见的一个例子是层的神经网络,第1层是输入层,第层是输出层,中间的每个  层与层紧密相联。这种模式下,要计算神经网络的输出结果,我们可以通过之前的等式描述的那样,按部就班,进行正向传播,逐一计算第层的所有激活值,再者是第层的激活值,以此类推,直到第层。这是一个“前馈”神经网络的样例,因为这种联接图并没有闭环或回路。
+
==中英文对照==
-
【原文】Neural networks can also have multiple output units. For example, here is a network with two hidden layers layers L2 and L3 and two output units in layer L4:
+
neural networks 神经网络
-
+
-
【初译】神经网络也可以有多个输出节点。例如,这是一个神经网络有两个隐层L2 L3 ,层L4有两个输出节点。
+
-
【一审】神经网络也可以有多个输出单元。比如,以下神经网络有两层隐藏层:L2 及L3,并在L4层中有两个输出单元。
+
activation function 激活函数
-
【二审】神经网络也可以有多个输出单元。比如,以下神经网络有两层隐藏层:L2 及L3,并在L4层中有两个输出单元。
+
hyperbolic tangent 双曲正切函数
-
【原文】To train this network, we would need training examples (x(i),y(i)) where . This sort of network is useful if there're multiple outputs that you're interested in predicting. (For example, in a medical diagnosis application, the vector x might give the input features of a patient, and the different outputs yi's might indicate presence or absence of different diseases.)
+
bias units 偏置项
-
【初译】为了训练网络,我们需要训练样本(x(i),y(i)),其中。当你想用于预测时,多个输出的网络更为有用。(例如,在医学诊断应用中,向量x表示病人情况,不同输出yi表示不同疾病的存在或者不存在。)
+
activation 激活值
-
【一审】要求解这样的神经网络,我们就需要样本集(x(i),y(i)),其中。如果你想预测的输出是多个的,那这种神经网络是很适用的。(比如,在医疗诊断应用中,患者的体征指标就可以作为向量的输入值,而不同的输出值yi就可以表示不同的疾病存在与否。)
+
forward propagation 前向传播
-
【二审】要求解这样的神经网络,我们就需要样本集(x(i),y(i)),其中。如果你想预测的输出是多个的,那这种神经网络是很适用的。(比如,在医疗诊断应用中,患者的体征指标就可以作为向量的输入值,而不同的输出值yi就可以表示不同的疾病存在与否。)
+
feedforward neural network 前馈神经网络(参照Mitchell的《机器学习》的翻译)
 +
==中文译者==
-
【二审】中英语对照
+
孙逊(sunpaofu@foxmail.com),林锋(xlfg@yeah.net),刘鸿鹏飞(just.dark@foxmail.com), 许利杰(csxulijie@gmail.com)
-
neural networks 神经网络
+
 
-
activation function. 激活函数
+
 
-
hyperbolic tangent 双曲正切函数
+
{{稀疏自编码器}}
-
bias units 偏置项
+
 
-
activation激活值
+
 
-
forward propagation 正向传播(这里为了与“反向传播”的翻译相对应,采用“正向传播”)
+
{{Languages|Neural_Networks|English}}
-
feedforward neural network 前馈神经网络(参照Mitchell的《机器学习》的翻译)
+

Latest revision as of 12:34, 7 April 2013

Personal tools