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

📄 sparsevariances.m

📁 a function inside machine learning
💻 M
字号:
function [variances, bs] = sparseVariances(K, Kj, Y, Yj, columnIndices)%Comnpute the variances of the columns of the kernel matrix.  ColumnIndices should be a column%vector. The variable called bs is the values of the selected b's , scaled%so that b'Kb = 1 (note, we don't scale by kj)if (nargin ~= 5)    fprintf('%s\n', help(sprintf('%s', mfilename)));    error('Incorrect number of inputs - see above usage instructions.');endnumExamples = size(K, 1); numColumns = size(K, 2); normVector = K(sub2ind(size(K), columnIndices , (1:numColumns)')); infiniteIndices = setdiff((normVector == 0) .* (1:numColumns)', 0);warning('off','MATLAB:divideByZero');invNormVector = 1./normVector;  invNormVector(infiniteIndices) = 0;%invNormVector = 1./sqrt(diag(K(columnIndices, :)));  warning('on','MATLAB:divideByZero');variances = sum(Kj.^2, 1)' .* invNormVector; bs = sqrt(invNormVector); 

⌨️ 快捷键说明

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