This is a sigmoid function:
I know x. How can I calculate F(x) in Python now?
Let's say x = 0.458.
F(x) = ?
This is a sigmoid function:
I know x. How can I calculate F(x) in Python now?
Let's say x = 0.458.
F(x) = ?
This should do it:
import math
def sigmoid(x):
return 1 / (1 + math.exp(-x))
And testing it:
>>> sidmoid(0.458)
0.61253961344091512
another way
>>> def sigmoid(x):
... return 1 /(1+(math.e**-x))
...
>>> sigmoid(0.458)