1 % The likelihood of the observation for a single Markov Chain
\r
2 function likelihood = chain_log_likelihood(observation, mc)
\r
3 likelihood = log(mc.t(observation(1)));
\r
4 n = size(observation, 2);
\r
6 likelihood = likelihood + log(mc.T(observation(i-1), observation(i)));
\r
9 end_state = size(mc.T, 2);
\r
10 % Add in the stop probability
\r
11 likelihood = likelihood + log(mc.T(observation(n), end_state));