pymc-devs / pymc-devs/pymc-examples

Unable to Replicate the sampling speed given in the example

Open
#466 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
398
Forks
325
Avg merge
9d 15m
Merged PRs (30d)
1

Description

Hi,

I am very new to pymc. I have mostly used rstan for the bayesian computations required for my research as it is mostly popular for the implementation of the No-U-Turn sampler (NUTS), a popular extension of HMC. Recently we are developing a model which involves Dirichlet Process Mixture (DPM) priors. Implementation of DPM is tricky in stan as it is unable to sample from the discrete parameters. The problem can be solved by marginalizing the likelihood which requires evaluation of the likelihood for each discrete value of the parameters. This makes the sampler very slow.

Recently, I came across pymc4 and found that it can generate from discrete parameters even if they are using NUTS. To understand the usages, I found the following page-
https://www.pymc.io/blog/v4_announcement.html

I tried to replicate the examples in the recently installed Anaconda 3 with the jupyter notebook interface. Unfortunately, it is taking 3 hours to run 8000 samples using pymc3 whereas it is supposed to run in 23 seconds as shown on the webpage. Same thing happened using pymc4.

Specs for yy laptop are: Windows 11, 8 cores, ram 16 GB

Please let me know what I should do to replicate the example correctly.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the PyMC v4 announcement example linked in the issue and reproduce it in the reported Anaconda 3 and Jupyter environment. Compare the 8,000-sample runtime with the 23-second example, recording the PyMC version and laptop specifications; done means identifying why the runtime differs or documenting the missing environment detail.

Written by the indexing model from the issue text.

Assessment

Tech stack
anaconda, jupyter-notebook, python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.