# \#dynamichmc

**URL:** https://discourse.julialang.org/tag/dynamichmc/661.md

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

---

## [Hamiltonian Monte Carlo on sphere](https://discourse.julialang.org/t/hamiltonian-monte-carlo-on-sphere/117571)

<div class="topic-metadata">

**Author:** [@Gattu\_Mytraya](https://discourse.julialang.org/u/Gattu_Mytraya)\
**Replies:** 21\
**Last updated:** [August 11, 2024, 1:48pm UTC](https://discourse.julialang.org/t/hamiltonian-monte-carlo-on-sphere/117571 "2024-08-11T13:48:42Z")

</div>

I have a PDF defined on (S^{2})^{D} that I want to sample from using Hamiltonian Monte Carlo (HMC). I need to calculate the expectation value of a function against this PDF, which is computationally expensive. Therefore,…

---

## [Using DynamicHMC for a model defined in Python](https://discourse.julialang.org/t/using-dynamichmc-for-a-model-defined-in-python/117765)

<div class="topic-metadata">

**Author:** [@Douwe](https://discourse.julialang.org/u/Douwe)\
**Replies:** 0\
**Last updated:** [August 2, 2024, 12:47pm UTC](https://discourse.julialang.org/t/using-dynamichmc-for-a-model-defined-in-python/117765 "2024-08-02T12:47:15Z")

</div>

Hi I’ve been trying to use DynamicHMC to sample my model written in Python. The problem I’m encountering is that I don’t know how to structure the output of my log posterior function in julia correctly, so the MCMC sampl…

---

## [Tune Metropolis-Hastings (normal distribution) scale parameters (and algorithms parameters in general)](https://discourse.julialang.org/t/tune-metropolis-hastings-normal-distribution-scale-parameters-and-algorithms-parameters-in-general/104925)

<div class="topic-metadata">

**Author:** [@caesoma](https://discourse.julialang.org/u/caesoma)\
**Replies:** 10\
**Last updated:** [October 13, 2023, 5:32pm UTC](https://discourse.julialang.org/t/tune-metropolis-hastings-normal-distribution-scale-parameters-and-algorithms-parameters-in-general/104925 "2023-10-13T17:32:38Z")

</div>

I am doing Bayesian inference of a few parameters (~3), albeit of a highly nonlinear model, and I am interested in the performance of random-walk Metropolis-Hastings versus Hamiltonian Monte Carlo methods. I don’t expect…

---

## [Static HMC mass matrix/metric parameter](https://discourse.julialang.org/t/static-hmc-mass-matrix-metric-parameter/104926)

<div class="topic-metadata">

**Author:** [@caesoma](https://discourse.julialang.org/u/caesoma)\
**Replies:** 0\
**Last updated:** [October 13, 2023, 10:13am UTC](https://discourse.julialang.org/t/static-hmc-mass-matrix-metric-parameter/104926 "2023-10-13T10:13:46Z")

</div>

I am running inference of a nonlinear model as described here it will run (albeit poorly) even with Metropolis-Hastings, and with acceptable results with NUTS and HMC with Dual averaging tuning of path length: With va…

---

## [\[ANN\] Pathfinder.jl: speeding up the Bayesian workflow](https://discourse.julialang.org/t/ann-pathfinder-jl-speeding-up-the-bayesian-workflow/80464)

<div class="topic-metadata">

**Author:** [@sethaxen](https://discourse.julialang.org/u/sethaxen)\
**Replies:** 15\
**Last updated:** [May 6, 2022, 12:35pm UTC](https://discourse.julialang.org/t/ann-pathfinder-jl-speeding-up-the-bayesian-workflow/80464 "2022-05-06T12:35:34Z")

</div>

Pathfinder is a variational method designed to replace some or all phases of the warm-up phase of Markov Chain Monte Carlo. Its draws can also be used to diagnose problems with Bayesian models early in a model developmen…

---

## [Issues with HMC/NUTS samplers](https://discourse.julialang.org/t/issues-with-hmc-nuts-samplers/68900)

<div class="topic-metadata">

**Author:** [@tchebycheff](https://discourse.julialang.org/u/tchebycheff)\
**Replies:** 4\
**Last updated:** [September 29, 2021, 3:53pm UTC](https://discourse.julialang.org/t/issues-with-hmc-nuts-samplers/68900 "2021-09-29T15:53:41Z")

</div>

Hi - I am trying to run MCMC on this model with Turing. Only SMC sampler works. With HMC, NUTS, PG, DynamicHMC I get the error TypeError: in typeassert, expected Float64, got a value of type ForwardDiff.Dual{Nothing, F…

---

## [Using TransformVariables.jl to Numerically Handle Jacobian Adjustment of Simple Problem](https://discourse.julialang.org/t/using-transformvariables-jl-to-numerically-handle-jacobian-adjustment-of-simple-problem/60677)

<div class="topic-metadata">

**Author:** [@Adam\_Fleischhacker](https://discourse.julialang.org/u/Adam_Fleischhacker)\
**Replies:** 1\
**Last updated:** [May 7, 2021, 1:12pm UTC](https://discourse.julialang.org/t/using-transformvariables-jl-to-numerically-handle-jacobian-adjustment-of-simple-problem/60677 "2021-05-07T13:12:19Z")

</div>

Here is a simple generative DAG where a Jacobian adjustment is required to get the logpdf of the posterior distribution for y. I can code this function to work with the DynamicHMC.jl suite of packages if I manually a…

---

## [DynamicHMC for Bayesian inference where product distribution is observed - Possible?](https://discourse.julialang.org/t/dynamichmc-for-bayesian-inference-where-product-distribution-is-observed-possible/60268)

<div class="topic-metadata">

**Author:** [@Adam\_Fleischhacker](https://discourse.julialang.org/u/Adam_Fleischhacker)\
**Replies:** 9\
**Last updated:** [May 3, 2021, 11:50pm UTC](https://discourse.julialang.org/t/dynamichmc-for-bayesian-inference-where-product-distribution-is-observed-possible/60268 "2021-05-03T23:50:48Z")

</div>

Here is a generative model I am working on. Think of a game show where your winnings are determined by the product of two RV’s: winningsMultiplier(X) and maxWinnings(Y). We observe winnings w\_i = x\_i \* y. Our prior o…

---

## [Using DynamicHMC to calculate paths of Quantum Simple Harmonic Oscillator](https://discourse.julialang.org/t/using-dynamichmc-to-calculate-paths-of-quantum-simple-harmonic-oscillator/60009)

<div class="topic-metadata">

**Author:** [@jdhooghe](https://discourse.julialang.org/u/jdhooghe)\
**Replies:** 2\
**Last updated:** [April 26, 2021, 11:54am UTC](https://discourse.julialang.org/t/using-dynamichmc-to-calculate-paths-of-quantum-simple-harmonic-oscillator/60009 "2021-04-26T11:54:33Z")

</div>

Hello, I need some help getting sampling to work using DynamicHMC. The model thus far is: using LogDensityProblems using Statistics using Distributions using UnPack using TransformVariables using DynamicHMC using MCMCDi…

---

## [Importing CairoMakie prevents sampling](https://discourse.julialang.org/t/importing-cairomakie-prevents-sampling/59501)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 7\
**Last updated:** [April 22, 2021, 8:47am UTC](https://discourse.julialang.org/t/importing-cairomakie-prevents-sampling/59501 "2021-04-22T08:47:42Z")

</div>

I have a script that runs fine unless I have import CairoMakie at the top. Then it hangs. How can I diagnose this? It hangs at mcmc\_with\_warmup. The same thing happens whether I have using CairoMakie or import CairoMaki…
