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:

2 Likes

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!

@junpenglao as discussed Iā€™m working on updating this doc, but Iā€™m a bit confused by the format: this file is a .rst and Iā€™ve never worked with that.
Do you know how Iā€™m supposed to modify it, especially the code parts? Ideally these should be cells executed in a NB, but Iā€™m under the impression that this is a sort of mock-up :thinking:
Thank you :vulcan_salute:

This is a pure text file so the easiest way is to run the code in a notebook and copy the code and output to the file.

1 Like

Ow ok, good to know, thanks! Updating the radon notebook now, but will do that after :wink:

This is updated now and will be up on the website when the next release is done :ok_hand: