Sigmoid prime Python 1

Sigmoid prime Python

class Sigmoid:
    def __call__(self, z):
        """
        Compute the sigmoid of z
        Arguments:
        z -- scalar or numpy array of any size.
        Return:
        sigmoid(z)
        """
        sigmoid = 1/np.exp(-z)
        return sigmoid
    
    def prime(self, z):  # Questions need some help --- Thanks!
        """
        Compute the derivative of sigmoid of z
        Arguments:
        z -- scalar or numpy array of any size.
        Return:
        Sigmoid prime
        """
        ###return sigmoid * (1 - sigmoid)

Here is what the above code is Doing:
1. We create a class called Sigmoid.
2. We define a function __call__ which takes an argument z.
3. We then use the sigmoid function to compute the sigmoid of z.
4. We define a function prime which takes an argument z.
5. We then compute the derivative of the sigmoid function evaluated at z.

Similar Posts