Hi,
I am trying to replicate Thomas Wiecki’s post : Bayesian Deep Learning Part II: Bridging PyMC3 and Lasagne to build a Hierarchical Neural Network
https://twiecki.io/blog/2016/07/05/bayesian-deep-learning/
Because the pymc3 package changed I had to modify the notebook.
Changes were made for minibathes, sample_ppc to sample_posterior_predict, pm.fit etc.
The accuracy I about 10% ( not better than random selection).
neural_network = build_ann(GaussWeights())
with neural_network:
inference=pm.ADVI()
mean_field = pm.fit(n=55000, method=inference, score=True, more_replacements={input_var: input_var_mb, target_var:target_var_mb})
trace = mean_field.sample(500)
input_var.set_value(X_test[:5000, …].astype(np.float64))
target_var.set_value(y_test[:5000, …].astype(np.float64))
with neural_network:
ppc = pm.sample_posterior_predictive(trace, samples=15000)
y_pred = mode(ppc[‘out’], axis=0).mode[0, :]
And use y_pred and y_test[:5000] to get the confusion matrix and accuracy
Am I doing something wrong?
Or is pymc3 just not suitable for prediting?
Regards Hans
The notebook can be found here: