Exercise: Plotting the Sigmoid Function

Learn how to define a sigmoid function, then create a plot of the sigmoid and examine its relationship to the exponential function.

Defining a function for the sigmoid

In this exercise, we will use X_exp and Y_exp, created previously, to make a plot of what the exponential function looks like over the interval [-4, 4]. Then we will define a function for the sigmoid, create a plot of that, and consider how it is related to the exponential function. Perform the following steps to complete the exercise:

  1. Use this code to plot the exponential function:

    plt.plot(X_exp, Y_exp) 
    plt.title('Plot of $e^X$')
    

    The plot should look like this:

Get hands-on with 1200+ tech skills courses.