Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hackassin
GitHub Repository: hackassin/Coursera-Machine-Learning
Path: blob/master/Week 7/Programming Assignment - 6/ex6/linearKernel.m
863 views
1
function sim = linearKernel(x1, x2)
2
%LINEARKERNEL returns a linear kernel between x1 and x2
3
% sim = linearKernel(x1, x2) returns a linear kernel between x1 and x2
4
% and returns the value in sim
5
6
% Ensure that x1 and x2 are column vectors
7
x1 = x1(:); x2 = x2(:);
8
9
% Compute the kernel
10
sim = x1' * x2; % dot product
11
12
end
13