Skip to content
Snippets Groups Projects
Commit 1c8f8835 authored by ac_fx's avatar ac_fx
Browse files

csf_spatial

parent d9ca0346
No related branches found
No related tags found
No related merge requests found
function [csf_mean,csf_std] = csf_spatial(Y,idxTrue)
function csf = csf_spatial(Y,idxTrue)
K = length(unique(idxTrue));
mcdf = [];
scdf = [];
if size(Y,2)~=K
fprintf(2,'csf_spatial Y input dimensionality=%d must match K=%d',size(Y,2),K);
csf_mean = nan;
csf_std = nan;
return;
end
csf = [];
for ik=1:K
idxk=find(idxTrue==ik);
yk=Y(idxk,:);
[dk,sk] = CSF.od2d(yk);
mcdf(ik)=dk;
scdf(ik)=sk;
dx = CSF.od_rkhs(yk);
csf(idxk) = dx;
end
csf_mean = mean(mcdf);
csf_std = std(mcdf);
4;
\ No newline at end of file
function [dk,sk] = od2d(xk)
cx = repmat(mean(xk),size(xk,1),1);
dd = vecnorm(cx - xk, 2, 2);
% dd = sqrt( (cx(:,1)-xk(:,1)).^2 + (cx(:,2)-xk(:,2)).^2 );
idx=find( abs(dd-mean(dd))<std(dd));
dd = dd(idx);
dk = mean(dd) + log2(length(idx))/length(idx);
sk = std(dd);
4;
% KX = NCD.Press(xk,[]);
% dx = pdist2(xk,xk);
%
% dk = KX - kx + log2(length(xk));
% dx = pdist(xk);
% dk = max(dx) - min(dx);
% sk = norm(std(xk));
% xx = (xk - mean(xk)) ./ std(xk);
% [h,p] = kstest(xx);
% dk = 1-p;
\ No newline at end of file
% computes optimality deficiency for each xk in the rkhs
% od = Z(x) - z(x) + log|x|
function dx = od_rkhs(xk)
cx = repmat(mean(xk),size(xk,1),1);
dx = vecnorm(cx - xk, 2, 2) + log2(size(xk,1));
4;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment