简体   繁体   中英

TypeError: function() got an unexpected keyword argument 'njobs'

I am working on a basic example of MCMC sampling for Bayesian estimation using PyMC3. I have a minimally working example of my code below:

# Establish the parameters of the model
p_a = .15
N = 150
n_successes_a = np.random.binomial(N, p_a)

# Build a model using the uniform prior and binomial
with pm.Model() as Model:
    # Prior on p
    prob = pm.Uniform('p')
    # Binomial likelihood
    y = pm.Binomial('y', n=N, p=prob, observed=n_successes_a)

# Begin to sample from the posterior distribution
with Model:
    samples = pm.sample(2000, njobs=1)

Then when I run this, I get the error: TypeError: function() got an unexpected keyword argument 'njobs'

Any insight as to why this might be happening? I have not been able to find anything online elsewhere providing a substantiative answer.

Thanks.

From https://docs.pymc.io/api/inference.html?highlight=sample#pymc3.sampling.sample

sample() doesn't accept a njobs argument. I'm guessing you meant to be setting the cores argument

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM