comparison toolboxes/FullBNT-1.0.7/HMM/gausshmm_train_observed.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:e9a9cd732c1e
1 function [initState, transmat, mu, Sigma] = gausshmm_train_observed(obsData, hiddenData, ...
2 nstates, varargin)
3 % GAUSSHMM_TRAIN_OBSERVED Estimate params of HMM with Gaussian output from fully observed sequences
4 % [initState, transmat, mu, Sigma] = gausshmm_train_observed(obsData, hiddenData, nstates,...)
5 %
6 % INPUT
7 % If all sequences have the same length
8 % obsData(:,t,ex)
9 % hiddenData(ex,t) - must be ROW vector if only one sequence
10 % If sequences have different lengths, we use cell arrays
11 % obsData{ex}(:,t)
12 % hiddenData{ex}(t)
13 %
14 % Optional argumnets
15 % dirichletPriorWeight - for smoothing transition matrix counts
16 %
17 % Optional parameters from mixgauss_Mstep:
18 % 'cov_type' - 'full', 'diag' or 'spherical' ['full']
19 % 'tied_cov' - 1 (Sigma) or 0 (Sigma_i) [0]
20 % 'clamped_cov' - pass in clamped value, or [] if unclamped [ [] ]
21 % 'clamped_mean' - pass in clamped value, or [] if unclamped [ [] ]
22 % 'cov_prior' - Lambda_i, added to YY(:,:,i) [0.01*eye(d,d,Q)]
23 %
24 % Output
25 % mu(:,q)
26 % Sigma(:,:,q)
27
28 [dirichletPriorWeight, other] = process_options(...
29 varargin, 'dirichletPriorWeight', 0);
30
31 [transmat, initState] = transmat_train_observed(hiddenData, nstates, ...
32 'dirichletPriorWeight', dirichletPriorWeight);
33
34 % convert to obsData(:,t*nex)
35 if ~iscell(obsData)
36 [D T Nex] = size(obsData);
37 obsData = reshape(obsData, D, T*Nex);
38 else
39 obsData = cat(2, obsData{:});
40 hiddenData = cat(2,hiddenData{:});
41 end
42 [mu, Sigma] = condgaussTrainObserved(obsData, hiddenData(:), nstates, varargin{:});
43
44