I wrote code in an Ipython notebook to create a sigmoid function, controlled by the parameters a, which determines the position of the sigmoid center, and b, which determines its width:
%matplotlib inline import numpy as np import matplotlib.pyplot as plt def sigmoid(x,a,b):
I wanted to add interactivity for parameters a and b, so I re-wrote the function as shown below:
%matplotlib inline import numpy as np import matplotlib.pyplot as plt from IPython.html.widgets import interactive from IPython.display import display def sigmoid_demo(a=5,b=1): x = np.linspace(0,10,256) s = 1/(1+np.exp(-(xa)/(b+0.1)))
Is there a way to limit the range of sliders to symmetrical (e.g. near zero)? It seems to me that this is impossible by simply setting the initial value for the parameters.
python interactive slider widget ipython-notebook
Mycarta
source share