LoginSignup
0
0

More than 5 years have passed since last update.

活性化関数をグラフ化

Last updated at Posted at 2017-04-17

概要

活性化関数をグラフ化してみた。

写真

figure_1-1.png

サンプルコード

import matplotlib.pyplot as plt
import numpy as np

def tanh(x):
    return np.tanh(x);
def relu(x):
    return np.maximum(0, x)
def sigmoid(x):
    return 1.0 / (1.0 + np.exp(-x))
x = np.linspace(-1.0, 1.0, 100)
plt.plot(x, tanh(x), label = "tanh")
plt.plot(x, relu(x), label = "relu")
plt.plot(x, sigmoid(x), label = "sigmoid")
plt.legend()
plt.show()

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