Custom Categorical Distribution - ensure bounded candidates

Hi Chris,

You could have a look at the DiscreteMarkovChain distribution in pymc-experimental. We also have an example showing how it can be used in an HMM. As of a few weeks ago, DiscreteMarkovChain is now compatible with MarginalModel, so you can automatically marginalize out the markov chain in an HMM. There are some limitations: you can only have an order 1 HMM (we haven’t added support for marginalizing more lags yet), and you can’t automatically recover the hidden states after marginalization.

To actually answer your question as posed, clip is indeed the best way. See this discussion for details.

1 Like