x = 0 近傍での正規化線形関数(青)およびソフトプラス関数(緑)のプロット
正規化線形関数 (せいきかせんけいかんすう、英 : Rectified linear function あるいは単にrectifier [ 注釈 1] とも)は、引数 の正の部分として定義される活性化関数 であり、次のように表される。
f
(
x
)
=
x
+
=
max
(
0
,
x
)
{\displaystyle f(x)=x^{+}=\max(0,x)}
上式において、
x
{\displaystyle x}
はニューロンへの入力である。これはランプ関数 (傾斜路関数)としても知られ、電気工学における半波整流回路 と類似している。この活性化関数は、1993年にTangらによって新しいニューロンモデルとして最初に提案され、ニューラルネットワークの学習に適用し、その有効性が示された[ 1] 。2000年にHahnloseらによって強い生物学 的動機と数学的正当化を持って、動的ネットワークへに導入された[ 2] [ 3] 。2011年以前に広く使われていた活性化関数、例えばロジスティックシグモイド (これは確率論 から発想を得ている。ロジスティック回帰 を参照。)およびそのより実践的な[ 4] 機能的に同等な関数である双曲線正接関数 と比較して、より深いネットワークのより良い訓練を可能にすることが2011年に初めて実証された[ 5] 。2018年現在、ディープニューラルネットワーク で最も広く使われている活性化関数が、この正規化線形関数である[ 6] [ 7] 。
正規化線形関数を利用したユニットは正規化線形ユニット (rectified linear unit、ReLU )とも呼ばれる[ 8] 。
正規化線形ユニットはディープニューラルネットワークを用いたコンピュータビジョン [ 5] や音声認識 [ 9] [ 10] に応用されている。
ソフトプラス
正規化線形関数に対する平滑化近似が解析関数
f
(
x
)
=
log
(
1
+
e
x
)
,
{\displaystyle f(x)=\log(1+e^{x}),}
であり、ソフトプラス (softplus)関数[ 11] [ 5] またはSmoothReLU 関数[ 12] と呼ばれる。ソフトプラスの導関数はロジスティック関数
f
′
(
x
)
=
e
x
1
+
e
x
=
1
1
+
e
−
x
{\displaystyle f'(x)={\frac {e^{x}}{1+e^{x}}}={\frac {1}{1+e^{-x}}}}
である。ロジスティック関数は、正規化線形関数の導関数であるヘヴィサイドの階段関数 の平滑化近似である。
単変数ソフトプラスの多変数一般化は、第一独立変数をゼロとしたLogSumExp関数 (英語版 )
L
S
E
0
+
(
x
1
,
.
.
.
,
x
n
)
:=
L
S
E
(
0
,
x
1
,
.
.
.
,
x
n
)
=
log
(
1
+
e
x
1
+
⋯
+
e
x
n
)
.
{\displaystyle LSE_{0}^{+}(x_{1},...,x_{n}):=LSE(0,x_{1},...,x_{n})=\log \left(1+e^{x_{1}}+\cdots +e^{x_{n}}\right).}
である。LogSumExp関数自身は
L
S
E
(
x
1
,
…
,
x
n
)
=
log
(
e
x
1
+
⋯
+
e
x
n
)
,
{\displaystyle \mathrm {LSE} (x_{1},\dots ,x_{n})=\log \left(e^{x_{1}}+\cdots +e^{x_{n}}\right),}
であり、その勾配はソフトマックス関数 である。第一独立変数がゼロのソフトマックスは、ロジスティック関数の多変数一般化である。LogSumExpとソフトマックスはどちらも機械学習 に用いられる。
派生物
ノイジーReLU
正規化線形ユニットはガウス雑音 を含むように拡張できる。これはnoisy(雑音のある)ReLUと呼ばれ、以下の式を与える[ 8] 。
f
(
x
)
=
max
(
0
,
x
+
Y
)
{\displaystyle f(x)=\max(0,x+Y)}
, with
Y
∼
N
(
0
,
σ
(
x
)
)
{\displaystyle Y\sim {\mathcal {N}}(0,\sigma (x))}
Noisy ReLUはコンピュータビジョン問題のための制限ボルツマンマシン (英語版 ) において使用され、ある程度の成功を挙げている[ 8] 。
漏洩ReLU
漏洩(リーキー、Leaky)ReLUは、ユニットがアクティブでない時に小さな正の勾配を許容する[ 10] 。
f
(
x
)
=
{
x
if
x
>
0
0.01
x
otherwise
{\displaystyle f(x)={\begin{cases}x&{\mbox{if }}x>0\\0.01x&{\mbox{otherwise}}\end{cases}}}
パラメトリックReLU
パラメトリックReLU (PReLU) はさらにこの着想を発展させ、漏れの係数を他のニューラルネットワークのパラメータと同時に学習する[ 13] 。
f
(
x
)
=
{
x
if
x
>
0
a
x
otherwise
{\displaystyle f(x)={\begin{cases}x&{\mbox{if }}x>0\\ax&{\mbox{otherwise}}\end{cases}}}
a
≤
1
{\displaystyle a\leq 1}
について、これは
f
(
x
)
=
max
(
x
,
a
x
)
{\displaystyle f(x)=\max(x,ax)}
と等価であり、ゆえに「マックスアウト」ネットワークとの関連があることに留意すべきである[ 13] 。
ELU
指数関数的線形ユニット(Exponential linear unit)は、学習を高速化するため、平均活性化をゼロに近づけようと試みる。ReLUよりも高い分類制度を得ることができると示されている[ 14] 。
f
(
x
)
=
{
x
if
x
>
0
a
(
e
x
−
1
)
otherwise
{\displaystyle f(x)={\begin{cases}x&{\mbox{if }}x>0\\a(e^{x}-1)&{\mbox{otherwise}}\end{cases}}}
a
{\displaystyle a}
はチューニングされるハイパーパラメータ (英語版 ) 、
a
≥
0
{\displaystyle a\geq 0}
は定数である。
Swish
Swish関数、もしくはシグモイド重み付き線形ユニット (Sigmoid-weighted linear unit) はReLUに類似した曲線を描くが、その曲線は連続的 であり無限階微分可能 である。ReLU及び先述した派生形よりも高い分類精度を得ることができると示されている[ 15] [ 16] 。
f
(
x
)
=
x
∗
σ
(
x
)
{\displaystyle f(x)=x*\sigma (x)}
なお、ここでは
σ
(
x
)
{\displaystyle \sigma (x)}
は以下の数式によって定義される標準シグモイド関数 を表す。
σ
(
x
)
=
1
1
+
e
−
x
{\displaystyle \sigma (x)={\tfrac {1}{1+e^{-x}}}}
Funnel Activation
Funnel Activation、もしくはFReLUはコンピュータビジョン に特化した活性化関数であり、二次元の画像に対して適応することを前提として設計されたものである[ 17] 。性質上、Funnel Activationを一つの値を入力とする関数として表すことはできないが、記述の都合上以下の数式で表される。
f
(
x
)
=
max
(
x
,
T
(
x
)
)
{\displaystyle f(x)=\max(x,\mathbb {T} (x))}
なお、
T
(
x
)
{\displaystyle \mathbb {T} (x)}
は他のニューラルネットワークのパラメータと同時に学習されるDepthwise 畳み込みモジュール である。
長所
生物学的妥当性
疎な活性化
例えば、無作為に初期化されたネットワークでは、隠れユニットの約50%のみが活性化される(ゼロでない出力を持つ)。
より良い勾配伝搬
両方向に飽和するシグモイド活性化関数と比較して、勾配消失問題 が少ない。
効率的計算
スケールによって影響を受けない
max
(
0
,
a
x
)
=
a
max
(
0
,
x
)
f
o
r
a
≥
0
{\displaystyle \max(0,ax)=a\max(0,x)\quad \mathrm {for} \;a\geq 0}
。
正規化線形関数は、複数のコンピュータビジョン課題を学習するために教師ありで訓練されたニューラル抽象ピラミッド (Neural Abstraction Pyramid) において特異的興奮と非特異的抑制を分離するために用いられた[ 18] 。2011年[ 5] 、非線形関数としての正規化線形関数の使用は、教師なし 事前学習を必要とせずに教師あり ディープニューラルネットワークの訓練を可能にすることが示されている。正規化線形ユニットは、シグモイド関数 または類似の活性化関数と比較して、大きく複雑なデータセット上のディープニューラル構造のより速く、効率的な訓練を可能にする。
潜在的な問題
原点において微分不可能
しかしながら、その点以外ではどこでも微分可能であり、入力が0の点を埋めるために0または1の値を任意に選ぶことができる。
原点を中心としていない
有界でない
Dying ReLU問題
ReLUニューロンは、実質的に全ての入力に対して不活性となる状態に入り込むことがあり得る。この状態において、勾配はこのニューロンを通って逆方向に流れないため、このニューロンは永久に不活性な状態で動かなくなり、「死」んでしまう。これは勾配消失問題の一種である。ある場合において、ネットワーク中の多くのニューロンが死状態で動かなることがありえて、これはモデル容量を著しく低下させる。この問題は高過ぎる学習率が設定されている時に典型的に起こる。代わりに、x = 0の左側に小さな正の勾配を割り当てるリーキーReLUを用いることによって問題を緩和することができる。
脚注
注釈
出典
^ Tang, Z.; Ishizuka, O.; Matsumoto, H. (1993). “A Model of Neurons with Unidirectional Linear Response”. IEICE Trans. on Fundamentals Vol.E76-A (No.9): pp.1537-1540.
^ Hahnloser, R.; Sarpeshkar, R.; Mahowald, M. A.; Douglas, R. J.; Seung, H. S. (2000). “Digital selection and analogue amplification coexist in a cortex-inspired silicon circuit”. Nature 405 : 947–951. doi :10.1038/35016072 .
^ R Hahnloser; H.S. Seung (2001). Permitted and Forbidden Sets in Symmetric Threshold-Linear Networks . NIPS 2001.
^ Yann LeCun, Leon Bottou, Genevieve B. Orr and Klaus-Robert Müller (1998). "Efficient BackProp" (PDF) . In G. Orr and K. Müller (ed.). Neural Networks: Tricks of the Trade . Springer.
^ a b c d Xavier Glorot; Antoine Bordes; Yoshua Bengio (2011). Deep sparse rectifier neural networks (PDF) . AISTATS. Rectifier and softplus activation functions. The second one is a smooth version of the first.
^ LeCun, Yann; Bengio, Yoshua; Hinton, Geoffrey (2015). “Deep learning”. Nature 521 (7553): 436–444. Bibcode : 2015Natur.521..436L . doi :10.1038/nature14539 . PMID 26017442 .
^ Ramachandran, Prajit; Barret, Zoph; Quoc, V. Le (16 October 2017). "Searching for Activation Functions". arXiv :1710.05941 [cs.NE ]。
^ a b c Vinod Nair; Geoffrey Hinton (2010). Rectified Linear Units Improve Restricted Boltzmann Machines (PDF) . ICML .
^ László Tóth (2013). Phone Recognition with Deep Sparse Rectifier Neural Networks (PDF) . ICASSP .
^ a b Andrew L. Maas, Awni Y. Hannun, Andrew Y. Ng (2014). Rectifier Nonlinearities Improve Neural Network Acoustic Models
^ Dugas, Charles; Bengio, Yoshua; Bélisle, François; Nadeau, Claude; Garcia, René (2000-01-01). “Incorporating second-order functional knowledge for better option pricing” . Proceedings of the 13th International Conference on Neural Information Processing Systems (NIPS'00) (MIT Press): 451–457. http://papers.nips.cc/paper/1920-incorporating-second-order-functional-knowledge-for-better-option-pricing.pdf . "Since the sigmoid h has a positive first derivative, its primitive, which we call softplus, is convex"
^ “Smooth Rectifier Linear Unit (SmoothReLU) Forward Layer ” (英語). Developer Guide for Intel® Data Analytics Acceleration Library (2017年). 2018年12月4日閲覧。
^ a b He, Kaiming; Zhang, Xiangyu; Ren, Shaoqing; Sun, Jian (2015). "Delving Deep into Rectifiers: Surpassing Human-Level Performance on Image Net Classification". arXiv :1502.01852 [cs.CV ]。
^ Clevert, Djork-Arné; Unterthiner, Thomas; Hochreiter, Sepp (2015). "Fast and Accurate Deep Network Learning by Exponential Linear Units (ELUs)". arXiv :1511.07289 [cs.LG ]。
^ “[活性化関数]シグモイド関数(Sigmoid function)とは? ”. @IT . 2021年11月28日閲覧。
^ Ramachandran, Prajit; Zoph, Barret; Le, Quoc V. (2017-10-16) (英語). Searching for Activation Functions . https://arxiv.org/abs/1710.05941v2 .
^ Ma, Ningning; Zhang, Xiangyu; Sun, Jian (2020-07-24). “Funnel Activation for Visual Recognition” . arXiv:2007.11824 [cs] . https://arxiv.org/abs/2007.11824 .
^ Behnke, Sven (2003). Hierarchical Neural Networks for Image Interpretation . Lecture Notes in Computer Science. 2766 . Springer. doi :10.1007/b11963 . https://www.researchgate.net/publication/220688219_Hierarchical_Neural_Networks_for_Image_Interpretation
関連項目
外部リンク