📄 dualmaxsparsekernelapprox.m.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 + -