LoginSignup
1
1

More than 3 years have passed since last update.

シグモイド関数をグラフにしてみる

Posted at

Jupyter を使ってやってみます。

import numpy as np
import matplotlib.pyplot as plt

def func_sigmoid(x):    # シグモイド関数
    return 1/(1+np.exp(-x))

def func_derivative_sigmoid(x):    # シグモイド関数の導関数
    y = func_sigmoid(x)
    return (1-y)*y

x = np.linspace(-5, 5)
y = func_sigmoid(x)
y_derivative = func_derivative_sigmoid(x)

plt.plot(x, y, label="sigmoid")
plt.plot(x, y_derivative, label="derivative")
plt.legend()

plt.xlabel("x", size=14)
plt.ylabel("y", size=14)

plt.show()

image.png

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