You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
HMMs can be straightforwardly supported via the new to_distribution interface:
""" hmm(K, T) A Hidden Markov Model with `K` states and `T` observations with marginalized hidden states."""@modelfunctionhmm(K, T)
# Transition matrix.
π ~product_distribution(fill(Dirichlet(fill(1/ K, K)), K))
# Mean of emission distribution.
μ ~ Bijectors.ordered(MvNormal(zeros(K), 10I))
# HMM(init, trans, emissions).
hmm =HMM(π[:, 1], permutedims(π), Normal.(μ, 1))
y ~to_distribution(hmm, T)
return y
end
For to_distribution(hmm, T), we need to implement two methods, i.e.,
rand(to_distribution(hmm, T)) which samples y of length T
log pdf (to_distribution(hmm), y), which computes the marginal log density of y by the forward-backward algorithm.
The text was updated successfully, but these errors were encountered:
Copied from #595 (comment)
HMMs can be straightforwardly supported via the new
to_distribution
interface:For
to_distribution(hmm, T)
, we need to implement two methods, i.e.,rand(to_distribution(hmm, T))
which samplesy
of lengthT
log pdf (to_distribution(hmm), y)
, which computes the marginal log density ofy
by the forward-backward algorithm.The text was updated successfully, but these errors were encountered: