[ADMB Users] how to calculate the hessian matrix by autodif library

dave fournier davef at otter-rsch.com
Mon Oct 11 00:44:28 PDT 2010


wenjian wrote:

The "Hessian" in the function minimizer is not the true hessian. It is 
an approximation
built up during the minimization procedure. It works for minimization, 
but it sucks
as an approximation to the true Hessian. I know they use this for some 
proceudres in
R but it is a stupid idea. AD model builder uses a 4 point finite 
difference approximation to the Hessian for its calculations. You can 
get the fmm Hessian
by modifying the header fvar.hpp to define that function, but it almost 
certainly will not do what you want. You can see how the Hessian is 
calculated by looking at the source file mod_hess.cpp.









> hi fournier,
> this is my code :
> int main()
> {
> int nvar=60;
> independent_variables x(1,nvar);
> x.initialize();
> double f;
> dvector g(1,nvar);
> dmatrix dHessian(1,nvar,1,nvar);
> fmm fmc(nvar); // creates the function minimizing control structure
> fmc.crit=0.000001;
> /////////////////////////////////////////////////////
> gradient_structure gs;
> while(fmc.ireturn>=0)//
> {//
> fmc.fmin(f,x,g);
> if(fmc.ireturn>0)
> {
> f=func2(x);
> gradcalc(nvar,g);
> }
> }
> //dHessian=fmc.hessian();
> cout << "The minimum value = " << "at x =\n"
> << x <<"\n"<<"G"<<g<<f<< "\n";
> return 0;
> }
> I delete dHessian=fmc.hessian(), the program run ok,but when i add 
> dHessian=fmc.hessian(), the following error happened : error LNK2001: 
> unresolved external symbol "public: class dmatrix & __thiscall 
> fmm::hessian(void)" (?hessian at fmm@@QAEAAVdmatrix@@XZ 
> <mailto:?hessian at fmm@@QAEAAVdmatrix@@XZ>).
> thank you for your help.
> sgwj
>
> At 2010-10-11 12:28:44£¬"dave fournier" <davef at otter-rsch.com> wrote:
>
> >This sounds totally destined to fail. I think you should tell us what 
> >you want
> >to accomplish.
> >_______________________________________________
> >Users mailing list
> >Users at admb-project.org
> >http://lists.admb-project.org/mailman/listinfo/users
>   
>
>
> È«¹ú×îµÍ¼Û£¬ÌìÌìÔÚ¼Ò³åÕÕƬ£¬24 Сʱ·¢»õÉÏÃÅ£¡ 
> <http://yxp.163.com/photo/ep.html?sss=fromyx0911> 




More information about the Users mailing list