Differenc between PyMC 3.1 and PyMC 3.0 on NUTS

I am following an example from the book Python for Finance.

It is about Bayesian Regression.

With PyMC 3.0, I can run the following code:

with pm.Model() as model:
    alpha = pm.Normal('alpha',mu=0.,sd=20.)
    beta = pm.Normal('beta',mu=0.,sd=20.)
    sigma = pm.Uniform('sigma',lower=0.,upper=10.)
    # define linear regression
    y_est = alpha + beta * x
    # define likelihood
    likehood = pm.Normal('y',mu=y_est,sd=sigma,observed=y)
    # inference
    start = pm.find_MAP()
        # find starting value by optimization
    step = pm.NUTS(state=start)
        # instantiate MCMC sampling algorithm
    trace = pm.sample(100,step,start=start,progressbar=False)
        # draw 100 posterior samples using NUTS sampling

However, when i updata to PyMC3.1, there is no such a keyword argument ‘state’ in pm.NUTS.
what do I need to do to modify the code ?

Thanks in advance.

Hi @nole2010, you should just use the default for pm.sample() - it is the optimal for most situation now. For example, you can do the following:

    # inference
    trace = pm.sample(1000, njobs=2)

As for the error of step = pm.NUTS(state=start) I have never seen this usage before… I guess you can substitute it with step = pm.NUTS(scaling=start). But again, using the default is a much better choice.