-2

How can I create a reverse sigmoid function? I have created the following one but am not getting the desired output.

def sigmoid(x):
  return - (1 / (1 + math.exp(0.5*x)))

x= np.linspace(0,5,100)
y = np.vectorize(sigmoid)
plt.plot(x,y(x))

Please notice the x range should be between 0 -5

UPDATE :

I am looking for the following shape

enter image description here

1 Answers1

0

If you just want to invert the x axis, you want a function such that g(x) = sigmoid(-x), your definition should be:

def rev_sigmoid(x):
  return (1 / (1 + math.exp(0.5*x)))

x= np.linspace(-10,10,100)
y = np.vectorize(rev_sigmoid)
plt.plot(x,y(x))
nonDucor
  • 2,057
  • 12
  • 17