用反向传导思想求导

From Ufldl

Jump to: navigation, search
(Introduction)
Line 1: Line 1:
[原文]
[原文]
 +
[原文]
== Introduction ==
== Introduction ==
Line 128: Line 129:
<li><math>f^{(l)}</math> 是第<math>l</math>层中各单元的激励函数
<li><math>f^{(l)}</math> 是第<math>l</math>层中各单元的激励函数
</ul>
</ul>
 +
 +
[原文]
 +
 +
Let's say we have a function <math>F</math> that takes a matrix <math>X</math> and yields a real number. We would like to use the backpropagation idea to compute the gradient with respect to <math>X</math> of <math>F</math>, that is <math>\nabla_X F</math>. The general idea is to see the function <math>F</math> as a multi-layer neural network, and to derive the gradients using the backpropagation idea.
 +
 +
[初译]
 +
 +
假设我们有一个函数<math>F</math>,<math>F</math>以矩阵<math>X</math>为参数生成一个实数。我们希望用反向传播思想计算<math>F</math>关于 <math>X</math>的梯度,即<math>\nabla_X F</math>。一般思路是将函数<math>F</math> 看成一个多层神经网络,并使用后向传播思想求梯度。
 +
 +
[一审]
 +
 +
假设我们有一个函数<math>F</math>,<math>F</math>以矩阵<math>X</math>为参数得到一个实数。我们希望用反向传播思想计算<math>F</math>关于<math>X</math>的梯度,即 <math>\nabla_X F</math>。大致思路是将函数<math>F</math>看成一个多层神经网络,并使用反向传播思想求梯度。
 +
 +
[原文]
 +
 +
To do this, we will set our "objective function" to be the function <math>J(z)</math> that when applied to the outputs of the neurons in the last layer yields the value <math>F(X)</math>. For the intermediate layers, we will also choose our activation functions <math>f^{(l)}</math> to this end.
 +
 +
[初译]
 +
 +
为了实现这个想法,我们取目标函数为<math>J(z)</math>,将函数作用在最后一层神经元的输出时会产生值<math>F(X)</math>。对于中间层,我们也会为此选择我们的激励函数<math>f^{(l)}</math>。
 +
 +
[一审]
 +
 +
为了实现这个想法,我们取目标函数为<math>J(z)</math>,将函数作用在最后一层神经元的输出时会产生值<math>F(X)</math>。对于中间层,我们也会为此选择我们的激励函数<math>f^{(l)}</math>。
 +
 +
[原文]
 +
 +
Using this method, we can easily compute derivatives with respect to the inputs <math>X</math>, as well as derivatives with respect to any of the weights in the network, as we shall see later.
 +
 +
[初译]
 +
 +
使用这种方法,我们可以很容易的计算出关于输入<math>X</math>和关于网络中任意权重的导数,之后我们会看到。
 +
 +
[一审]
 +
 +
之后我们会看到,使用这种方法,我们可以很容易计算出对于输入<math>X</math>和网络中任意权重的导数。
 +
 +
[原文]
 +
 +
== Examples ==
 +
 +
To illustrate the use of the backpropagation idea to compute derivatives with respect to the inputs, we will use two functions from the section on [[Sparse Coding: Autoencoder Interpretation | sparse coding]], in examples 1 and 2. In example 3, we use a function from [[Independent Component Analysis | independent component analysis]] to illustrate the use of this idea to compute derivates with respect to weights, and in this specific case, what to do in the case of tied or repeated weights.
 +
 +
[初译]
 +
 +
实例
 +
 +
为了描述如何使用反向传播思想计算关于输入的导数,我们要在例1,例2中用到稀疏编码一节中的两个函数。在例3中,我们使用一个独立成分分析一节中的函数来描述使用此思想计算关于权重的偏导的方法,以及在这种特殊情况下,如何处理绑定或重复的权重的情况。
 +
 +
[一审]
 +
 +
为了描述如何使用反向传播思想计算对于输入的导数,我们在例1,例2中用到稀疏编码一节中的两个函数。在例3中,我们使用一个独立成分分析一节中的函数来描述如何使用此思想计算对于权重的偏导,以及在这个特定例子中,如何处理相同或重复的权重的情况。
 +
 +
[原文]
 +
 +
=== Example 1: Objective for weight matrix in sparse coding ===
 +
 +
Recall for [[Sparse Coding: Autoencoder Interpretation | sparse coding]], the objective function for the weight matrix <math>A</math>, given the feature matrix <math>s</math>:
 +
:<math>F(A; s) = \lVert As - x \rVert_2^2 + \gamma \lVert A \rVert_2^2</math>
 +
 +
