You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You're definitely right. Doing a vanilla pull of numeric and running the unit tests (under tools/build.sh) fails miserably in uncmin.
In particular, it seems that the inverse Hessian is incorrectly calculated for your constant f(x). Trying it out with my code on node.js (v8) as the engine I get:
In the two simple examples you gave I think you're supposed to reference x[0] instead of x inside those functions -- the function to minimized is passed an array, not a value. Maybe it is converting it by lucky chance to a number in that case.
It still fails to correctly compute the inverse hessian (or check that it is completely ill-conditioned for invertibility). I fear this may be a result of the way the hessian is computed, but I'm unsure as it seems to be stuck on the line-search step for enough iterations that it exits there. In particular,
//[...] Some previous code defining thingsif(typeofmaxit==="undefined")maxit=1000;//[...] code that begins the newton-raphson method on the derivative//Begin the line searchwhile(it<maxit){if(t*nstep<tol){break;}s=mul(step,t);x1=add(x0,s);f1=f(x1);if(f1-f0>=0.1*t*df0||isNaN(f1)){t*=0.5;++it;continue;}break;}
This code begins in line 2782 of numeric.js from the repository.
Activity
angeris commentedon Nov 15, 2015
You're definitely right. Doing a vanilla pull of numeric and running the unit tests (under
tools/build.sh) fails miserably inuncmin.In particular, it seems that the inverse Hessian is incorrectly calculated for your constant
f(x). Trying it out with my code on node.js (v8) as the engine I get:which gets the right result. Trying it out on a simple linear function, screws up hilariously:
Note in particular that the hessian is zero, thus the inverse of the hessian is not defined. There should be an explicit check for this.
In terms of the unit test, it fails when you do test 179:
on the current head. I'm unsure as to why this is, but I feel it has to do with the computation of the current Hessian inverse.
Meekohi commentedon Nov 15, 2015
In the two simple examples you gave I think you're supposed to reference
x[0]instead ofxinside those functions -- the function to minimized is passed an array, not a value. Maybe it is converting it by lucky chance to a number in that case.angeris commentedon Nov 15, 2015
You're right, my mistake. It evaluates to the same result on both cases, though, as
It still fails to correctly compute the inverse hessian (or check that it is completely ill-conditioned for invertibility). I fear this may be a result of the way the hessian is computed, but I'm unsure as it seems to be stuck on the line-search step for enough iterations that it exits there. In particular,
This code begins in line 2782 of
numeric.jsfrom the repository.carstenschwede commentedon Mar 29, 2017
What is the current state of this issue?
angeris commentedon Mar 29, 2017