自编码算法与稀疏性
From Ufldl
Line 263: | Line 263: | ||
J_{\rm sparse}(W,b) = J(W,b) + \beta \sum_{j=1}^{s_2} {\rm KL}(\rho || \hat\rho_j), | J_{\rm sparse}(W,b) = J(W,b) + \beta \sum_{j=1}^{s_2} {\rm KL}(\rho || \hat\rho_j), | ||
\end{align}</math> | \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(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> 。 |
【一审】 | 【一审】 | ||
- | 我们看到,KL距离在 处达到了最小值0,而当 接近于0或1时,KL距离逐渐增大(最终达到 )。因此,要最小化这个惩罚项就等同于让 接近于 。 | + | 我们看到,KL距离在 <math>\textstyle \hat\rho_j = \rho</math> 处达到了最小值0,而当 <math>\textstyle \hat\rho_j</math> 接近于0或1时,KL距离逐渐增大(最终达到 <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> 。 | ||
Line 276: | Line 278: | ||
- | 我们可以看出,相对熵在 | + | 我们可以看出,相对熵在 <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> 。 |