I have the following code in MATLAB:
% Set options for fminunc
options = optimset('GradObj', 'on', 'MaxIter', 400);
% Run fminunc to obtain the optimal theta
% This function will return theta and the cost
[theta, cost] = ...
fminunc(@(t)(costFunction(t, X, y)), initial_theta, options);
My instructor has explained the minimising function like so:
To specify the actual function we are minimizing, we use a "short-hand" for specifying functions, like
@(t)(costFunction(t, X, y)). This creates a function, with argumentt, which calls yourcostFunction. This allows us to wrap thecostFunctionfor use withfminunc.
I really cannot understand what @(t)(costFunction(t, X, y) means. What are the both ts are doing? What kind of expression is that?