If you are running it from the terminal $ python code.py
, then you should put
if __name__ == '__main__':
run()
at the end of the code. Try saving below into a .py file
import pymc3 as pm
model = pm.Model()
with model:
mu1 = pm.Normal("mu1", mu=0, sd=1, shape=10)
with model:
step = pm.NUTS()
trace = pm.sample(2000, tune=1000, init=None, step=step, njobs=2)
if __name__ == '__main__':
run()