⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dualmaxsparsekernelapprox.m.svn-base

📁 a function inside machine learning
💻 SVN-BASE
字号:
function b = dualMaxSparseKernelApprox(K, Kj, Y, Yj)
%Find the sparse direction that is the best approximation of the kernel
%matrix. This is given by max 2b'KKKKb/b'K^2b - (b'KKKb/b'K^2b)^2. 
%Here we assume uj = Xj'bj but is the expression to compute double
%deflation correct? Note, we can't just pick columns of the deflated kernel
%matrix in this case 

if (nargin ~= 4)
    fprintf('%s\n', help(sprintf('%s', mfilename)));
    error('Incorrect number of inputs - see above usage instructions.');
end

numExamples = size(K, 1); 

KK = Kj*Kj; 
KKK = KK*Kj; 
KKKK = KKK*Kj; 

vals = 2*diag(KKKK)./diag(KK) - (diag(KKK)./diag(KK)).^2; 

[val, index] = max(vals); 

b = sparse(numExamples, 1); 
b(index) = 1/sqrt(Kj(index, index)); %Normalise by bj'Kjbj = 1;



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -