dualmaxsparsevariance2.m.svn-base
来自「a function inside machine learning」· SVN-BASE 代码 · 共 24 行
SVN-BASE
24 行
function b = dualMaxSparseVariance2(K, Kj, Y, Yj, kernelCols)
%A function to compute the maximum sparse variance vector between matrix
%K and vector y
%We just use the example with the highest absolute variance and select from
%only a few columns of the kernel matrix
if (nargin ~= 5)
fprintf('%s\n', help(sprintf('%s', mfilename)));
error('Incorrect number of inputs - see above usage instructions.');
end
numExamples = size(Kj, 1);
columnIndices = (1:numExamples)';
[variances, bs] = sparseVariances(K, Kj, Y, Yj, columnIndices);
permutationVector = randperm(numExamples);
colIndices = permutationVector(1:kernelCols);
variances2 = variances(colIndices);
[maxVariance, i] = max(variances2);
b = zeros(numExamples, 1);
b(colIndices(i)) = bs(colIndices(i));
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?