我正在使用一个小部件来参数化一些数据的生成。我想捕获数据,而不输出它。这可能吗?添加;
后interact()
不起作用。例子:
import ipywidgets as widgets
from ipywidgets import interact, interactive, fixed
def generate_data(n, p, s):
return np.random.negative_binomial(n, p, s)
w_n = widgets.IntSlider(min=1, max=10000, step=1)
w_p = widgets.FloatSlider(min=0.01, max=1, step = 0.01)
w_s = widgets.IntSlider(min=500,max=10000,step=50)
data = interact(generate_data, n = w_n, p = w_p, s = w_s);