linearkernel.m.svn-base

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

SVN-BASE
15
字号
function kernelMatrix = linearKernel(X1, X2, kernelParams)
%A function to compute the linear kernel matrix entries between X1 and X2.
%These matrices must have the same number of colums 

useSparse = issparse(X1); 
numX1Examples = size(X1, 1); 
numX2Examples = size(X2, 1); 

if useSparse 
    kernelMatrix = sparse(numX1Examples, numX2Examples); 
else 
    kernelMatrix = zeros(numX1Examples, numX2Examples); 
end
    
kernelMatrix = X1*X2'; 

⌨️ 快捷键说明

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