Commit d3b662f8 authored by Ajay TANWANI's avatar Ajay TANWANI

semitiedGMM tying factor + readme edit

parent d8cc3060
......@@ -39,7 +39,7 @@ HMM, HSMM:
}
```
Semi-tied covariances in mixture models:
Semi-tied GMMs/HSMMs, LQT:
```
@article{Tanwani16RAL,
author="Tanwani, A. K. and Calinon, S.",
......
......@@ -22,6 +22,8 @@ function demo_semitiedGMM01
% Copyright (c) 2015 Idiap Research Institute, http://idiap.ch/
% Written by Ajay Tanwani and Sylvain Calinon
%
% Correspondence: Ajay Tanwani <http://www.ajaytanwani.com>
%
% This file is part of PbDlib, http://www.idiap.ch/software/pbdlib/
%
% PbDlib is free software: you can redistribute it and/or modify
......@@ -45,6 +47,7 @@ model.nbStates = 3; %Number of states in the GMM
model.nbVar = 3; %Number of variables [x1,x2,x3]
model.nbSamples = 5; %Number of demonstrations
model.params_Bsf = 5E-2; %Initial variance of B in semi-tied GMM
model.params_alpha = 1.0; % tying factor for the basis functions
nbData = 300; %Length of each trajectory
......
function [model, LL] = EM_semitiedGMM(Data, model)
function [model, LL] = EM_semitiedGMM(Data, model)
% EM procedure to estimate parameters of a semi-tied Gaussian Mixture Model
%
% Writing code takes time. Polishing it and making it available to others takes longer!
......@@ -21,6 +21,8 @@ function [model, LL] = EM_semitiedGMM(Data, model)
% Copyright (c) 2015 Idiap Research Institute, http://idiap.ch/
% Written by Ajay Tanwani and Sylvain Calinon
%
% Correspondence: Ajay Tanwani <http://www.ajaytanwani.com>
%
% This file is part of PbDlib, http://www.idiap.ch/software/pbdlib/
%
% PbDlib is free software: you can redistribute it and/or modify
......@@ -56,7 +58,12 @@ end
if ~isfield(model,'params_nbVariationSteps')
model.params_nbVariationSteps = 50;
end
if ~isfield(model,'params_nbVariationSteps')
model.params_nbVariationSteps = 50;
end
if ~isfield(model,'params_alpha')
model.params_alpha = 1.0;
end
if ~isfield(model,'B')
model.B = eye(model.nbVar) * model.params_Bsf;
model.InitH = pinv(model.B) + eye(model.nbVar) * model.params_diagRegFact;
......@@ -100,7 +107,8 @@ for nbIter=1:model.params_nbMaxSteps
%Update Sigma
model.H = pinv(model.B) + eye(model.nbVar) * model.params_diagRegFact;
for i=1:model.nbStates
model.Sigma(:,:,i) = model.H * model.SigmaDiag(:,:,i) * model.H'; %Eq.(3)
% model.Sigma(:,:,i) = model.H * model.SigmaDiag(:,:,i) * model.H'; %Eq.(3)
model.Sigma(:,:,i) = model.params_alpha*(model.H*model.SigmaDiag(:,:,i)*model.H') + (1 - model.params_alpha)*model.S(:,:,i); % Eq. (10)
end
%Compute average log-likelihood
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment