9

Google的激活函数Swish是怎么设计出来的?

 2 years ago
source link: https://allenwind.github.io/blog/9999/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
Mr.Feng Blog

NLP、深度学习、机器学习、Python、Go

Google的激活函数Swish是怎么设计出来的?

Google的激活函数Swish是怎么设计出来的?

Google的激活函数Swish为,

swish(x)=x⋅σ(x)swish⁡(x)=x⋅σ(x)

σ(x)σ(x)可以看做是控制xx流通程度的阀门,那么它是怎么设计出来呢?

接着上一篇的思路Sigmoid函数导出的另外一个角度,我们获得导出Google的激活函数Swish的一个思路。首先我们知道Heaviside step函数的分段式定义,

H(x)={1,x>00,x≤0H(x)={1,x>00,x≤0

于是激活函数relu(x)relu⁡(x)可以使用它定义,

relu(x)=x×H(x)relu⁡(x)=x×H(x)

沿着上一篇文章的思路容易获得激活函数Swish的导出,

relu(x)=x×H(x)=x×ddxmax{0,x}≈x×ddxln(1+ex)=x×ex1+ex=x×11+e−x=x⋅σ(x)relu⁡(x)=x×H(x)=x×ddxmax{0,x}≈x×ddxln⁡(1+ex)=x×ex1+ex=x×11+e−x=x⋅σ(x) relu(x)≈x⋅σ(x)=swish(x)relu⁡(x)≈x⋅σ(x)=swish⁡(x)

也就是说,Google的激活函数Swish是激活函数relu(x)relu⁡(x)的光滑近似,这样导出的激活函数在x=0x=0处是可微的。

类似地,考虑函数光滑近似(1):maximum函数中的结论,

max(x1,x2,…,xn)≈n∑i=1xieαxin∑i=1eαxi,α>0max(x1,x2,…,xn)≈∑i=1nxieαxi∑i=1neαxi,α>0

取x1=0,x2=xx1=0,x2=x​​有特例,

max(0,x)≈xeαx1+eαx=xσ(αx)max(0,x)≈xeαx1+eαx=xσ(αx)

α=1α=1即得激活函数Swish。

本文从光滑近似的角度给出Google的激活函数Swish的导出思路。

转载请包括本文地址:https://allenwind.github.io/blog/9999
更多文章请参考:https://allenwind.github.io/blog/archives/


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK