目錄html
更新、更全的《機器學習》的更新網站,更有python、go、數據結構與算法、爬蟲、人工智能教學等着你:http://www.javashuo.com/article/p-vozphyqp-cm.htmlpython
# Sigmoid函數詳解圖例 import numpy as np import matplotlib.pyplot as plt ax = plt.subplot(111) ax.spines['right'].set_color('none') ax.spines['top'].set_color('none') ax.xaxis.set_ticks_position('bottom') ax.spines['bottom'].set_position(('data', 0)) ax.yaxis.set_ticks_position('left') ax.spines['left'].set_position(('data', 0)) x = np.linspace(-10, 10, 256) y = 1 / (1 + np.exp(-x)) plt.plot(x, y, c='r', label='Sigmoid') # 描繪y=0.5和y=1.0兩條直線 plt.yticks([0.0,0.5,1.0]) ax = plt.gca() ax.yaxis.grid(True) plt.xlabel('z') plt.ylabel('g(z)') plt.legend() plt.show()
上圖爲Sigmoid函數圖像,能夠看出當\(z\)趨於正無窮時,\(g(z)\)趨於1;當\(z\)趨於負無窮時,\(g(z)\)趨於0。算法