Description Usage Arguments Value
Forward-backward algorithm using the scaling technique. That's more stable (and maybe even faster) than the method with the logarithm. Warning: this function overwrites the lliks matrix.
1 | forward_backward(initP, trans, lliks, seqlens, posteriors, nthreads = 1L)
|
initP |
matrix of initial probabilities: each column corresponds to a sequence |
trans |
transition matrix (rows are previous state, columns are next state) |
lliks |
matrix with emission probabilities for each datapoint and each state. Columns are datapoints and rows are states. |
seqlens |
length of each subsequence of datapoints (set this to ncol(lliks) if there is only one sequence). |
posteriors |
the posteriors matrix where the posteriors will be written. its value when the function is called does not matter, but it needs to have the right dimensions (rows are states and columns are observations). |
nthreads |
number of threads used. Sequences of observations are
processed independently by different threads (if |
a list with the following arguments:
posteriors |
posterior probability of being in a certain state for a certain datapoint. Same matrix used as input argument. |
tot_llik |
total log-likelihood of the data given the hmm model. |
new_trans |
update for the transition probabilities (it is already normalized). |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.