|
|
Line 1: |
Line 1: |
- | 初译: 新浪微博,@上篮高手要抓紧时间少上微博 http://www.weibo.com/gapbridger
| + | 目前为止,我们已经讨论了神经网络在有监督学习中的应用。在有监督学习中,训练样本是有类别标签的。现在假设我们只有一个没有带类别标签的训练样本集合 <math>\textstyle \{x^{(1)}, x^{(2)}, x^{(3)}, \ldots\}</math> ,其中 <math>\textstyle x^{(i)} \in \Re^{n}</math> 。自编码神经网络是一种无监督学习算法,它使用了反向传播算法,并让目标值等于输入值,比如 <math>\textstyle y^{(i)} = x^{(i)}</math> 。下图是一个自编码神经网络的示例。 |
| | | |
- | 一审: 新浪微博,@达博西 http://www.weibo.com/mercivi
| + | [[Image:Autoencoder636.png|400px|center]] |
| | | |
- | 二审: 新浪微博,@大黄蜂的思索 http://weibo.com/u/1733291480
| |
| | | |
- | wiki上传: 新浪微博,@上篮高手要抓紧时间少上微博 http://www.weibo.com/gapbridger
| |
| | | |
- | 【原文】
| + | 自编码神经网络尝试学习一个 <math>\textstyle h_{W,b}(x) \approx x</math> 的函数。换句话说,它尝试逼近一个恒等函数,从而使得输出 <math>\textstyle \hat{x}</math> 接近于输入 <math>\textstyle x</math> 。恒等函数虽然看上去不太有学习的意义,但是当我们为自编码神经网络加入某些限制,比如限定隐藏神经元的数量,我们就可以从输入数据中发现一些有趣的结构。举例来说,假设某个自编码神经网络的输入 <math>\textstyle x</math> 是一张 <math>\textstyle 10 \times 10</math> 图像(共100个像素)的像素灰度值,于是 <math>\textstyle n=100</math> ,其隐藏层 <math>\textstyle L_2</math> 中有50个隐藏神经元。注意,输出也是100维的 <math>\textstyle y \in \Re^{100}</math> 。由于只有50个隐藏神经元,我们迫使自编码神经网络去学习输入数据的'''压缩'''表示,也就是说,它必须从50维的隐藏神经元激活度向量 <math>\textstyle a^{(2)} \in \Re^{50}</math> 中'''重构'''出100维的像素灰度值输入 <math>\textstyle x</math> 。如果网络的输入数据是完全随机的,比如每一个输入 <math>\textstyle x_i</math> 都是一个跟其它特征完全无关的独立同分布高斯随机变量,那么这一压缩表示将会非常难学习。但是如果输入数据中隐含着一些特定的结构,比如某些输入特征是彼此相关的,那么这一算法就可以发现输入数据中的这些相关性。事实上,这一简单的自编码神经网络通常可以学习出一个跟主元分析(PCA)结果非常相似的输入数据的低维表示。 |
| | | |
- | So far, we have described the application of neural networks to supervised learning, in which we have labeled
| |
- | training examples. Now suppose we have only a set of unlabeled training examples <math>\textstyle \{x^{(1)}, x^{(2)}, x^{(3)}, \ldots\}</math>,
| |
- | where <math>\textstyle x^{(i)} \in \Re^{n}</math>. An
| |
- | '''autoencoder''' neural network is an unsupervised learning algorithm that applies backpropagation,
| |
- | setting the target values to be equal to the inputs. I.e., it uses <math>\textstyle y^{(i)} = x^{(i)}</math>.
| |
| | | |
- | Here is an autoencoder:
| + | 我们刚才的论述是基于隐藏神经元数量较小的假设。但是即使隐藏神经元的数量较大(可能比输入像素的个数还要多),我们仍然通过给自编码神经网络施加一些其他的限制条件来发现输入数据中的结构。具体来说,如果我们给隐藏神经元加入稀疏性限制,那么自编码神经网络即使在隐藏神经元数量较多的情况下仍然可以发现输入数据中一些有趣的结构。 |
| | | |
- | 【初译】
| + | 稀疏性可以被简单地解释如下。如果当神经元的输出接近于1的时候我们认为它被激活,而输出接近于0的时候认为它被抑制,那么使得神经元大部分的时间都是被抑制的限制则被称作稀疏性限制。这里我们假设的神经元的激活函数是sigmoid函数。如果你使用tanh作为激活函数的话,当神经元输出为-1的时候,我们认为神经元是被抑制的。 |
| | | |
- | 目前为止,我们已经讨论了神经网络在监督学习中的应用。在监督学习中,训练样本是有类别标签的。现在假设我们只有一个没有类别标签的训练样本集合 <math>\textstyle \{x^{(1)}, x^{(2)}, x^{(3)}, \ldots\}</math> ,其中 <math>\textstyle x^{(i)} \in \Re^{n}</math> 。一个自编码神经网络是一种非监督学习算法,它使用了反向传播算法,并将目标值设为输入值,比如 <math>\textstyle y^{(i)} = x^{(i)}</math> 。下图是一个自编码神经网络的示例。
| + | 注意到 <math>\textstyle a^{(2)}_j</math> 表示隐藏神经元 <math>\textstyle j</math> 的激活度,但是这一表示方法中并未明确指出哪一个输入 <math>\textstyle x</math> 带来了这一激活度。所以我们将使用 <math>\textstyle a^{(2)}_j(x)</math> 来表示在给定输入为 <math>\textstyle x</math> 情况下,自编码神经网络隐藏神经元 <math>\textstyle j</math> 的激活度。 |
| + | 进一步,让 |
| + | :<math>\begin{align} |
| + | \hat\rho_j = \frac{1}{m} \sum_{i=1}^m \left[ a^{(2)}_j(x^{(i)}) \right] |
| + | \end{align}</math> |
| + | 表示隐藏神经元 <math>\textstyle j</math> 的平均活跃度(在训练集上取平均)。我们可以近似的加入一条限制 |
| + | :<math>\begin{align} |
| + | \hat\rho_j = \rho, |
| + | \end{align}</math> |
| + | 其中, <math>\textstyle \rho</math> 是'''稀疏性参数''',通常是一个接近于0的较小的值(比如 <math>\textstyle \rho = 0.05</math> )。换句话说,我们想要让隐藏神经元 <math>\textstyle j</math> 的平均活跃度接近0.05。为了满足这一条件,隐藏神经元的活跃度必须接近于0。 |
| | | |
- | 【一审】
| + | 为了实现这一限制,我们将会在我们的优化目标函数中加入一个额外的惩罚因子,而这一惩罚因子将惩罚那些 <math>\textstyle \hat\rho_j</math> 和 <math>\textstyle \rho</math> 有显著不同的情况从而使得隐藏神经元的平均活跃度保持在较小范围内。惩罚因子的具体形式有很多种合理的选择,我们将会选择以下这一种: |
| + | :<math>\begin{align} |
| + | \sum_{j=1}^{s_2} \rho \log \frac{\rho}{\hat\rho_j} + (1-\rho) \log \frac{1-\rho}{1-\hat\rho_j}. |
| + | \end{align}</math> |
| + | 这里, <math>\textstyle s_2</math> 是隐藏层中隐藏神经元的数量,而索引 <math>\textstyle j</math> 依次代表隐藏层中的每一个神经元。如果你对相对熵(KL divergence)比较熟悉,这一惩罚因子实际上是基于它的。于是惩罚因子也可以被表示为 |
| + | :<math>\begin{align} |
| + | \sum_{j=1}^{s_2} {\rm KL}(\rho || \hat\rho_j), |
| + | \end{align}</math> |
| + | 其中 <math>\textstyle {\rm KL}(\rho || \hat\rho_j) |
| + | = \rho \log \frac{\rho}{\hat\rho_j} + (1-\rho) \log \frac{1-\rho}{1-\hat\rho_j}</math> 是一个以 <math>\textstyle \rho</math> 为均值和一个以 <math>\textstyle \hat\rho_j</math> 为均值的两个伯努利随机变量之间的相对熵。相对熵是一种标准的用来测量两个分布之间差异的方法。(如果你没有见过相对熵,不用担心,所有你需要知道的内容都会被包含在这份笔记之中。) |
| | | |
- | 目前为止,我们已经讨论了神经网络在监督学习中的应用。在监督学习中,训练样本是有类别标签的。现在假设我们只有一个没有类别标签的训练样本集合 <math>\textstyle \{x^{(1)}, x^{(2)}, x^{(3)}, \ldots\}</math> ,其中 <math>\textstyle x^{(i)} \in \Re^{n}</math> 。一个自编码神经网络是一种非监督学习算法,它使用了反向传播算法,并将目标值设为输入值,比如 <math>\textstyle y^{(i)} = x^{(i)}</math> 。下图是一个自编码神经网络的示例。
| |
| | | |
- | 【二审】
| + | 这一惩罚因子有如下性质,当 <math>\textstyle \hat\rho_j = \rho</math> 时 <math>\textstyle {\rm KL}(\rho || \hat\rho_j) = 0</math> ,并且随着 <math>\textstyle \hat\rho_j</math> 与 <math>\textstyle \rho</math> 之间的差异增大而单调递增。举例来说,在下图中,我们设定 <math>\textstyle \rho = 0.2</math> 并且画出了相对熵值 <math>\textstyle {\rm KL}(\rho || \hat\rho_j)</math> 随着 <math>\textstyle \hat\rho_j</math> 变化的变化。 |
| | | |
- | 目前为止,我们已经讨论了神经网络在有监督学习中的应用。在有监督学习中,训练样本是有类别标签的。现在假设我们只有一个没有带类别标签的训练样本集合 <math>\textstyle \{x^{(1)}, x^{(2)}, x^{(3)}, \ldots\}</math> ,其中 <math>\textstyle x^{(i)} \in \Re^{n}</math> 。自编码神经网络是一种无监督学习算法,它使用了反向传播算法,并让目标值等于输入值,比如 <math>\textstyle y^{(i)} = x^{(i)}</math> 。下图是一个自编码神经网络的示例。
| + | [[Image:KLPenaltyExample.png|400px|center]] |
| | | |
- | [[Image:Autoencoder636.png|400px|center]]
| |
| | | |
- | 【原文】
| + | 我们可以看出,相对熵在 <math>\textstyle \hat\rho_j = \rho</math> 时达到它的最小值0,而当 <math>\textstyle \hat\rho_j</math> 靠近0或者1的时候,相对熵则变得非常大(其实是趋向于<math>\textstyle \infty</math>)。所以,最小化这一惩罚因子具有使得 <math>\textstyle \hat\rho_j</math> 靠近 <math>\textstyle \rho</math> 的效果。 |
| + | 现在,我们的总体代价函数可以表示为 |
| + | :<math>\begin{align} |
| + | J_{\rm sparse}(W,b) = J(W,b) + \beta \sum_{j=1}^{s_2} {\rm KL}(\rho || \hat\rho_j), |
| + | \end{align}</math> |
| + | 其中 <math>\textstyle J(W,b)</math> 如之前所定义,而 <math>\textstyle \beta</math> 控制稀疏性惩罚因子的权重。 <math>\textstyle \hat\rho_j</math> 项则也(间接地)取决于 <math>\textstyle W,b</math> ,因为它是隐藏神经元 <math>\textstyle j</math> 的平均激活度,而隐藏层神经元的激活度取决于 <math>\textstyle W,b</math> 。 |
| | | |
- | The autoencoder tries to learn a function <math>\textstyle h_{W,b}(x) \approx x</math>. In other
| |
- | words, it is trying to learn an approximation to the identity function, so as
| |
- | to output <math>\textstyle \hat{x}</math> that is similar to <math>\textstyle x</math>. The identity function seems a
| |
- | particularly trivial function to be trying to learn; but by placing constraints
| |
- | on the network, such as by limiting the number of hidden units, we can discover
| |
- | interesting structure about the data. As a concrete example, suppose the
| |
- | inputs <math>\textstyle x</math> are the pixel intensity values from a <math>\textstyle 10 \times 10</math> image (100
| |
- | pixels) so <math>\textstyle n=100</math>, and there are <math>\textstyle s_2=50</math> hidden units in layer <math>\textstyle L_2</math>. Note that
| |
- | we also have <math>\textstyle y \in \Re^{100}</math>. Since there are only 50 hidden units, the
| |
- | network is forced to learn a ''compressed'' representation of the input.
| |
- | I.e., given only the vector of hidden unit activations <math>\textstyle a^{(2)} \in \Re^{50}</math>,
| |
- | it must try to '''reconstruct''' the 100-pixel input <math>\textstyle x</math>. If the input were completely
| |
- | random---say, each <math>\textstyle x_i</math> comes from an IID Gaussian independent of the other
| |
- | features---then this compression task would be very difficult. But if there is
| |
- | structure in the data, for example, if some of the input features are correlated,
| |
- | then this algorithm will be able to discover some of those correlations. In fact,
| |
- | this simple autoencoder often ends up learning a low-dimensional representation very similar
| |
- | to PCAs.
| |
| | | |
- | 【初译】
| + | 为了对相对熵进行导数计算,我们可以使用一个易于实现的技巧,这只需要在你的程序中稍作改动即可。具体来说,前面在后向传播算法中计算第二层( <math>\textstyle l=2</math> )更新的时候我们已经计算了 |
| + | :<math>\begin{align} |
| + | \delta^{(2)}_i = \left( \sum_{j=1}^{s_{2}} W^{(2)}_{ji} \delta^{(3)}_j \right) f'(z^{(2)}_i), |
| + | \end{align}</math> |
| + | 现在我们将其换成 |
| + | :<math>\begin{align} |
| + | \delta^{(2)}_i = |
| + | \left( \left( \sum_{j=1}^{s_{2}} W^{(2)}_{ji} \delta^{(3)}_j \right) |
| + | + \beta \left( - \frac{\rho}{\hat\rho_i} + \frac{1-\rho}{1-\hat\rho_i} \right) \right) f'(z^{(2)}_i) . |
| + | \end{align}</math> |
| + | 就可以了。 |
| | | |
- | 自编码神经网络尝试学习一个 <math>\textstyle h_{W,b}(x) \approx x</math> 的函数。换句话说,它尝试逼近一个单位函数,从而使得输出 <math>\textstyle \hat{x}</math> 接近于输入 <math>\textstyle x</math> 。单位函数虽然看起来非常容易学习,但是当我们为自编码神经网络加入某些限制,比如限定隐藏神经元的数量,我们就可以从输入数据中发现一些有趣的结构。举例来说,假设某个自编码神经网络的输入 <math>\textstyle x</math> 是一张 <math>\textstyle 10 \times 10</math> 图像的像素值,于是 <math>\textstyle n=100</math> ,其隐层 <math>\textstyle L_2</math> 中有 <math>\textstyle s_2=50</math> 个隐藏神经元 。注意,输出是100维的 <math>\textstyle y \in \Re^{100}</math> 。由于只有50个隐藏神经元,我们迫使自编码神经网络去学习输入数据的'''压缩'''表示,因为它需要从50维的隐藏神经元激活度向量 <math>\textstyle a^{(2)} \in \Re^{50}</math> 中'''重构'''出100维的像素值输入 <math>\textstyle x</math> 。如果网络的输入数据是完全随机的,比如每一个输入 <math>\textstyle x_i</math> 都是一个跟其它特征完全无关的独立同分布高斯随机变量,那么这一压缩表示将会非常难学习。但是如果输入数据中隐含着一些特定的结构,比如某些输入特征是相关的,那么这一算法就可以发现输入数据中的这些相关性。事实上,这一简单的自编码神经网络通常可以学习出一个跟主元分析(PCA)结果非常相似的输入数据的低维表示。
| |
| | | |
- | 【一审】
| + | 有一个需要注意的地方就是我们需要知道 <math>\textstyle \hat\rho_i</math> 来计算这一项更新。所以在计算任何神经元的后向传播之前,你需要对所有的训练样本计算一遍前向传播,从而获取平均激活度。如果你的训练样本可以小到被整个存到内存之中(对于编程作业来说,通常如此),你可以方便地在你所有的样本上计算前向传播并将得到的激活度存入内存并且计算平均激活度 。然后你就可以使用事先计算好的激活度来对所有的训练样本进行后向传播的计算。如果你的数据量太大,无法全部存入内存,你就可以扫过你的训练样本并计算一次前向传播,然后将获得的结果累积起来并计算平均激活度 <math>\textstyle \hat\rho_i</math> (当某一个前向传播的结果中的激活度 <math>\textstyle a^{(2)}_i</math> 被用于计算平均激活度 <math>\textstyle \hat\rho_i</math> 之后就可以将此结果删除)。然后当你完成平均激活度 <math>\textstyle \hat\rho_i</math> 的计算之后,你需要重新对每一个训练样本做一次前向传播从而可以对其进行后向传播的计算。对于后一种情况,你对每一个训练样本需要计算两次前向传播,所以在计算上的效率会稍低一些。 |
| | | |
- | 自编码算法要做的是学习得到一个函数 <math>\textstyle h_{W,b}(x) \approx x</math> 。换句话说,就是要为这个恒等函式学习找到一个近似值,从而使得输出 <math>\textstyle \hat{x}</math> 接近于输入 <math>\textstyle x</math> 。虽然学习这个恒等函式看起来是非常繁琐的事,但是通过对这个神经网络加入某些限制,比如限定隐藏层神经元的数量,我们就可以从输入数据中发现一些有趣的结构。举例来说,假设某个自编码神经网络的输入 <math>\textstyle x</math> 是一张分辨率为 <math>\textstyle 10 \times 10</math> 的图像(100个像素点),于是 <math>\textstyle n=100</math> ,其隐藏层 <math>\textstyle L_2</math> 中有50个隐藏神经元 ,注意 。由于只有50个隐藏神经元,就迫使神经网络要为输入值学习获取一个'''经过压缩的'''表示方式。也就是说,给定一个隐藏层的激活向量 <math>\textstyle a^{(2)} \in \Re^{50}</math> ,必须对有100个像素值的输入 <math>\textstyle x</math> 进行'''重构'''。如果输入是随机的――即,每个 <math>\textstyle x_i</math> 都彼此独立,并服从独立同高斯分布――那么这种压缩工作就会变得异常困难。但是,如果样本数据内部存在某种相关结构,比如,如果输入数据中某些特征变量是相关的,那么这种算法就可以找出这些相关关系。事实上,这种基本的自编码算法通常就能学习得到一个低维度的数据表现方式,它跟主成分分析方法很像。
| + | 证明上面算法能达到梯度下降效果的完整推导过程不再本教程的范围之内。不过如果你想要使用经过以上修改的后向传播来实现自编码神经网络,那么你就会对目标函数 <math>\textstyle J_{\rm sparse}(W,b)</math> 做梯度下降。使用梯度验证方法,你可以自己来验证梯度下降算法是否正确。。 |
| | | |
- | 【二审】
| |
| | | |
- | 自编码神经网络尝试学习一个 <math>\textstyle h_{W,b}(x) \approx x</math> 的函数。换句话说,它尝试逼近一个恒等函数,从而使得输出 <math>\textstyle \hat{x}</math> 接近于输入 <math>\textstyle x</math> 。恒等函数虽然看上去不太有学习的意义,但是当我们为自编码神经网络加入某些限制,比如限定隐藏神经元的数量,我们就可以从输入数据中发现一些有趣的结构。举例来说,假设某个自编码神经网络的输入 <math>\textstyle x</math> 是一张 <math>\textstyle 10 \times 10</math> 图像(共100个像素)的像素灰度值,于是 <math>\textstyle n=100</math> ,其隐藏层 <math>\textstyle L_2</math> 中有50个隐藏神经元。注意,输出也是100维的 <math>\textstyle y \in \Re^{100}</math> 。由于只有50个隐藏神经元,我们迫使自编码神经网络去学习输入数据的'''压缩'''表示,也就是说,它必须从50维的隐藏神经元激活度向量 <math>\textstyle a^{(2)} \in \Re^{50}</math> 中'''重构'''出100维的像素灰度值输入 <math>\textstyle x</math> 。如果网络的输入数据是完全随机的,比如每一个输入 <math>\textstyle x_i</math> 都是一个跟其它特征完全无关的独立同分布高斯随机变量,那么这一压缩表示将会非常难学习。但是如果输入数据中隐含着一些特定的结构,比如某些输入特征是彼此相关的,那么这一算法就可以发现输入数据中的这些相关性。事实上,这一简单的自编码神经网络通常可以学习出一个跟主元分析(PCA)结果非常相似的输入数据的低维表示。
| + | ==中英文对照== |
| | | |
- | 【原文】
| + | :自编码算法 Autoencoders |
| + | :稀疏性 Sparsity |
| + | :神经网络 neural networks |
| + | :监督学习 supervised learning |
| + | :无监督学习 unsupervised learning |
| + | :反向传播算法 backpropagation |
| + | :隐藏神经元 hidden units |
| + | :像素灰度值 the pixel intensity value |
| + | :独立同分布 IID |
| + | :主元分析 PCA |
| + | :激活 active |
| + | :抑制 inactive |
| + | :激活函数 activation function |
| + | :激活度 activation |
| + | :平均活跃度 the average activation |
| + | :稀疏性参数 sparsity parameter |
| + | :惩罚因子 penalty term |
| + | :相对熵 KL divergence |
| + | :伯努利随机变量 Bernoulli random variable |
| + | :总体代价函数 overall cost function |
| + | :后向传播 backpropagation |
| + | :前向传播 forward pass |
| + | :梯度下降 gradient descent |
| + | :目标函数 the objective |
| + | :梯度验证方法 the derivative checking method |
| | | |
- | Our argument above relied on the number of hidden units <math>\textstyle s_2</math> being small. But
| + | ==中文译者== |
- | even when the number of hidden units is large (perhaps even greater than the
| + | |
- | number of input pixels), we can still discover interesting structure, by
| + | |
- | imposing other constraints on the network. In particular, if we impose a
| + | |
- | '''sparsity''' constraint on the hidden units, then the autoencoder will still
| + | |
- | discover interesting structure in the data, even if the number of hidden units
| + | |
- | is large.
| + | |
| | | |
- | Informally, we will think of a neuron as being "active" (or as "firing") if
| + | 周韬(ztsailing@gmail.com),葛燕儒(yrgehi@gmail.com),林锋(xlfg@yeah.net),余凯(kai.yu.cool@gmail.com) |
- | its output value is close to 1, or as being "inactive" if its output value is
| + | |
- | close to 0. We would like to constrain the neurons to be inactive most of the
| + | |
- | time. This discussion assumes a sigmoid activation function. If you are
| + | |
- | using a tanh activation function, then we think of a neuron as being inactive
| + | |
- | when it outputs values close to -1.
| + | |
| | | |
- | 【初译】
| |
| | | |
- | 我们刚才的论述需要基于隐藏神经元数量较小的假设,但是即使隐藏神经元的数量较大(可能比输入像素的个数还要多),我们仍然通过给自编码神经网络施加一些其他的限制条件来发现输入数据中的结构。具体来说,如果我们给隐藏神经元加入'''稀疏性'''限制,那么自编码神经网络即使在隐藏神经元数量较多的情况下仍然可以发现输入数据中一些有趣的结构。
| + | {{稀疏自编码器}} |
| | | |
- | 稀疏性可以被简单地解释如下。如果当神经元的输出接近于1的时候我们认为它被激活,而输出接近于0的时候认为它被抑制,那么使得神经元大部分的时间都是被抑制的限制则被称作稀疏性限制。这里我们假设神经元的激活函数是sigmoid函数。如果你使用tanh作为激活函数,那么当输出为-1的时候,我们认为神经元是被抑制的。
| |
| | | |
- | 【一审】
| + | {{Languages|Autoencoders_and_Sparsity|English}} |
- | | + | |
- | 以上我们所讨论的都有基于隐藏层单元数量是很小的情况。但是即使隐藏层单元数量很大(甚至可能比输入像素的数量还大),只要给这个神经网络加入其他限制条件,我们还是可以发现某种有意思的相关结构。打个比方,如果我们给隐藏层单元加上“稀疏性”限制,那么即使隐藏层单元数量很大,自编码算法仍然可以在输入数据中找到这种有意思的结构。
| + | |
- | | + | |
- | 如果某个神经元的输出值接近于1,我们就给此神经元一个非专业的说法“活性”(或“易燃”),而如果输出值接近于0,就称之为“惰性”。大多数情况下,我们都想把这些神经元限制为惰性。这里我们假设激活函数是sigmoid函数。如果你使用tanh激活函数,那么当一个神经元的输出值接近于-1时,它才是惰性的。
| + | |
- | | + | |
- | 【二审】
| + | |
- | | + | |
- | 我们刚才的论述是基于隐藏神经元数量较小的假设。但是即使隐藏神经元的数量较大(可能比输入像素的个数还要多),我们仍然通过给自编码神经网络施加一些其他的限制条件来发现输入数据中的结构。具体来说,如果我们给隐藏神经元加入稀疏性限制,那么自编码神经网络即使在隐藏神经元数量较多的情况下仍然可以发现输入数据中一些有趣的结构。
| + | |
- | | + | |
- | 稀疏性可以被简单地解释如下。如果当神经元的输出接近于1的时候我们认为它被激活,而输出接近于0的时候认为它被抑制,那么使得神经元大部分的时间都是被抑制的限制则被称作稀疏性限制。这里我们假设的神经元的激活函数是sigmoid函数。如果你使用tanh作为激活函数的话,当神经元输出为-1的时候,我们认为神经元是被抑制的。
| + | |
- | | + | |
- | 【原文】
| + | |
- | | + | |
- | Recall that <math>\textstyle a^{(2)}_j</math> denotes the activation of hidden unit <math>\textstyle j</math> in the
| + | |
- | autoencoder. However, this notation doesn't make explicit what was the input <math>\textstyle x</math>
| + | |
- | that led to that activation. Thus, we will write <math>\textstyle a^{(2)}_j(x)</math> to denote the activation
| + | |
- | of this hidden unit when the network is given a specific input <math>\textstyle x</math>. Further, let
| + | |
- | :<math>\begin{align}
| + | |
- | \hat\rho_j = \frac{1}{m} \sum_{i=1}^m \left[ a^{(2)}_j(x^{(i)}) \right]
| + | |
- | \end{align}</math>
| + | |
- | be the average activation of hidden unit <math>\textstyle j</math> (averaged over the training set).
| + | |
- | We would like to (approximately) enforce the constraint
| + | |
- | :<math>\begin{align}
| + | |
- | \hat\rho_j = \rho,
| + | |
- | \end{align}</math>
| + | |
- | where <math>\textstyle \rho</math> is a '''sparsity parameter''', typically a small value close to zero
| + | |
- | (say <math>\textstyle \rho = 0.05</math>). In other words, we would like the average activation
| + | |
- | of each hidden neuron <math>\textstyle j</math> to be close to 0.05 (say). To satisfy this
| + | |
- | constraint, the hidden unit's activations must mostly be near 0.
| + | |
- | | + | |
- | 【初译】
| + | |
- | | + | |
- | 注意到 <math>\textstyle a^{(2)}_j</math> 表示隐藏神经元 <math>\textstyle j</math> 的激活度,但是这一表示方法中并未明确指出哪一个输入 <math>\textstyle x</math> 带来了这一激活度。所以我们将使用 <math>\textstyle a^{(2)}_j(x)</math> 来表示在输入为 <math>\textstyle x</math> 情况下,自编码神经网络隐藏神经元 <math>\textstyle j</math> 的激活度。
| + | |
- | 进一步,让
| + | |
- | :<math>\begin{align}
| + | |
- | \hat\rho_j = \frac{1}{m} \sum_{i=1}^m \left[ a^{(2)}_j(x^{(i)}) \right]
| + | |
- | \end{align}</math>
| + | |
- | 表示隐藏神经元 <math>\textstyle j</math> 的平均活跃度(在训练集上取平均)。我们可以近似的加入一条限制
| + | |
- | :<math>\begin{align}
| + | |
- | \hat\rho_j = \rho,
| + | |
- | \end{align}</math>
| + | |
- | 其中, <math>\textstyle \rho</math> 是'''稀疏性参数''',通常是一个接近于0的较小的值(比如 <math>\textstyle \rho = 0.05</math> )。换句话说,我们想要让隐藏神经元 <math>\textstyle j</math> 的平均活跃度接近0.05。为了满足这一条件,隐藏神经元的活跃度必须接近于0。
| + | |