wolffd@0
|
1 function obslik = mk_hmm_obs_lik_matrix(engine, evidence)
|
wolffd@0
|
2
|
wolffd@0
|
3 T = size(evidence,2);
|
wolffd@0
|
4 Q = length(engine.startprob);
|
wolffd@0
|
5 obslik = ones(Q, T);
|
wolffd@0
|
6 bnet = bnet_from_engine(engine);
|
wolffd@0
|
7 % P(o1,o2| Q1,Q2) = P(o1|Q1,Q2) * P(o2|Q1,Q2)
|
wolffd@0
|
8 onodes = bnet.observed;
|
wolffd@0
|
9 for i=1:length(onodes)
|
wolffd@0
|
10 data = cell2num(evidence(onodes(i),:));
|
wolffd@0
|
11 if bnet.auto_regressive(onodes(i))
|
wolffd@0
|
12 params = engine.obsprob{i};
|
wolffd@0
|
13 mu = params.big_mu;
|
wolffd@0
|
14 Sigma = params.big_Sigma,
|
wolffd@0
|
15 W = params.big_W;
|
wolffd@0
|
16 mu0 = params.big_mu0;
|
wolffd@0
|
17 Sigma0 = params.big_Sigma0;
|
wolffd@0
|
18 %obslik_i = mk_arhmm_obs_lik(data, mu, Sigma, W, mu0, Sigma0
|
wolffd@0
|
19 obslik_i = clg_prob(data(:,1:T-1), data(:,2:T), mu, Sigma, W);
|
wolffd@0
|
20 obslik_i = [mixgauss_prob(data(:,1), mu0, Sigma0) obslik_i];
|
wolffd@0
|
21 elseif myismember(onodes(i), bnet.dnodes)
|
wolffd@0
|
22 %obslik_i = eval_pdf_cond_multinomial(data, engine.obsprob{i}.big_CPT);
|
wolffd@0
|
23 obslik_i = multinomial_prob(data, engine.obsprob{i}.big_CPT);
|
wolffd@0
|
24 else
|
wolffd@0
|
25 %obslik_i = eval_pdf_cond_gauss(data, engine.obsprob{i}.big_mu, engine.obsprob{i}.big_Sigma);
|
wolffd@0
|
26 obslik_i = mixgauss_prob(data, engine.obsprob{i}.big_mu, engine.obsprob{i}.big_Sigma);
|
wolffd@0
|
27 end
|
wolffd@0
|
28 obslik = obslik .* obslik_i;
|
wolffd@0
|
29 end
|
wolffd@0
|
30
|