wolffd@0
|
1 function [initState, transmat, mu, Nproto, pick] = mhmmParzen_train_observed(obsData, hiddenData, ...
|
wolffd@0
|
2 nstates, maxNproto, varargin)
|
wolffd@0
|
3 % mhmmParzentrain_observed with mixture of Gaussian outputs from fully observed sequences
|
wolffd@0
|
4 % function [initState, transmat, mu, Nproto] = mhmm_train_observed_parzen(obsData, hiddenData, ...
|
wolffd@0
|
5 % nstates, maxNproto)
|
wolffd@0
|
6 %
|
wolffd@0
|
7 %
|
wolffd@0
|
8 % INPUT
|
wolffd@0
|
9 % If all sequences have the same length
|
wolffd@0
|
10 % obsData(:,t,ex)
|
wolffd@0
|
11 % hiddenData(ex,t) - must be ROW vector if only one sequence
|
wolffd@0
|
12 % If sequences have different lengths, we use cell arrays
|
wolffd@0
|
13 % obsData{ex}(:,t)
|
wolffd@0
|
14 % hiddenData{ex}(t)
|
wolffd@0
|
15 %
|
wolffd@0
|
16 % Optional argumnets
|
wolffd@0
|
17 % dirichletPriorWeight - for smoothing transition matrix counts
|
wolffd@0
|
18 % mkSymmetric
|
wolffd@0
|
19 %
|
wolffd@0
|
20 % Output
|
wolffd@0
|
21 % mu(:,q)
|
wolffd@0
|
22 % Nproto(q) is the number of prototypes (mixture components) chosen for state q
|
wolffd@0
|
23
|
wolffd@0
|
24 [transmat, initState] = transmat_train_observed(...
|
wolffd@0
|
25 hiddenData, nstates, varargin{:});
|
wolffd@0
|
26
|
wolffd@0
|
27 % convert to obsData(:,t*nex)
|
wolffd@0
|
28 if ~iscell(obsData)
|
wolffd@0
|
29 [D T Nex] = size(obsData);
|
wolffd@0
|
30 obsData = reshape(obsData, D, T*Nex);
|
wolffd@0
|
31 else
|
wolffd@0
|
32 obsData = cat(2, obsData{:});
|
wolffd@0
|
33 hiddenData = cat(2, hiddenData{:});
|
wolffd@0
|
34 end
|
wolffd@0
|
35 [mu, Nproto, pick] = parzen_fit_select_unif(obsData, hiddenData(:), maxNproto);
|
wolffd@0
|
36
|
wolffd@0
|
37
|