Mercurial > hg > machine-learning-hw6
view linearKernel.m @ 3:ace890ed0ed9 default tip
Use lookup to look for all words at once
author | Jordi Gutiérrez Hermoso <jordigh@octave.org> |
---|---|
date | Sat, 10 Dec 2011 15:56:02 -0500 |
parents | f602dc601e9e |
children |
line wrap: on
line source
function sim = linearKernel(x1, x2) %LINEARKERNEL returns a linear kernel between x1 and x2 % sim = linearKernel(x1, x2) returns a linear kernel between x1 and x2 % and returns the value in sim % Ensure that x1 and x2 are column vectors x1 = x1(:); x2 = x2(:); % Compute the kernel sim = x1' * x2; % dot product end