Phone

+919997782184

Email

support@roboticswithpython.com

Geeks of Coding

Join us on Telegram

Home Forums Cody Bank Implement the sigmoid function using numpy

Viewing 0 reply threads
  • Author
    Posts
    • #261
      Abhishek TyagiAbhishek Tyagi
      Keymaster

      The data structures we use in numpy to represent these shapes (vectors, matrices) are called numpy arrays. You don’t need to know more for now.
      For x∈ℝn,
      Post

      # GRADED FUNCTION: sigmoid

      import numpy as np # this means you can access numpy functions by writing np.function() instead of numpy.function()

      def sigmoid(x):
          """
          Compute the sigmoid of x
      
          Arguments:
          x -- A scalar or numpy array of any size
      
          Return:
          s -- sigmoid(x)
          """
          
          ### START CODE HERE ### (≈ 1 line of code)
          s = 1 / (1 + np.exp(-x))
          ### END CODE HERE ###
          
          return s
Viewing 0 reply threads
  • You must be logged in to reply to this topic.