GMMB_PDF - (Complex range) multivariate Gaussian mixture model pdf p = gmmb_pdf(data, bayesS) data = N x D matrix bayesS = 1 x K struct array, the bayesS struct, fields used: mu = D x C matrix sigma = D x D x C matrix array weight = C x 1 vector p = N x K matrix D dimensions, N points, C components, K classes The result is a matrix of PDF values computed for each data point and class. see: GMMB_CMVNPDF
0001 %GMMB_PDF - (Complex range) multivariate Gaussian mixture model pdf 0002 % 0003 % p = gmmb_pdf(data, bayesS) 0004 % 0005 % data = N x D matrix 0006 % bayesS = 1 x K struct array, the bayesS struct, 0007 % fields used: 0008 % mu = D x C matrix 0009 % sigma = D x D x C matrix array 0010 % weight = C x 1 vector 0011 % 0012 % p = N x K matrix 0013 % 0014 % D dimensions, N points, C components, K classes 0015 % 0016 % The result is a matrix of PDF values computed for 0017 % each data point and class. 0018 % see: GMMB_CMVNPDF 0019 0020 % Author: Pekka Paalanen <pekka.paalanen@lut.fi> 0021 0022 % 0023 % $Name: $ 0024 % $Id: gmmb_pdf.m,v 1.2 2004/11/02 09:00:18 paalanen Exp $ 0025 0026 function [pdf] = gmmb_pdf(data_, bayesS_); 0027 N = size(data_,1); 0028 K = size(bayesS_, 2); 0029 0030 pdf = zeros(N,K); 0031 0032 for k = 1:K 0033 weight = bayesS_(k).weight; 0034 mu = bayesS_(k).mu; 0035 sigma = bayesS_(k).sigma; 0036 0037 p = zeros(N,1); 0038 for c = 1:size(weight,1); 0039 p = p + weight(c) * ... 0040 gmmb_cmvnpdf(data_, mu(:,c).', sigma(:,:,c)); 0041 end 0042 pdf(:,k) = p; 0043 end 0044