I wonder, if someone could please check/help me with this simple code:
import numpy as np
import matplotlib.pyplot as plt
def sigmoid(x):
var = -0.1
shift = 10
return np.exp(var*(x - 100)) / (1 + np.exp(var*(x - 100) ))
# return 1 / (1 + np.exp(-x))
def derivative(x, step):
return -5.0 * (sigmoid(x+step) - sigmoid(x)) / step
x = np.linspace(0, 200, 1000)
y1 = sigmoid(x)
y2 = derivative(x, 0.0000000000001)
plt.plot(x, y1, label='reverse sigmoid')
plt.plot(x, y2, label='derivative')
plt.legend(loc='upper right')
plt.show()
It is my basic attempt to plot the reverse sigmoid and its derivative inspired by other posts. The results look like so:
The derivative looks odd and ideally I want to inflate the height of its peak. Any help would be very much appreciated. Thanks!