time | Calls | line |
---|
| | 40 | function [pdfs] = pdfs_from_samples(o, samples)
|
0.03 | 909 | 41 | pdfs = zeros(o.nclass, o.nsample, 'single');
|
< 0.01 | 909 | 42 | for i = 1:o.nclass
|
0.21 | 5445 | 43 | mu_deviation = samples - repmat(o.mu(:,i), 1, o.nsample);
|
1.54 | 5445 | 44 | qmd = sum(mu_deviation .* (o.Sigma(:,:,i)\mu_deviation), 1);
|
| | 45 |
|
0.08 | 5445 | 46 | ldS = 0.5*log(abs(det(o.Sigma(:,:,i))));
|
0.02 | 5445 | 47 | lC = log(o.P(i)) - (o.nfeature/2)*log(2*pi);
|
| | 48 |
|
0.44 | 5445 | 49 | pdfs(i,:) = exp(lC+(qmd/-2)-ldS);
|
< 0.01 | 5445 | 50 | end
|
0.12 | 909 | 51 | pdfs = pdfs .* isfinite(pdfs);
|
< 0.01 | 909 | 52 | end
|
Other subfunctions in this file are not included in this listing.