Home > utils > prt_normalise_kernel.m

prt_normalise_kernel

PURPOSE ^

This function normalises the kernel matrix such that each entry is

SYNOPSIS ^

function C = prt_normalise_kernel(K)

DESCRIPTION ^

 This function normalises the kernel matrix such that each entry is 
 divided by the product of the std deviations, i.e.
 K_new(x,y) = K(x,y) / sqrt(var(x)*var(y)) 
__________________________________________________________________________
 Copyright (C) 2011 Machine Learning & Neuroimaging Laboratory

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function C = prt_normalise_kernel(K)
0002 
0003 % This function normalises the kernel matrix such that each entry is
0004 % divided by the product of the std deviations, i.e.
0005 % K_new(x,y) = K(x,y) / sqrt(var(x)*var(y))
0006 %__________________________________________________________________________
0007 % Copyright (C) 2011 Machine Learning & Neuroimaging Laboratory
0008 
0009 % Written by A. Marquand
0010 % Id: $
0011 
0012 d  = diag(K);
0013 K0 = sqrt(repmat(d,[1,size(K,1)]).* repmat(d',[size(K,1),1]));
0014 C  = K./K0;
0015 
0016 end

Generated on Mon 03-Sep-2012 18:07:18 by m2html © 2005