活性化関数 ReLu関数

f:id:JedenTag:20180130235702p:plain


性質
微分すると、負の時は0、正の時は1


効果
・勾配を消失する
・学習が早い(計算が早い)

ポイント
ニューロンに値を入力されても、xが負の時は0なのでかわらないために、常に同じ値を出すことがある
➡ Leaky Reluは負の時も少し勾配をもたせている

import numpy as np
import matplotlib.pyplot as plt


#ReLu :ランプ関数
def ReLu(x):
    return x * (x > 0)

x = np.arange(-10,10,0.1)

y = ReLu(x)

plt.plot(x, y)
plt.xlabel("ReLu")