Hiho
unread,Mar 31, 2008, 9:03:45 PM3/31/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to MathTools
binnum = 262;
binsize = (max(points)-min(points)/binnum *ones([1 binnum]);
mbinsize = mean(binsize);
mean_bgr = mean(points);
bgrm = points-ones([size(points, 1), 1])*mean_bgr;
var_bgr = mean(bgrm.*bgrm);
dh = r - mean_bgr;
qhtmp = exp( - dh.*dh/2/var_bgr );
logqh_g = - dh.*dh/2/var_bgr;
logZqh_g = log(sum(qhtmp.*binsize));
score_g = eval_fit(logqh_g, logZqh_g, points, binnum, bins);
%%%
function score = eval_fit(logqh, logZqh, hbk, binnum, binAll)
score = 0;
for ii=1: size(hbk, 1)
if( hbk(ii)<=binAll(1) ) idx = 1;
else if ( hbk(ii)>binAll(end))
idx = binnum;
else
for jj=1:binnum-1
if( hbk(ii)>binAll(jj) &&hbk(ii)<=binAll(jj+1))
idx = jj;
break;
end
end
end
end
score = score + logqh(idx) - logZqh;
end