0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

活性化関数

Posted at

シグモイド関数

f(x) = \frac{1}{1 + e^{-x}}
def sigmoid(x):
    return 1 / (1 + np.exp(-x))

x = np.arange(-7, 7, 0.1)
y = sigmoid(x)

plt.plot(x, y)
plt.title('Sigmoid Function')
plt.xlabel('x')
plt.ylabel('sigmoid(x)')
plt.grid(True)
plt.show()

image.png

ステップ関数

def step(x):
    return np.array(x>0).astype(np.int)

    x = np.arange(-5,5,0.1)
    y = step(x) 
    plt.plot(x,y)
    plt.xlabel("x")
    plt.ylabel("y")
    plt.ylim([-0.1,1.1])
    plt.show()

image.png

ReLU関数

Vdef relu(x):
    return np.maximum(0, x)

# グラフを描画するための入力値を生成
x = np.arange(-5, 5, 0.1)
y = relu(x)

# グラフの描画
plt.plot(x, y)
plt.title('ReLU Function')
plt.xlabel('x')
plt.ylabel('relu(x)')
plt.grid(True)
plt.show()

image.png

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?