LoginSignup
2
2

More than 3 years have passed since last update.

深層学習/シグモイド関数の誤差逆伝播

Posted at

1.はじめに

 シグモイド関数の誤差逆伝播についてまとめる

2.シグモイド関数の微分

 シグモイ度関数の微分は、美しくシンプルな形をしている。

sigmoid関数:

sigmoid(x) = \frac{1}{1+e^{-x}}

sigmoid関数の微分:

sigmoid'(x) = \frac{1}{1+e^{-x}} * ( 1 - \frac{1}{1+e^{-x}})

3.シグモイド関数のコード

 従って、シグモイド関数の誤差逆伝播コードも以下の様にシンプルとなる。

Class Sigmoid(object):
   def __init__(self, x):
       self.x = x

   def forward(self):
       y = 1.0 / (1.0 + np.exp(- self.x))
       self.y = y
       return y

   def backward(self, grad_to_y):
       grad_to_x = grad_to_y * self.y * (1.0 - self.y)
       return grad_to_x
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2