Moving course1 to course1 subdir.
This commit is contained in:
12
machine_learning/course1/mlclass-ex6-008/mlclass-ex6/linearKernel.m
Executable file
12
machine_learning/course1/mlclass-ex6-008/mlclass-ex6/linearKernel.m
Executable file
@@ -0,0 +1,12 @@
|
||||
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
|
||||
Reference in New Issue
Block a user