Logistic Regression

fminunc:自动学习率调整函数,具体见help

function [f,g] = myfun(x)
f=(x(1)-5).^2+(x(2)-5).^2;
g=zeros(2,1);
g(1)=2*(x(1)-5);
g(2)=2*(x(2)-5);



clc;clear all;close all;
options = optimset('GradObj','on','MaxIter',100); % indicate gradient is provided 
[a,b,c] = fminunc(@myfun,[0;0],options)
View Code

 

posted @ 2017-03-10 15:41  PirateLHX  阅读(44)  评论(0)    收藏  举报