HMM utilities

scalar compute_aic(const size_t m_states, const scalar llh)

Compute the Akaike Information Criterion from the number of states and the likelihood of a HMM.

scalar compute_bic(const size_t n_obs, const size_t m_states, const scalar llh)

Compute the Bayesian Information Criterion from the number of obersavations, the number of states, and the likelihood of a HMM.

scalar compute_log_likelihood(const size_t n_obs, const size_t m_states, const scalar *restrict const lalpha)

Compute the logarithm of the likelihood of a fitted HMM based on the forward probabilities.

extern void log_csprobs(const size_t n_obs, const size_t m_states, const scalar llh, const scalar *restrict const lalpha, const scalar *restrict const lbeta, scalar *restrict const lcsp)

Compute the conditional state probabilities.

extern int local_decoding(const size_t n_obs, const size_t m_states, const scalar *lcsp, size_t *states)

Compute the most likely hidden state under the HMM for each observation individually.

extern int global_decoding(const size_t n_obs, const size_t m_states, const scalar *restrict const lgamma, const scalar *restrict const ldelta, const scalar *restrict lcsp, size_t *restrict states)

Compute the most likely sequence of hidden states under the HMM using the Viterbi algorithm.