Ng机器学习编程作业matlab实现LR时里有这样一段
%% ============= Part 3: Optimizing using fminunc =============
% In this exercise, you will use a built-in function (fminunc) to find the
% optimal parameters theta.
% 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);
不是很能理解optimset和fminunc的用法
[theta, cost] = ...
我是matlab初学者,这里需要用这个函数来实现梯度下降算法,也就是迭代多次学习theta。请问在fminunc里是怎样实现迭代的呢?那个@t是什么意思?optimset里的‘GradObj’是什么意思?
跪等大神解救!
fminunc中的@(t)(costFunction(t, X, y))是为了把函数costFunction转换为只接受一个参数t的函数。