about summary refs log tree commit diff
path: root/sourcecodes/bnt-master/HMM/mhmmParzen_train_observed.m
blob: 1786e9a21b036c74c9c4f21fb2d1b6d47afca771 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
function [initState, transmat, mu, Nproto, pick] = mhmmParzen_train_observed(obsData, hiddenData, ...
						  nstates, maxNproto, varargin)
% mhmmParzentrain_observed  with mixture of Gaussian outputs from fully observed sequences
% function [initState, transmat, mu, Nproto] = mhmm_train_observed_parzen(obsData, hiddenData, ...
%						  nstates, maxNproto)
%
%
% INPUT
% If all sequences have the same length
% obsData(:,t,ex) 
% hiddenData(ex,t)  - must be ROW vector if only one sequence
% If sequences have different lengths, we use cell arrays
% obsData{ex}(:,t) 
% hiddenData{ex}(t)
%
% Optional argumnets
% dirichletPriorWeight - for smoothing transition matrix counts
% mkSymmetric
%
% Output
% mu(:,q)
% Nproto(q) is the number of prototypes (mixture components) chosen for state q

[transmat, initState] = transmat_train_observed(...
    hiddenData, nstates, varargin{:});

% convert to obsData(:,t*nex)
if ~iscell(obsData)
  [D T Nex] = size(obsData);
  obsData = reshape(obsData, D, T*Nex);
else
  obsData = cat(2, obsData{:});
  hiddenData = cat(2, hiddenData{:});
end
[mu, Nproto, pick] = parzen_fit_select_unif(obsData, hiddenData(:), maxNproto);