Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sample function (MCMC) running AGONIZINGLY slowly #200

Open
sarahvassall opened this issue Feb 18, 2021 · 2 comments
Open

Sample function (MCMC) running AGONIZINGLY slowly #200

sarahvassall opened this issue Feb 18, 2021 · 2 comments

Comments

@sarahvassall
Copy link

sarahvassall commented Feb 18, 2021

Hi, I built a hierarchical modal and am trying to run MCMC. I recently had a forced Windows update that is causing it to run at a snail's pace, with each sample taking ~2-3 seconds! I did not have this issue a few days ago, and I'm now running into this slowness in Jupyter Notebook and Lab, as well as Spyder. Currently using pymc36.

The model is m_vz_uni. Here is the code from the cell:

m_vz_uni.sample(8000,burn=2000,dbname='traces_vz_uni.db',db='pickle')
stats_vz = m_vz_uni.gen_stats()

I've tried resetting kernels, reinstalling, restarting, etc. Nothing seems to fix it.

Thanks

@fonnesbeck
Copy link
Member

fonnesbeck commented Feb 22, 2021

This might be better addressed on our Discourse page (https://discourse.pymc.io/) as it does not appear to be a specific bug report, but a few things to start with:

  • I assume you mean PyMC 3.6? That's a pretty old version--I strongly recommend updating to the newest release (3.11). You will have to update the call to sample when you update, as much has changed, particularly the DB backend. You should not need to pickle your output, as the sample should easily fit into memory.
  • If you are using NUTS for sampling (which should be the case if your model does not have any discrete unknown variables) you don't need 8000 samples to adequately characterize the posterior. Usually a thousand or so will do. If not, you probably need to boost the burnin (which is now called tune in more recent versions) instead.
  • The slowness could have something to do with your linear algebra libraries that might have been affected when you updated your operating system. Are there any messages when you import PyMC3?
  • One way to see if there is an issue with your system versus the model is to try and run your model on Google Colab; if it runs there then it is likely an issue with your setup.

@fonnesbeck
Copy link
Member

BTW, just noticed that you posted this in the old PyMC repo issue tracker and not the one for PyMC3. If you really are using PyMC version 2, then you definitely should update to PyMC3. I can help you port your model if you need assistance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants