Skip to content

Instantly share code, notes, and snippets.

@f0nzie
Created September 7, 2017 00:35
Show Gist options
  • Save f0nzie/61a092285fe0ffdf08b8a2f5bbbc5ed1 to your computer and use it in GitHub Desktop.
Save f0nzie/61a092285fe0ffdf08b8a2f5bbbc5ed1 to your computer and use it in GitHub Desktop.
Compute the sigmoid of x
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment