、、を読んでいて、logistig curveなるものが出てきた。いや、存在は知っていたんだが、ちょっとPythonで書けないもんか、、と思い、ちょこっとcodingしてみますた。
あ、単に、こういう式です:
$y=\frac{1}{1+\exp(-x)}$
コードはこんな感じ(このサイトを参考にしました):
#!/usr/bin/python # Numpy is a library for handling arrays (like data points) import numpy as np # Pyplot is a module within the matplotlib library for plotting import matplotlib.pyplot as plt # Create an array of 100 linearly-spaced points from -10 to 10 x = np.linspace(-15,15,100) y = 1/(1+np.exp(-x)) # Create the plot plt.plot(x,y) plt.title('logistic curve') # Save the figure in a separate file plt.savefig('logistic_function_plain.png') # Draw the plot to the screen plt.show()
0 件のコメント:
コメントを投稿