GMMB_LHOOD2FRAC Map likelihood values to density quantiles f = GMMB_LHOOD2FRAC(histS, lhood) histS K-element cell array created by gmmb_hist or gmmb_generatehist lhood N x K array of likelihood values. f N x K array of density quantile values This function finds the corresponding density quantile value of each likelihood value in the "lhood" array. For each column k in 1..K, the density quantile is found from histS{k}, so that each column may represent a different distribution. See gmmb_hist, gmmb_generatehist, gmmb_frac2lhood, gmmb_fracthresh References: [1] Paalanen, P., Kamarainen, J.-K., Ilonen, J., Kälviäinen, H., Feature Representation and Discrimination Based on Gaussian Mixture Model Probability Densities - Practices and Algorithms, Research Report 95, Lappeenranta University of Technology, Department of Information Technology, 2005. Author(s): Pekka Paalanen <pekka.paalanen@lut.fi> Jarmo Ilonen <jarmo.ilonen@lut.fi> Joni Kamarainen <Joni.Kamarainen@lut.fi> Copyright: Bayesian Classifier with Gaussian Mixture Model Pdf functionality is Copyright (C) 2004 by Pekka Paalanen and Joni-Kristian Kamarainen. $Name: $ $Revision: 1.2 $ $Date: 2005/04/14 10:33:34 $
0001 %GMMB_LHOOD2FRAC Map likelihood values to density quantiles 0002 % 0003 % f = GMMB_LHOOD2FRAC(histS, lhood) 0004 % 0005 % histS K-element cell array created by gmmb_hist or gmmb_generatehist 0006 % lhood N x K array of likelihood values. 0007 % f N x K array of density quantile values 0008 % 0009 % This function finds the corresponding density quantile value of each 0010 % likelihood value in the "lhood" array. 0011 % For each column k in 1..K, the density quantile is found from histS{k}, 0012 % so that each column may represent a different distribution. 0013 % 0014 % See gmmb_hist, gmmb_generatehist, gmmb_frac2lhood, gmmb_fracthresh 0015 % 0016 % References: 0017 % [1] Paalanen, P., Kamarainen, J.-K., Ilonen, J., Kälviäinen, H., 0018 % Feature Representation and Discrimination Based on Gaussian Mixture Model 0019 % Probability Densities - Practices and Algorithms, Research Report 95, 0020 % Lappeenranta University of Technology, Department of Information 0021 % Technology, 2005. 0022 % 0023 % Author(s): 0024 % Pekka Paalanen <pekka.paalanen@lut.fi> 0025 % Jarmo Ilonen <jarmo.ilonen@lut.fi> 0026 % Joni Kamarainen <Joni.Kamarainen@lut.fi> 0027 % 0028 % Copyright: 0029 % 0030 % Bayesian Classifier with Gaussian Mixture Model Pdf 0031 % functionality is Copyright (C) 2004 by Pekka Paalanen and 0032 % Joni-Kristian Kamarainen. 0033 % 0034 % $Name: $ $Revision: 1.2 $ $Date: 2005/04/14 10:33:34 $ 0035 % 0036 0037 function fracmat = gmmb_lhood2frac(histS, lhood); 0038 0039 fracmat = zeros(size(lhood)); 0040 0041 K = size(lhood, 2); 0042 0043 for k = 1:K 0044 fracmat(:, k) = my_l2f_bin(histS{k}, lhood(:,k)); 0045 end 0046 0047 0048 % binary search, linear interpolating version 0049 function f = my_l2f_bin(v, lhoods); 0050 0051 f = zeros(size(lhoods)); 0052 len_v = length(v); 0053 0054 for i = 1:length(lhoods) 0055 x = lhoods(i); 0056 a = 1; 0057 b = len_v+1; 0058 0059 if x < v(a) 0060 f(i) = 1; 0061 continue; 0062 end 0063 0064 if x >= v(b-1) 0065 f(i) = 0; 0066 continue; 0067 end 0068 0069 while (b-a) > 1 0070 m = floor((a+b)/2); 0071 if( v(m) > x) 0072 b = m; 0073 else 0074 a = m; 0075 end 0076 end 0077 0078 h = v(b) - v(a); 0079 if h ~= 0 0080 sf = (x - v(a)) / h; 0081 else 0082 sf = 0.5; 0083 end 0084 0085 f(i) = 1 - (a+sf-1) / (len_v-1); 0086 end 0087 0088