I am trying to use an sqlite backend but it raises
ProgrammingError: Cannot operate on a closed database.
Here is a minimal working example:
import pymc3 as pm from pymc3.backends import SQLite import numpy as np #simulate some data x = np.random.normal(100) y = x + np.random.normal(100) with pm.Model() as model: sigma = pm.HalfCauchy('sigma', beta=10, testval=1.) intercept = pm.Normal('Intercept', 0, sigma=20) x_coeff = pm.Normal('x', 0, sigma=20) # Define likelihood likelihood = pm.Normal('y', mu=intercept + x_coeff * x, sigma=sigma, observed=y) backend = SQLite('mod_trace.sqlite') trace2 = pm.sample(draws=5000, tune=3000, target_accept=.95, trace=backend)
Am I doing this wrong? This was meant to be a workaround for a model in which pymc3 is using up all my memory and freezing my computer when I run it for very long.