Issues in first pymc3 program from the documentation

I am just getting started with PyMC3. And the first program I wrote was the one given in
the introduction (https://docs.pymc.io/history.html),i.e. the bioassay_model. However, I am running into a few issues and I was wondering if someone could help me figure them out.
I am working in Windows 10 on a machine which also has a GPU. I am using the anaconda command prompt (NOT jupyter notebook).
Following are the issues I am trying to figure out:

  1. There is a line in the code which says
    trace = sample(1000, njobs=2)
    This gives an error:
    TypeError: function() got an unexpected keyword argument ‘njobs’
    It does not give an error if I remove njobs. But I was wondering what it is and if it is there in the official docs then maybe I need to do something on my side to get it to work.

  2. If I run the program by removing njobs then it starts executing but gives a Runtime Error with the message “An attempt has been made to start a new process before the current process has finished its bootstrapping phase.”
    I tried to search for a way to fix this and used cores=1 from this (Pymc3 getting stuck after initialization)
    and it runs now. Is this the “optimum” way to fix this or there is somethign else which is better?

  3. The program isnt “initializing NUTS using ADVI”. Instead it says “Initializing NUTS using jitter+adapt_diag”. Why is it doing that and how can I get it to use ADVI?

  4. Plotting: since I am not in jupyter, how do get to display the plot. normally in matplotlib i would do something like plt.show() but that option does not seem to work here.

5.Even though the program runs, I do not get the message regarding Average Loss and “Convergence archived at 11900”.

Sorry, about the long list, but if someone could help me figure out these, it would really be great.

1 Like

It has been renamed to cores - try trace = sample(1000, cores=2)

Unfortunately, multi-processing under Windows is pretty bugy (also it doesnt play well with GPU) - for now you should do cores=1

  1. You can do trace = pm.sample(1000, cores=1, init='advi+adapt_diag'), but the default jitter+adapt_diag is actually better and the recommended way to start

  2. Hmm that should work in general here as well - in my command prompt under Linux I dont even need to do plt.show()

  3. This message is related to ADVI, if you are not using ADVI init you wont see this message.

Overall, it seems we definitely need to update this outdated doc :sweat_smile:

1 Like

Thanks! yes, on the docs. I was wondering if this is the “wrong” doc I was looking at. If so which would be the right one.

Usually https://docs.pymc.io/notebooks/api_quickstart.html should be up to date :slight_smile:

I can try to update this NB Junpeng, if you think it’s important

1 Like

Please go ahead :slight_smile:

Great, will look at that ASAP then!