CategoricalGibbsMetropolis step for DiscreteUniform distributions

The CategoricalGibbsMetropolis step method is the default for the Categorical distribution. The Metropolis step method may not work for Categorical in some circumstances, e,.g. as part of compound distribution. However, CategoricalGibbsMetropolis currently can only be used with Categorical or Bernoulli distributions.

I have a model where I need to use a DiscreteUniform distribution rather than Categorical, as the k parameter can be very large. It would be useful if the CategoricalGibbsMetropolis step method could also be used for DiscreteUniform distributions, which are after all a special case of Categorical.

I think you can specify the sampler to sample a specific RV, something like:

step = pm.CategoricalGibbsMetropolis([your_rv])

However, warning re metropolis is that it is not always mix will with NUTS, in another word, mixing discrete and continuous parameter only works in some limited cases. You can try using a Uniform instead, unless you are using it to do indexing it works usually.

What you say is true, but the code for CategoricalGibbsMetropolis step method checks the distribution type and raises an error if it is not Categorical or Bernoulli.

As regards your second point, in my case I find that discrete and continuous parameters do mix OK provide that a Metropolis step method is specified for the continuous parameters also.