# CategoricalGibbsMetropolis vs HMC

**URL:** <https://discourse.pymc.io/t/categoricalgibbsmetropolis-vs-hmc/3370>\
**Category:** Questions\
**Created:** [June 1, 2019, 5:54am UTC](https://discourse.pymc.io/t/categoricalgibbsmetropolis-vs-hmc/3370 "2019-06-01T05:54:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rzu512](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/rzu512/32/1067_2.png) [@rzu512](https://discourse.pymc.io/u/rzu512)\
**Post date:** [June 1, 2019, 5:54am UTC](https://discourse.pymc.io/t/categoricalgibbsmetropolis-vs-hmc/3370/1 "2019-06-01T05:54:44Z")

</div>

Hi. Here is something that I really don’t get.

Pymc3 have a step method called `CategoricalGibbsMetropolis`.

I would guess that if NUTS work well for categorical distribution, there would be no need to use `CategoricalGibbsMetropolis`.

Does that mean NUTS and Hamiltonian Monte Carlo generally don’t work well for categorical and Bernoulli distributions? Why is this the case?

Thanks.

---

<div class="post-metadata">

**Author:** ![junpenglao](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/junpenglao/32/8_2.png) [@junpenglao](https://discourse.pymc.io/u/junpenglao)\
**Post date:** [June 1, 2019, 10:30am UTC](https://discourse.pymc.io/t/categoricalgibbsmetropolis-vs-hmc/3370/2 "2019-06-01T10:30:03Z")

</div>

In general, Hamiltonian does not support discrete variable, as the construction of Hamiltonian Monte Carlo proposals relies on a numerical solution of a differential equation. There are some effort of embedding discrete variables into continuous space (e.g., [https://arxiv.org/abs/1705.08510](https://arxiv.org/abs/1705.08510)), but so far there is no satisfying solutions that works in practices.
