Mercurial > hg > dcase2013_ed_vuegenetal
annotate 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 |
rev | line source |
---|---|
dan@0 | 1 function [ loglik y_classified] = gmm_classification(features, gmmParam) |
dan@0 | 2 %% |
dan@0 | 3 % Mobilab 2012-2013 |
dan@0 | 4 % |
dan@0 | 5 % Input arguments: |
dan@0 | 6 % - features is a matrix structure:: |
dan@0 | 7 % *) rows: different coefficients |
dan@0 | 8 % *) columns: different frames |
dan@0 | 9 % - gmmParem is a cellStructure: |
dan@0 | 10 % As many cells as GMM models: |
dan@0 | 11 % - Config: |
dan@0 | 12 % *) windowClassification_ms: the size of the for classification |
dan@0 | 13 % *) samplfeFrequency: the sample frequency of the .wav files |
dan@0 | 14 % *) framelen_ms: is the size of the frames where the MFCC are |
dan@0 | 15 % on computed |
dan@0 | 16 % Output arguments |
dan@0 | 17 % - probs is a matrix structure: |
dan@0 | 18 % *) rows: the prob of the corresponding event |
dan@0 | 19 % %) columns: the corresponding window |
dan@0 | 20 %% |
dan@0 | 21 %Prealloction for speed |
dan@0 | 22 nrEvents=length(features); |
dan@0 | 23 nrClasses=length(gmmParam); |
dan@0 | 24 loglik=zeros(nrClasses, nrEvents); |
dan@0 | 25 %Do a classification |
dan@0 | 26 for(classNr=1:nrClasses) |
dan@0 | 27 for(eventNr=1:nrEvents) |
dan@0 | 28 loglik(classNr,eventNr) = mean(log(pdf(gmmParam{classNr},features{eventNr,1}'))); |
dan@0 | 29 end, |
dan@0 | 30 end, |
dan@0 | 31 [ignore y_classified] = max(loglik); |
dan@0 | 32 end |
dan@0 | 33 |
dan@0 | 34 |