dualmaxsparsecovariancelm.m.svn-base

来自「a function inside machine learning」· SVN-BASE 代码 · 共 28 行

SVN-BASE
28
字号
function [b, tau] = dualMaxSparseCovarianceLM(K, Kj, Y, Yj, previousTau, previousB, startExample)
%A function to compute the maximum sparse covariance vector between partial kernel matrix
%K and vector y. Works on chunks of cols of the kernel matrix, i.e. the whole kernel matrix need not be 
%in memory. 

%We just use the example with the highest absolute covariance
numPartialExamples = size(Kj, 2); 
numTotalExamples = size(Kj, 1); 
columnIndices = (startExample:(startExample+numPartialExamples-1))'; 
previousCovariance = abs(previousTau'*Yj);


covariances = sparseCovariances(K, Kj, Y, Yj, columnIndices); 
[maxCovariance, i] = max(abs(covariances));

%Note that b is scaled so that ||X'b|| = 1 
if maxCovariance > previousCovariance
    a = sqrt(abs(K(i+startExample-1, i)))*sign(covariances(i)); 
    b = zeros(numTotalExamples, 1); 
    b(i+startExample-1) = 1/a;
    tau = Kj(:, i)'/a;  %Tau is the ith column of this part of Kj
else
    b = previousB; 
    tau = previousTau; 
end


⌨️ 快捷键说明

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