Fmincg function
It's a OCTAVE function. It can be helped to calculate the gradient decent.
Example:
options = optimset('GradObj','on','MaxIter',number_of_iterations);
theta = fmincg((@t)cost_function_name(t,X,y),initial_theta, options);
on the above example ,the cost function should
return [ J_value , grad ] and its
first parametre should be theta . J_value means the cost and grad means the derivative of the cost function.