ITE / code / shared / embedded / ITL / correncoef_2.m

% Direct computation of Correntropy coefficient
%
% Author : Sohan Seth (sohan@cnel.ufl.edu) Date : Date: 01.06.2009

function val = correncoef_2(X,Y,kernelSize)

n = length(X);
Kxx = ones(n,n); Kyy = ones(n,n);
for count1 = 1:n
    for count2 = count1+1:n
        Kxx(count1,count2) = exp(-(norm(X(count1,:) - X(count2,:)))^2/(2*kernelSize^2));
        Kxx(count2,count1) = Kxx(count1,count2);
        Kyy(count1,count2) = exp(-(norm(Y(count1,:) - Y(count2,:)))^2/(2*kernelSize^2));
        Kyy(count2,count1) = Kyy(count1,count2);
    end
end

Kxy = ones(n,n);
for count1 = 1:n
    for count2 =1:n
        Kxy(count1,count2) = exp(-(norm(X(count1,:) - Y(count2,:)))^2/(2*kernelSize^2));
    end
end

A  = sum(exp(-((X - Y)).^2/(2*kernelSize^2)))/n;

val = (A - sum(Kxy(:))/n^2)/sqrt((1 - sum(Kxx(:))/n^2)*(1 - sum(Kyy(:))/n^2));
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.