diff functions/funcsMobilab/gmm_classification.m @ 0:2fadb31a9d55 tip

Import code by Vuegen et al
author Dan Stowell <dan.stowell@elec.qmul.ac.uk>
date Fri, 11 Oct 2013 12:02:43 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/functions/funcsMobilab/gmm_classification.m	Fri Oct 11 12:02:43 2013 +0100
@@ -0,0 +1,34 @@
+function [ loglik y_classified] = gmm_classification(features, gmmParam)
+%%
+%   Mobilab 2012-2013  
+%   
+%   Input arguments:
+%       - features is a matrix structure:: 
+%               *) rows: different coefficients
+%               *) columns: different frames
+%       - gmmParem is a cellStructure:
+%            As many cells as GMM models:
+%       - Config:
+%               *) windowClassification_ms: the size of the for classification
+%               *) samplfeFrequency: the sample frequency of the .wav files
+%               *) framelen_ms: is the size of the frames where the MFCC are
+%               on computed
+%   Output arguments
+%       - probs is a matrix structure:
+%               *) rows: the prob of the corresponding event
+%               %) columns: the corresponding window
+%%
+%Prealloction for speed
+nrEvents=length(features);
+nrClasses=length(gmmParam);
+loglik=zeros(nrClasses, nrEvents);
+%Do a classification
+for(classNr=1:nrClasses)
+    for(eventNr=1:nrEvents)
+         loglik(classNr,eventNr) = mean(log(pdf(gmmParam{classNr},features{eventNr,1}')));         
+    end,
+end,
+[ignore y_classified] = max(loglik);
+end
+
+