Skip to content

Commit

Permalink
tweak hmmEm a little
Browse files Browse the repository at this point in the history
  • Loading branch information
sth4nth committed Nov 28, 2018
1 parent 11687b3 commit 9a248da
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions chapter13/HMM/hmmEm.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
E = normalize(rand(k,d),2);
end
tol = 1e-4;
maxIter = 100;
maxIter = 1000;
llh = -inf(1,maxIter);
for iter = 2:maxIter
M = E*X;
% E-step
[gamma,alpha,beta,c] = hmmSmoother(M,A,s);
llh(iter) = mean(log(c));
if llh(iter)-llh(iter-1) < tol*abs(llh(iter-1)); break; end % check likelihood for convergence
if abs(llh(iter)-llh(iter-1)) < tol*abs(llh(iter-1)); break; end % check likelihood for convergence
% M-step
s = gamma(:,1); % 13.18
A = normalize(A.*(alpha(:,1:n-1)*(beta(:,2:n).*M(:,2:n)./c(2:n))'),2); % 13.19 13.43 13.65
Expand Down

0 comments on commit 9a248da

Please sign in to comment.