A function handles in Octave is defined as the example below.
f = @sin;
From now on, calling function f(x)
has the same effect as calling sin(x)
. So far so good. My problem starts with the function below from one of my programming assignments.
function sim = gaussianKernel(x1, x2, sigma)
The line above represents the header of the function gaussianKernel
. This takes three variables as input. However, the call below messes up my mind because it only passes two variables and then three while referring to gaussianKernel
.
model = svmTrain(X, y, C, @(x1, x2) gaussianKernel(x1, x2, sigma));
Shouldn't that be simply model = svmTrain(X, y, C, @gaussianKernel(x1, x2, sigma));
? What is the difference?