[初译]
 +
 +
例1:稀疏编码中权矩阵的目标
 +
 +
回想稀疏编码一节中权矩阵<math>A</math>的目标函数,给定特征矩阵<math>s</math>:
 +
:<math>F(A; s) = \lVert As - x \rVert_2^2 + \gamma \lVert A \rVert_2^2</math>
 +
 +
[一审]
 +
 +
例1:对稀疏编码中权重矩阵的目标函数
 +
 +
回顾稀疏编码一节中给定特征矩阵<math>s</math>,对权重矩阵<math>A</math>的目标函数,:
 +
:<math>F(A; s) = \lVert As - x \rVert_2^2 + \gamma \lVert A \rVert_2^2</math>
 +
 +
[原文]
 +
 +
We would like to find the gradient of <math>F</math> with respect to <math>A</math>, or in symbols, <math>\nabla_A F(A)</math>. Since the objective function is a sum of two terms in <math>A</math>, the gradient is the sum of gradients of each of the individual terms. The gradient of the second term is trivial, so we will consider the gradient of the first term instead.
 +
 +
[初译]
 +
 +
我们希望求<math>F</math>关于<math>A</math>的梯度,即<math>\nabla_A F(A)</math>。因为目标函数是关于<math>A</math>的两项之和,所以它的梯度是各项梯度的和。第二项的梯度是显而易见的,因此我们只考虑第一项的梯度。
 +
 +
[一审]
 +
 +
我们希望求<math>F</math>对于<math>A</math>的梯度,即<math>\nabla_A F(A)</math> 。因为目标函数是两个含<math>A</math>的式子之和,所以它的梯度是每个式子的梯度之和。第二项的梯度很容易求,因此我们只考虑第一项的梯度。
 +
 +
[原文]
 +
 +
The first term, <math>\lVert As - x \rVert_2^2</math>, can be seen as an instantiation of neural network taking <math>s</math> as an input, and proceeding in four steps, as described and illustrated in the paragraph and diagram below:
 +
 +
<ol>
 +
<li>Apply <math>A</math> as the weights from the first layer to the second layer.
 +
<li>Subtract <math>x</math> from the activation of the second layer, which uses the identity activation function.
 +
<li>Pass this unchanged to the third layer, via identity weights. Use the square function as the activation function for the third layer.
 +
<li>Sum all the activations of the third layer.
 +
</ol>
 +
 +
[[File:Backpropagation Method Example 1.png | 400px]]
 +
 +
[初译]
 +
 +
第一项,<math>\lVert As - x \rVert_2^2</math> ,可以看成一个具体的用<math>s</math>做输入的神经网络,下面描述接下来四步:
 +
<ol>
 +
<li>把<math>A</math>作为第一层到第二层的权重。
 +
<li>将第二层的激励减<math>x</math> ,它使用了恒等激励函数。
 +
<li>通过单位权重将结果不变地传到第三层。在第三层使用平方函数作为激励函数。
 +
<li>将第三层的所有激励相加。
 +
</ol>
 +
 +
[一审]
 +
 +
第一项,<math>\lVert As - x \rVert_2^2</math>,可以看成一个用<math>s</math>做输入的神经网络的实例,然后进行如下文字描述并图表示意的四步:
 +
<ol>
 +
<li>把<math>A</math>作为第一层到第二层的权重。
 +
<li>将第二层的激励减<math>x</math>,第二层使用了恒等激励函数。
 +
<li>通过恒等权重将结果不变地传到第三层。在第三层使用平方函数作为激励函数。
 +
<li>将第三层的所有激励相加。
 +
</ol>
 +
 +
[原文]
 +
 +
The weights and activation functions of this network are as follows:
 +
<table align="center">
 +
<tr><th width="50px">Layer</th><th width="200px">Weight</th><th width="200px">Activation function <math>f</math></th></tr>
 +
<tr>
 +
<td>1</td>
 +
<td><math>A</math></td>
 +
<td><math>f(z_i) = z_i</math> (identity)</td>
 +
</tr>
 +
<tr>
 +
<td>2</td>
 +
<td><math>I</math> (identity)</td>
 +
<td><math>f(z_i) = z_i - x_i</math></td>
 +
</tr>
 +
<tr>
 +
<td>3</td>
 +
<td>N/A</td>
 +
<td><math>f(z_i) = z_i^2</math></td>
 +
</tr>
 +
</table>
 +
To have <math>J(z^{(3)}) = F(x)</math>, we can set <math>J(z^{(3)}) = \sum_k J(z^{(3)}_k)</math>.

Revision as of 15:02, 7 March 2013

Personal tools