PoisHmm object
-
struct PoisHmm
The
PoisHmm
structure encapsulates all data of a Hidden-Markov model with Poisson-distributed states.typedef struct PoisHmm { bool err; size_t n_obs; size_t m_states; size_t n_iter; size_t max_iter; scalar tol; scalar aic; scalar bic; scalar llh; PoisParams *init; PoisParams *params; PoisProbs *probs; } PoisHmm;
-
bool err
A boolean error indicator. err equals true if an error occurred during fitting.
-
size_t n_obs
An integral number greater than zero that specifies the number of states in an HMM.
-
size_t m_states
An integral number that specifies the number of observations, that is, the length of the input data set.
-
size_t n_iter
An integral number specifying the number of the iterations it took the fitting algorithm to converge. If it did not converge, this is equal to
max_iter
.
-
size_t max_iter
An positive integral number specifying the maximum number of iterations of the EM algorithm.
-
scalar tol
An floating point number specifying the update tolerance of the fitting algorithm. An computed update is only applied if the update score is greater than
tol
.
-
PoisParams *init
Pointer to initial model parameters.
-
PoisParams *params
Pointer to estimated model parameters.
-
bool err
Object creation
Initialization
Operations
All operations require a properly initialized PoisHmm
structure as
first parameter.
-
void PoisHmm_EstimateParams(PoisHmm *restrict const this, const DataSet *restrict const inp)
Compute maximum-likelihood estimates for the HMM parameters given the data set pointed to by
inp
. Estimates are computed using the Baum-Welch algorithm.During the fit, keep the members
n_iter
,llh
,params
, andprobs
up to date. This information may be used for further processing, such as model checking or, in case of errors, debugging at any time.Also, set the error indicator to true if the fit or any intermediate computation fails.
-
int PoisHmm_ForwardBackward(PoisHmm *restrict const this)
Compute the forward and backward probabilities of the HMM using the forward-backward algorithm.
-
int PoisHmm_ForwardProbabilities(PoisHmm *restrict const this)
Compute only the forward probabilities under the HMM.
-
int PoisHmm_BackwardProbabilities(PoisHmm *restrict const this)
Compute only the backward probabilities under the HMM.