centerkernel.m.svn-base

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

SVN-BASE
19
字号
function [cK, km]  = centerKernel(K) 
%Centers a kernel matrix 
%
%inputs 
% K is the matrix to be centered
%
%outputs 
% cK is the centered matrix 
% km is the mean of the cols/rows of the kernel matrix 

%The number of examples 
ell = size(K,1);
km = sum(K, 2)/ell;
E = sum(km)/ell;
J = ones(ell,1) * km';

cK = K - J - J' + E * ones(ell, ell);

⌨️ 快捷键说明

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