forward_algorithm_logspace: Forward algorithm in logspace

Description Usage Arguments Value

Description

Computes ln( P(X_T = i, Y_1:T = y_1:T) ) for i=1...M, where M is the number of hidden states and Y = (y_1, ... , y_T), using the so-called forward-algorithm. (cf. e.g. https://en.wikipedia.org/wiki/Forward_algorithm) This implementation is more stable than algorithm_logspace, which is otherwise identical, but which does not work in logspace.

Usage

1
2
forward_algorithm_logspace(Y, transition_probs, emission_probs, prior,
  FULL_CHAIN = FALSE)

Arguments

Y

sequence of observed 0-1 valued emissions.

emission_probs

a vector of emission probabilities. The ith entry is interpreted as the probability of Y=1 given X=i.

prior

a vector encoding the a prior distribution on X0; not X[1], but the stete preceding it, i.e. there is no observed emission of the variable X0

FULL_CHAIN

logical; if set to true, the full chain of probabilities computed is returned (instead of just the last distribution).

trnasition_probs

an M-by-M matrix of transition probabilities

Value

Depending on the value of FULL_CHAIN, either: * a vector alpha with entries ln( P(X_T = i, Y_1:T = y_1:T) ) for i=1...M for i=1...M (default), or * an M-by-T matrix with entries ln( P(X_t = i, Y_1:t = y_1:t) for i=1...M, t=1...T (if FULL_CHAIN is set to TRUE).


Cronjaeger/HotBirdHMM documentation built on May 9, 2019, 6:01 p.m.