I feel that many may be interested in free parameters in order to change the shape of a sigmoid function. Secondly, for many applications you want to use a mirror sigmoid function. Thirdly, you can do a simple normalization, for example, the output values are in the range from 0 to 1.
Try:
def normalized_sigmoid_fkt(a, b, x): ''' Returns array of a horizontal mirrored normalized sigmoid function output between 0 and 1 Function parameters a = center; b = width ''' s= 1/(1+np.exp(b*(xa))) return 1*(s-min(s))/(max(s)-min(s))
And draw and compare:
def draw_function_on_2x2_grid(x): fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2) plt.subplots_adjust(wspace=.5) plt.subplots_adjust(hspace=.5) ax1.plot(x, normalized_sigmoid_fkt( .5, 18, x)) ax1.set_title('1') ax2.plot(x, normalized_sigmoid_fkt(0.518, 10.549, x)) ax2.set_title('2') ax3.plot(x, normalized_sigmoid_fkt( .7, 11, x)) ax3.set_title('3') ax4.plot(x, normalized_sigmoid_fkt( .2, 14, x)) ax4.set_title('4') plt.suptitle('Different normalized (sigmoid) function',size=10 ) return fig
Finally:
x = np.linspace(0,1,100) Travel_function = draw_function_on_2x2_grid(x)

Philipp Schwarz Jun 04 '16 at 11:46 on 2016-06-04 11:46
source share