@twiecki: Hi Thomas,
I used your sample for Bayesian Neural Network with lasagne and wrote some code to classify ‘notMNIST’ dataset. It worked well on my laptop using pymc3 v3.1. And now I tried running this on a new machine it fails when using PyMC3 v3.2 (I think it’s because the code has these deprecated calls):
pm.variational.advi_minibatch
Error Messages:
Minibatches prepared: 06:42:46
Training started: 06:42:46
Traceback (most recent call last):
File "bnn_cnn_notMNIST.py", line 288, in <module>
run_bnn_cnn(args.output)
File "bnn_cnn_notMNIST.py", line 245, in run_bnn_cnn
v_params, trace, ppc, y_pred = run_advi(likelihood)
File "bnn_cnn_notMNIST.py", line 179, in run_advi
epsilon=1.0
File "/home/mv333/miniconda2/envs/bnn2.7/lib/python2.7/site-packages/theano/configparser.py", line 117, in res
return f(*args, **kwargs)
File "/home/mv333/miniconda2/envs/bnn2.7/lib/python2.7/site-packages/pymc3/variational/advi_minibatch.py", line 478, in advi_minibatch
_value_error(len(grvs) == len(global_RVs(),
TypeError: 'OrderedDict' object is not callable
Relevant code sections:
'''
ADVI sampler
'''
def run_advi(likelihood, advi_iters=10000):
input_var.set_value(X_train[:500, ...])
target_var.set_value(y_train[:500, ...])
v_params = pm.variational.advi_minibatch(
n=advi_iters,
minibatch_tensors=minibatch_tensors,
minibatch_RVs=[likelihood],
minibatches=minibatches,
total_size=total_size,
learning_rate=1e-2,
epsilon=1.0
)
trace = pm.variational.sample_vp(v_params, draws=500)
# Predict on test data
input_var.set_value(X_test)
target_var.set_value(y_test)
ppc = pm.sample_ppc(trace, samples=100)
y_pred = mode(ppc['out'], axis=0).mode[0, :]
return v_params, trace, ppc, y_pred