# \#sampling

**URL:** https://discourse.pymc.io/tag/sampling/40.md

[Latest](https://discourse.pymc.io/latest.md) · [Categories](https://discourse.pymc.io/categories.md) · [Tags](https://discourse.pymc.io/tags.md)

---

## [Parallelization of Sequential Monte Carlo: sample\_smc](https://discourse.pymc.io/t/parallelization-of-sequential-monte-carlo-sample-smc/17712)

<div class="topic-metadata">

**Author:** [@janwi](https://discourse.pymc.io/u/janwi)\
**Replies:** 1\
**Last updated:** [May 15, 2026, 6:41am UTC](https://discourse.pymc.io/t/parallelization-of-sequential-monte-carlo-sample-smc/17712 "2026-05-15T06:41:30Z")

</div>

Hello everyone, I am new to PyMC and I am planning to use the SMC sampler, pm.sample\_smc, for Bayesian parameter calibration. For example: pm.sample\_smc(draws=1000, chains=1, cores=1) One attractive feature of SMC me…

---

## [Any Thoughts on Sequential Bayesian Update](https://discourse.pymc.io/t/any-thoughts-on-sequential-bayesian-update/17711)

<div class="topic-metadata">

**Author:** [@Gumibear\_Toronto](https://discourse.pymc.io/u/Gumibear_Toronto)\
**Replies:** 2\
**Last updated:** [May 14, 2026, 1:18pm UTC](https://discourse.pymc.io/t/any-thoughts-on-sequential-bayesian-update/17711 "2026-05-14T13:18:28Z")

</div>

Hi, I am working on using PyMC for (i) uncertainty quantification and (ii) sequential learning—a new data comes up sequentially. For better uncertainty quantification, using all the previous data as a batch to train my…

---

## [New Contributor to PyMC](https://discourse.pymc.io/t/new-contributor-to-pymc/17497)

<div class="topic-metadata">

**Author:** [@Moazzam-SK](https://discourse.pymc.io/u/Moazzam-SK)\
**Replies:** 2\
**Last updated:** [December 26, 2025, 7:03pm UTC](https://discourse.pymc.io/t/new-contributor-to-pymc/17497 "2025-12-26T19:03:35Z")

</div>

Hello all, I’m Moazzam Shahzazd, a sophomore studying Computer Science, and I’m trying to contribute to PyMC. I’ve already opened a PR (#7979). In summary, what began as an attempt to silence a UserWarning evolved into r…

---

## [What sampler should I use for the fastest inference in hierarchical Bayesian MMM?](https://discourse.pymc.io/t/what-sampler-should-i-use-for-the-fastest-inference-in-hierarchical-bayesian-mmm/17447)

<div class="topic-metadata">

**Author:** [@LBrs](https://discourse.pymc.io/u/LBrs)\
**Replies:** 2\
**Last updated:** [November 22, 2025, 7:32pm UTC](https://discourse.pymc.io/t/what-sampler-should-i-use-for-the-fastest-inference-in-hierarchical-bayesian-mmm/17447 "2025-11-22T19:32:30Z")

</div>

Hi all, I’m working on a hierarchical Bayesian Marketing Mix Model in PyMC and I’m trying to figure out which sampler would give me the best performance (fastest convergence and wall-clock time) for this type of model. …

---

## [Nutpie sampling freezes](https://discourse.pymc.io/t/nutpie-sampling-freezes/17372)

<div class="topic-metadata">

**Author:** [@bridgeland](https://discourse.pymc.io/u/bridgeland)\
**Replies:** 12\
**Last updated:** [October 16, 2025, 9:16pm UTC](https://discourse.pymc.io/t/nutpie-sampling-freezes/17372 "2025-10-16T21:16:48Z")

</div>

I tried nutpie for the first time on my rather large model. nutpie compiled the model without reporting any difficulty. But sampling resulted in a curious failure: it starts sampling, but freezes after two minutes. No ne…

---

## [How to debug a model when most chains sample fine, but a few do not?](https://discourse.pymc.io/t/how-to-debug-a-model-when-most-chains-sample-fine-but-a-few-do-not/17383)

<div class="topic-metadata">

**Author:** [@bridgeland](https://discourse.pymc.io/u/bridgeland)\
**Replies:** 1\
**Last updated:** [October 15, 2025, 1:30pm UTC](https://discourse.pymc.io/t/how-to-debug-a-model-when-most-chains-sample-fine-but-a-few-do-not/17383 "2025-10-15T13:30:25Z")

</div>

I have a rather complex model that samples well most of the time. But sometimes one of the chains samples very differently from the others. For example, here is the plot\_trace for one of the RVs in one of the sampling ru…

---

## [How to save trace in between sampling and then resume sampling later on?](https://discourse.pymc.io/t/how-to-save-trace-in-between-sampling-and-then-resume-sampling-later-on/16785)

<div class="topic-metadata">

**Author:** [@Aravind27](https://discourse.pymc.io/u/Aravind27)\
**Replies:** 2\
**Last updated:** [July 10, 2025, 4:36am UTC](https://discourse.pymc.io/t/how-to-save-trace-in-between-sampling-and-then-resume-sampling-later-on/16785 "2025-07-10T04:36:41Z")

</div>

Hello everyone, I would like to save the trace every n samples or so. Is there a way to do this in pymc? Specifically, I would like to do something like the following pseudo code: with pm.Model() as model: ## priors…

---

## [Is my model setup in proper way? Dependent Dirichlet process (DDP)](https://discourse.pymc.io/t/is-my-model-setup-in-proper-way-dependent-dirichlet-process-ddp/16864)

<div class="topic-metadata">

**Author:** [@aga2025](https://discourse.pymc.io/u/aga2025)\
**Replies:** 1\
**Last updated:** [April 21, 2025, 9:10pm UTC](https://discourse.pymc.io/t/is-my-model-setup-in-proper-way-dependent-dirichlet-process-ddp/16864 "2025-04-21T21:10:14Z")

</div>

Hi everyone, I am currently implementing a Dependent Dirichlet Process (DDP) mixture model in PyMC, and I do really appreciate any feedback or guidance from the community. Data used are 12 clusters features and 5 covari…

---

## [Generalized LV: missing 1 required positional argument using pymc.ode.DifferentialEquation](https://discourse.pymc.io/t/generalized-lv-missing-1-required-positional-argument-using-pymc-ode-differentialequation/16756)

<div class="topic-metadata">

**Author:** [@snjie209](https://discourse.pymc.io/u/snjie209)\
**Replies:** 0\
**Last updated:** [March 25, 2025, 5:12pm UTC](https://discourse.pymc.io/t/generalized-lv-missing-1-required-positional-argument-using-pymc-ode-differentialequation/16756 "2025-03-25T17:12:41Z")

</div>

Hi team, I am trying to train a generalized Lotka Volterra using pymc. I have a 500 x 30 dataset where there are 500 data points and 30 time series. # Run only in the beginning !pip install --force-reinstall numpy==1.…

---

## [How to use pm.Data with pm.Minibatch?](https://discourse.pymc.io/t/how-to-use-pm-data-with-pm-minibatch/16491)

<div class="topic-metadata">

**Author:** [@LLehner](https://discourse.pymc.io/u/LLehner)\
**Replies:** 5\
**Last updated:** [February 12, 2025, 11:48pm UTC](https://discourse.pymc.io/t/how-to-use-pm-data-with-pm-minibatch/16491 "2025-02-12T23:48:56Z")

</div>

Hello, I’m currently fitting a model and want to see predictions on unseen data that was not used in the model fitting process. I know that you can simply reset the “incoming” data before posterior predictive sampling u…

---

## [Sampling in ADVI](https://discourse.pymc.io/t/sampling-in-advi/16356)

<div class="topic-metadata">

**Author:** [@SharathB](https://discourse.pymc.io/u/SharathB)\
**Replies:** 2\
**Last updated:** [January 12, 2025, 12:57pm UTC](https://discourse.pymc.io/t/sampling-in-advi/16356 "2025-01-12T12:57:38Z")

</div>

Hello I am fairly new to PYMC and i wanted to understand the advi sampling. I wanted to understand what is changing from sample to sample? Example: If i run the following line of code advi\_fit\[channel\] = pm.fit(…

---

## [Sample output object with Nutpie](https://discourse.pymc.io/t/sample-output-object-with-nutpie/16355)

<div class="topic-metadata">

**Author:** [@DaveD](https://discourse.pymc.io/u/DaveD)\
**Replies:** 2\
**Last updated:** [January 9, 2025, 1:45pm UTC](https://discourse.pymc.io/t/sample-output-object-with-nutpie/16355 "2025-01-09T13:45:14Z")

</div>

Hi, (Im using PyMC ver 5.19 and Windows 10) Im using nutpie to compile and sample a model (previously run fine with pm.sample etc). This works very well (much quicker) but the resulting trace object is different (previ…

---

## [Problems with a Joint Species Distribution Model (jdsm): Implementing a multiplicative Gamma Prior](https://discourse.pymc.io/t/problems-with-a-joint-species-distribution-model-jdsm-implementing-a-multiplicative-gamma-prior/16317)

<div class="topic-metadata">

**Author:** [@C.A\_Mallon](https://discourse.pymc.io/u/C.A_Mallon)\
**Replies:** 6\
**Last updated:** [December 30, 2024, 3:15pm UTC](https://discourse.pymc.io/t/problems-with-a-joint-species-distribution-model-jdsm-implementing-a-multiplicative-gamma-prior/16317 "2024-12-30T15:15:30Z")

</div>

TLDR I am trying to implement a multiplicative gamma prior into a multivariate, hierarchical model. I’d be grateful for someone to double check this to make sure I am technically implementing the prior in the correct way…

---

## [Error KeyError: 'diverging' when setting up CategoricalGibbsMetropolis step method with proposal='proportional'](https://discourse.pymc.io/t/error-keyerror-diverging-when-setting-up-categoricalgibbsmetropolis-step-method-with-proposal-proportional/16289)

<div class="topic-metadata">

**Author:** [@mercer](https://discourse.pymc.io/u/mercer)\
**Replies:** 4\
**Last updated:** [December 24, 2024, 2:49pm UTC](https://discourse.pymc.io/t/error-keyerror-diverging-when-setting-up-categoricalgibbsmetropolis-step-method-with-proposal-proportional/16289 "2024-12-24T14:49:10Z")

</div>

I am trying to set up CategoricalGibbsMetropolis step method for a categorical variable with the proposal parameter set to proportional as follows: with model: # Create and save the model graph. gra…

---

## [Explainability of pymc predictions: which features and which direction](https://discourse.pymc.io/t/explainability-of-pymc-predictions-which-features-and-which-direction/15996)

<div class="topic-metadata">

**Author:** [@danhislop](https://discourse.pymc.io/u/danhislop)\
**Replies:** 7\
**Last updated:** [November 10, 2024, 2:12pm UTC](https://discourse.pymc.io/t/explainability-of-pymc-predictions-which-features-and-which-direction/15996 "2024-11-10T14:12:46Z")

</div>

I’ve developed a pymc model that is fairly accurate on the probability predictions given by pm.sample\_posterior\_predictive(idata). However I need a hint on explainability: How can I return back to the business actionabl…

---

## [Very long sampling time using simple model](https://discourse.pymc.io/t/very-long-sampling-time-using-simple-model/16046)

<div class="topic-metadata">

**Author:** [@Sopchi](https://discourse.pymc.io/u/Sopchi)\
**Replies:** 1\
**Last updated:** [October 30, 2024, 10:38am UTC](https://discourse.pymc.io/t/very-long-sampling-time-using-simple-model/16046 "2024-10-30T10:38:14Z")

</div>

I want to sample from this model To do that I have created this pymc model : with pm.Model() as inference\_model\_categorical: w = pm.Dirichlet("w", a=np.ones(max\_state)) latent\_z = pm.Categorical('z', p=w,sh…

---

## [New sampler library: nutpie](https://discourse.pymc.io/t/new-sampler-library-nutpie/9765)

<div class="topic-metadata">

**Author:** [@aseyboldt](https://discourse.pymc.io/u/aseyboldt)\
**Replies:** 6\
**Last updated:** [October 30, 2024, 1:46am UTC](https://discourse.pymc.io/t/new-sampler-library-nutpie/9765 "2024-10-30T01:46:41Z")

</div>

I would like to announce a new sampler library that can sample from pymc and stan models using NUTS: nutpie. At least in my benchmarks it currently is the fastest CPU based sampler implementing NUTS. It compiles logp g…

---

## [Inference issue using a model with Multinomial latent variables on multidimensional observations](https://discourse.pymc.io/t/inference-issue-using-a-model-with-multinomial-latent-variables-on-multidimensional-observations/16022)

<div class="topic-metadata">

**Author:** [@Sopchi](https://discourse.pymc.io/u/Sopchi)\
**Replies:** 4\
**Last updated:** [October 25, 2024, 12:28pm UTC](https://discourse.pymc.io/t/inference-issue-using-a-model-with-multinomial-latent-variables-on-multidimensional-observations/16022 "2024-10-25T12:28:27Z")

</div>

Let’s say that we have access to N observations of a phenomenon where for each observation i we observe a defined number m of independant draws of a Negative Binomial whose paremeters are \\alpha\_i (Gamma distribution sha…

---

## [Including Observations in the Model, a beginner question](https://discourse.pymc.io/t/including-observations-in-the-model-a-beginner-question/15993)

<div class="topic-metadata">

**Author:** [@Meillo\_Fang](https://discourse.pymc.io/u/Meillo_Fang)\
**Replies:** 14\
**Last updated:** [October 20, 2024, 10:15am UTC](https://discourse.pymc.io/t/including-observations-in-the-model-a-beginner-question/15993 "2024-10-20T10:15:02Z")

</div>

I’m a beginner in pymc, sorry this problem seems simple but it’s been bothering me for many days. The problem is summarized as follows: I want to include my observations in the model, I found out by studying chapter 2.1.…

---

## [Sampling problem of discrete parent nodes for continuous nodes](https://discourse.pymc.io/t/sampling-problem-of-discrete-parent-nodes-for-continuous-nodes/15986)

<div class="topic-metadata">

**Author:** [@sponyo](https://discourse.pymc.io/u/sponyo)\
**Replies:** 2\
**Last updated:** [October 17, 2024, 10:54am UTC](https://discourse.pymc.io/t/sampling-problem-of-discrete-parent-nodes-for-continuous-nodes/15986 "2024-10-17T10:54:35Z")

</div>

Hello! When I have a discrete node C, its child nodes are conditional Gaussian nodes S weighted by C. But when I did not add observation value sampling, I found that the posterior of C was not sampled according to the pr…

---

## [Why do we still need sampling in the Marginal GP implementation?](https://discourse.pymc.io/t/why-do-we-still-need-sampling-in-the-marginal-gp-implementation/15968)

<div class="topic-metadata">

**Author:** [@cola](https://discourse.pymc.io/u/cola)\
**Replies:** 1\
**Last updated:** [October 15, 2024, 8:27am UTC](https://discourse.pymc.io/t/why-do-we-still-need-sampling-in-the-marginal-gp-implementation/15968 "2024-10-15T08:27:33Z")

</div>

Hello, I am very new to Pymc so I apologise for the very basic question, but this has been a general long term doubt I have about the Marginal implementation of Gaussian Processes. As I understand, we assume a Gaussian…

---

## [Issue when trying to normalize random variable](https://discourse.pymc.io/t/issue-when-trying-to-normalize-random-variable/15082)

<div class="topic-metadata">

**Author:** [@uhur](https://discourse.pymc.io/u/uhur)\
**Replies:** 3\
**Last updated:** [September 18, 2024, 1:30pm UTC](https://discourse.pymc.io/t/issue-when-trying-to-normalize-random-variable/15082 "2024-09-18T13:30:47Z")

</div>

Hi, I was going over the factor analysis example and wanted try a model. For this, I wanted to use an independent and identically sampled normal matrix and wanted to normalize its columns to have norm 1. When I try to s…

---

## [Nutpie sampler warning for Numba object mode (lower performance)](https://discourse.pymc.io/t/nutpie-sampler-warning-for-numba-object-mode-lower-performance/15079)

<div class="topic-metadata">

**Author:** [@uhur](https://discourse.pymc.io/u/uhur)\
**Replies:** 2\
**Last updated:** [September 15, 2024, 9:18am UTC](https://discourse.pymc.io/t/nutpie-sampler-warning-for-numba-object-mode-lower-performance/15079 "2024-09-15T09:18:27Z")

</div>

Hi, I have a model from which i sample with the nutpie sampler as this sampler was the fastest among two others. However, I think it can be even faster because I receive a warning that hints at this. I will give the mod…

---

## [Theoretical and Practical Considerations and Questions](https://discourse.pymc.io/t/theoretical-and-practical-considerations-and-questions/15070)

<div class="topic-metadata">

**Author:** [@uhur](https://discourse.pymc.io/u/uhur)\
**Replies:** 0\
**Last updated:** [September 13, 2024, 7:44am UTC](https://discourse.pymc.io/t/theoretical-and-practical-considerations-and-questions/15070 "2024-09-13T07:44:27Z")

</div>

Hi, I wanted to learn bayesian graphical modeling and pymc better so I did a case study with a dataset. In below, I explain the steps I took to learn the parameters of my model and ask questions (in bold) at points that…

---

## [Huge difference between MCMC posterior samples and actual data - help needed!](https://discourse.pymc.io/t/huge-difference-between-mcmc-posterior-samples-and-actual-data-help-needed/15032)

<div class="topic-metadata">

**Author:** [@Dimlitter](https://discourse.pymc.io/u/Dimlitter)\
**Replies:** 11\
**Last updated:** [September 9, 2024, 12:53pm UTC](https://discourse.pymc.io/t/huge-difference-between-mcmc-posterior-samples-and-actual-data-help-needed/15032 "2024-09-09T12:53:29Z")

</div>

Hi everyone, I have been working on Bayesian inference models using SEIRS framework to analyze COVID-19 and influenza co-infection data. However, I have encountered a major problem. I generated some data using the seirs…

---

## [Checkpoint / Resuming sampling with NUTS sampler](https://discourse.pymc.io/t/checkpoint-resuming-sampling-with-nuts-sampler/14948)

<div class="topic-metadata">

**Author:** [@RvdB](https://discourse.pymc.io/u/RvdB)\
**Replies:** 1\
**Last updated:** [August 21, 2024, 1:32pm UTC](https://discourse.pymc.io/t/checkpoint-resuming-sampling-with-nuts-sampler/14948 "2024-08-21T13:32:04Z")

</div>

Hi all, I want to use the NUTS sampler to sample a model but use some form of check-pointing. I can successfully sample from the model and obtain the trace results, so that itself is not an issue. I am working on a ser…

---

## [Multiprocessing quit with no output](https://discourse.pymc.io/t/multiprocessing-quit-with-no-output/14925)

<div class="topic-metadata">

**Author:** [@stefano1](https://discourse.pymc.io/u/stefano1)\
**Replies:** 0\
**Last updated:** [August 13, 2024, 9:52am UTC](https://discourse.pymc.io/t/multiprocessing-quit-with-no-output/14925 "2024-08-13T09:52:29Z")

</div>

Hi. I am trying to run pymc.sample using mutiple chains on multiple cores on a Linux machine. If I use cores=1 with chains\>1 sequential sampling works and the final trace is saved in output. If I set cores\>1 I get a weir…

---

## [Multi-Output Spatial Gaussian Process Prior Predictive Simulation](https://discourse.pymc.io/t/multi-output-spatial-gaussian-process-prior-predictive-simulation/14684)

<div class="topic-metadata">

**Author:** [@kpjmcg](https://discourse.pymc.io/u/kpjmcg)\
**Replies:** 2\
**Last updated:** [July 30, 2024, 8:04pm UTC](https://discourse.pymc.io/t/multi-output-spatial-gaussian-process-prior-predictive-simulation/14684 "2024-07-30T20:04:19Z")

</div>

I have put together a spatial multi-output gaussian process and performed prior predictive simulations on it. I am posting below for review (I have a few questions) and as a helper for other’s seeking to perform prior p…

---

## [Differences between MvNormal and Normal sampling](https://discourse.pymc.io/t/differences-between-mvnormal-and-normal-sampling/14797)

<div class="topic-metadata">

**Author:** [@pearson01](https://discourse.pymc.io/u/pearson01)\
**Replies:** 2\
**Last updated:** [July 19, 2024, 2:03pm UTC](https://discourse.pymc.io/t/differences-between-mvnormal-and-normal-sampling/14797 "2024-07-19T14:03:49Z")

</div>

I’ve been having some issues reproducing the output from my model with a normal univariate prior distribution. In the model, I’m looking to introduce correlation between sate vector parameters in the prior, and so have b…

---

## [Very slow sampling of hierarchical, non-linear bayesian model after adding likelihood function](https://discourse.pymc.io/t/very-slow-sampling-of-hierarchical-non-linear-bayesian-model-after-adding-likelihood-function/14697)

<div class="topic-metadata">

**Author:** [@mercer](https://discourse.pymc.io/u/mercer)\
**Replies:** 0\
**Last updated:** [June 29, 2024, 6:54pm UTC](https://discourse.pymc.io/t/very-slow-sampling-of-hierarchical-non-linear-bayesian-model-after-adding-likelihood-function/14697 "2024-06-29T18:54:16Z")

</div>

I’m trying to convert a Bayesian JAGS model to PyMC, but I’m having problems with the sampling. Here is the model: def model\_1v\_LG2D(data): with pm.Model() as model: # Convert data to tensor variabl…

[Next page](https://discourse.pymc.io/tag/sampling/40.md?match_all_tags=true&page=1&tags%5B%5D=sampling)
