pymc-devs / pymc2

THIS IS THE **OLD** PYMC PROJECT (VERSION 2). PLEASE USE PYMC INSTEAD:
http://pymc-devs.github.com/pymc/
Other
879 stars 229 forks source link

Fix typo in MCMC.tune causing NameError exc #112

Closed raino01r closed 8 years ago

raino01r commented 8 years ago

Choosing verbose=2 causes a NameError exception thrown when starting the sampling. Example code (using sample - the same for isample):

...
>>> M = Model(locals())
>>> M = MCMC(model)
>>> M.sample(10000, verbose=2)

Burn-in interval complete
    Tuning at iteration 1000
    Metropolis_beta tuning:
        value: 0.000410808077072
        acceptance rate: 0.002
        adaptive scale factor: 0.5

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "~/dev_env/local/lib/python2.7/site-packages/pymc/MCMC.py", line 279, in sample
    Sampler.sample(self, iter, length, verbose)
  File "~/dev_env/local/lib/python2.7/site-packages/pymc/Model.py", line 251, in sample
    self._loop()
  File "~/dev_env/local/lib/python2.7/site-packages/pymc/MCMC.py", line 294, in _loop
    self.tune()
  File "~/dev_env/local/lib/python2.7/site-packages/pymc/MCMC.py", line 361, in tune
    '\t\tTuning step method %s, returned %i\n' %i
NameError: global name 'i' is not defined

Commit: 5ead13787b948a179ac7e2ca26d48da57fecba10 Commit message: When verbose>1, sample and isample raise NameError: global name 'i' is not defined Caused by a print_(..%s..%i) %i(str_, int_). Deleting i fixes it.

fonnesbeck commented 8 years ago

Many thanks.