When I use the text backend, I get an error about it not supporting sampler stats:
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sb
import pandas as pd
import pymc3 as pm
from pymc3.backends import Text
import os
TRACE_DIR = os.path.join('your_path_here', 'data', 'test_trace')
%matplotlib inline
model = pm.Model()
with model:
mu1 = pm.Normal("mu1", mu=0, sd=1, shape=2)
with model:
db = Text(TRACE_DIR)
trace = pm.sample(2000, tune=1000, init=None, trace=db)
generates the error below. Is there a simple way around this that I’m just not aware of?
Thanks.
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-3-d7ac78a84d78> in <module>()
1 with model:
2 db = Text(TRACE_DIR)
----> 3 trace = pm.sample(2000, tune=1000, init=None, trace=db)
/Users/weitzenfeld/Envs/selfmade/lib/python2.7/site-packages/pymc3/sampling.pyc in sample(draws, step, init, n_init, start, trace, chain, njobs, tune, nuts_kwargs, step_kwargs, progressbar, model, random_seed, live_plot, discard_tuned_samples, live_plot_kwargs, **kwargs)
274 discard = tune if discard_tuned_samples else 0
275
--> 276 return sample_func(**sample_args)[discard:]
277
278
/Users/weitzenfeld/Envs/selfmade/lib/python2.7/site-packages/pymc3/sampling.pyc in _sample(draws, step, start, trace, chain, tune, progressbar, model, random_seed, live_plot, live_plot_kwargs, **kwargs)
289 try:
290 strace = None
--> 291 for it, strace in enumerate(sampling):
292 if live_plot:
293 if live_plot_kwargs is None:
/Users/weitzenfeld/Envs/selfmade/lib/python2.7/site-packages/tqdm/_tqdm.pyc in __iter__(self)
860 """, fp_write=getattr(self.fp, 'write', sys.stderr.write))
861
--> 862 for obj in iterable:
863 yield obj
864 # Update and print the progressbar.
/Users/weitzenfeld/Envs/selfmade/lib/python2.7/site-packages/pymc3/sampling.pyc in _iter_sample(draws, step, start, trace, chain, tune, model, random_seed)
407 strace.close()
408 if hasattr(step, 'report'):
--> 409 step.report._finalize(strace)
410
411
/Users/weitzenfeld/Envs/selfmade/lib/python2.7/site-packages/pymc3/step_methods/hmc/nuts.pyc in _finalize(self, strace)
460 self._chain_id = strace.chain
461
--> 462 tuning = strace.get_sampler_stats('tune')
463 if tuning.ndim == 2:
464 tuning = np.any(tuning, axis=-1)
/Users/weitzenfeld/Envs/selfmade/lib/python2.7/site-packages/pymc3/backends/base.pyc in get_sampler_stats(self, varname, sampler_idx, burn, thin)
158 """
159 if not self.supports_sampler_stats:
--> 160 raise ValueError("This backend does not support sampler stats")
161
162 if sampler_idx is not None:
ValueError: This backend does not support sampler stats