sigmoid 函数

目录


    公式
    $ g(z) = frac{1}{1+e^{-z}} $

    • (g:mathbb{R} o [0,1])
    • (g(0)=0.5)
    • (g(- infty)=0)
    • (g(+ infty)=1)
    def sigmoid(z):
        return 1 / (1 + np.exp(-z))
    
    nums = np.arange(-10, 10, step=1) #creates a vector containing 20 equally spaced values from -10 to 10
    fig, ax = plt.subplots(figsize=(12,4))
    ax.plot(nums, sigmoid(nums), 'r')
    

    原文地址:https://www.cnblogs.com/fldev/p/14361999.html