matplotlibで簡単にグラフを書く
1933 ワード
あれ、あのグラフってどんな感じだったっけ?というときにさらっと書いて確認したい(のでWarningとかが出ても気にしない)。
Log
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(0, 10, 0.01)
y = np.log(x)
plt.grid()
plt.plot(x,y)
plt.show()
Sigmoid
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(-10, 10, 0.01)
y = 1 / (1 + np.exp(-x))
plt.grid()
plt.plot(x,y)
plt.show()
tanh
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(-10, 10, 0.01)
y = (np.exp(x)-np.exp(-x))/(np.exp(x)+np.exp(-x))
plt.grid()
plt.plot(x,y)
plt.show()
Relu
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(-10, 10, 0.01)
y = np.maximum(0, x)
plt.grid()
plt.plot(x,y)
plt.show()
Author And Source
この問題について(matplotlibで簡単にグラフを書く), 我々は、より多くの情報をここで見つけました https://qiita.com/lukapla/items/d2b41d9ea3f1cee0b1d8著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .