# Multinomial(::Int, ::Vector{Any}) error in Turing doing LDA

**URL:** <https://discourse.julialang.org/t/multinomial-int-vector-any-error-in-turing-doing-lda/76066>\
**Category:** Probabilistic Programming\
**Tags:** turing\
**Created:** [February 9, 2022, 10:34am UTC](https://discourse.julialang.org/t/multinomial-int-vector-any-error-in-turing-doing-lda/76066 "2022-02-09T10:34:31Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![sethaxen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sethaxen/32/35604_2.png) [@sethaxen](https://discourse.julialang.org/u/sethaxen)\
**Post date:** [February 9, 2022, 4:13pm UTC](https://discourse.julialang.org/t/multinomial-int-vector-any-error-in-turing-doing-lda/76066/6 "2022-02-09T16:13:30Z")

</div>

> [@HenriDeh](#):
>
> LDA is fundamentally about categorical latent variables though, so I guess HMC and NUTS won’t ever be possible.

In many cases, you can marginalize out the discrete parameters to get a continuous model amenable to sampling with NUTS (see [9.5 Latent Dirichlet allocation | Stan User’s Guide](https://mc-stan.org/docs/2_28/stan-users-guide/latent-dirichlet-allocation.html) for LDA) and then recover exact discrete draws in post-processing (see [[Turing] Using a random variable as an index - #2 by sethaxen](https://discourse.julialang.org/t/turing-using-a-random-variable-as-an-index/66756/2#marginalizing-3) for a Turing example). This often yields better inferences than sampling discrete parameters directly, but it takes some more work up-front, which is why Turing’s support of Gibbs samplers is useful. It’s still good to know though that easy-to-use samplers often are easy because they don’t error when they have problems, not because they don’t have them.

> [@HenriDeh](#):
>
> In the course, the professor says he used Gibbs Sampling. In Turing, GS is a way to use multiple samplers for different variables. I think in the course, GS refers to using MH for one variable given all the other variables.

These two are equivalent. In Turing you specify which parameters will use which sampler. When that sampler is used, all other parameters are held fixed, i.e. the joint model is conditioned on them.

---

_[View the full topic](https://discourse.julialang.org/t/multinomial-int-vector-any-error-in-turing-doing-lda/76066)._
