# Using MH() with a custom proposal and acceptance rate of 1 to emulate traditional Gibbs?

**URL:** <https://discourse.julialang.org/t/using-mh-with-a-custom-proposal-and-acceptance-rate-of-1-to-emulate-traditional-gibbs/114653>\
**Category:** Probabilistic Programming\
**Tags:** turing\
**Created:** [May 24, 2024, 1:37am UTC](https://discourse.julialang.org/t/using-mh-with-a-custom-proposal-and-acceptance-rate-of-1-to-emulate-traditional-gibbs/114653 "2024-05-24T01:37:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aws](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aws/32/209472_2.png) [@aws](https://discourse.julialang.org/u/aws)\
**Post date:** [May 24, 2024, 1:37am UTC](https://discourse.julialang.org/t/using-mh-with-a-custom-proposal-and-acceptance-rate-of-1-to-emulate-traditional-gibbs/114653/1 "2024-05-24T01:37:45Z")

</div>

Hello,

Thank you in advance for reading. I am a researcher considering whether to use Turing for a project. As background, I will be implementing and extending a sparse infinite Bayesian factor model as described in [Sparse Bayesian infinite factor models - PMC](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3419391/).

While this paper specifies the full conditional posterior distribution for each parameter and thus allows Gibbs sampling, I plan to introduce some additional latent variables that will require Metropolis-Hastings sampling within Gibbs. Thus, Turing’s compositional sampler is very appealing.

**My question is, can I use the MH() functionality in Turing to specify the conditional posterior as a proposal and force an acceptance rate of 1 for the parameters whose conditional posteriors I know**? I will use either MH() or NUTS() for the remaining parameters. As far as I can tell it is possible to specify the proposal for MH() but I did not see an obvious way to force Turing to accept the proposal to emulate traditional Gibbs sampling.

Thank you for your time.

Best,  
Aaron

---

<div class="post-metadata">

**Author:** ![bertschi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bertschi/32/33462_2.png) [@bertschi](https://discourse.julialang.org/u/bertschi)\
**Post date:** [May 24, 2024, 4:01pm UTC](https://discourse.julialang.org/t/using-mh-with-a-custom-proposal-and-acceptance-rate-of-1-to-emulate-traditional-gibbs/114653/2 "2024-05-24T16:01:46Z")

</div>

> [@aws](#):
>
> **My question is, can I use the MH() functionality in Turing to specify the conditional posterior as a proposal and force an acceptance rate of 1 for the parameters whose conditional posteriors I know**? I will use either MH() or NUTS() for the remaining parameters. As far as I can tell it is possible to specify the proposal for MH() but I did not see an obvious way to force Turing to accept the proposal to emulate traditional Gibbs sampling.

From what I recall, Gibbs can be considered as a special case of MH which happens to accept with probability 1. Thus, no need to force it, i.e., if your proposal is correctly specified it should just always be accepted.
