Installing version 3.1

I am using conda and wish to install pymc3 version 3.1 (not the latest 3.2), on a new machine.
How do I get version 3.1 installed?

conda install pymc3

Automatically installs v3.2

conda install pymc3=3.1 should give you that.

May I ask why you want the older version?

@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

Does it work with PyMC 3.1?

Yes, it works with pymc3.1 when I use the master branches of theano (1.0.1) and Lasagne (0.2.dev1). Now in the past few weeks, the master branch of theano has changed to (1.0.1+unknown), and so not sure of that combination.
What I have running now (on the new machine) after where I left off yesterday, is as below.

$ conda list | grep -i -E "(theano|pymc|lasagne)"
Lasagne                   0.2.dev1                  <pip>
pymc3                     3.2                      py27_0    conda-forge
theano                    0.9.0                    py27_3    conda-forge

The code needed to be changed. And now it runs, after the change, however the performance (the fit/ the sampling) is quite poor:

        approx = pm.fit(advi_iters)
        trace = approx.sample(draws=500)

I believe I need further edits to make the code read the mini-batches etc.

Yeah, I started porting the NB to the new VI syntax (using pm.Minibatch) but didn’t finish. Let me know if you make some progress and I can update it. There’s also a bug fix for the upcoming 3.3 release that makes VI much faster.