octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #57113] fminunc return wrong Hessian matrix


From: Rik
Subject: [Octave-bug-tracker] [bug #57113] fminunc return wrong Hessian matrix
Date: Tue, 29 Oct 2019 17:28:45 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko

Follow-up Comment #8, bug #57113 (project octave):

I think there are some improvements to be made in Octave.  In Matlab, running


[x, fval, info, output, grad, hess] = fminunc (@(x) sum (x.^2), ones (2,1))


shows that "info = 1" which means the algorithm finished successfully, and the
number of iterations recorded in output is equal to 1.  For this case,


hess = [NaN NaN
        NaN NaN]


If I change the initial starting point x0, 


[x, fval, info, output, grad, hess] = fminunc (@(x) sum (x.^2), 10*ones
(2,1))


the info field is still 1 which indicates a successful completion, and the
number of iterations is now 2.  In this case, the calculated Hessian is


hess = [2.0000 0.0000
        0.0000 2.0000]


This seems like "good behavior" on the part of Matlab.  When it cannot
calculate the Hessian properly, it returns a matrix of NaN to indicate that
the value should not be trusted.  When it is possible to calculate the Hessian
(> 1 iteration) then it calculates something close to the correct value.

When you run the original example in Octave, you find that the return code
info = 2.  This is not the same thing as the algorithm having converged
successfully at a solution.  According to the documentation for fminunc, this
return code means "Last relative step size was less than 'TolX'".  Similarly,
if I start with an initial position that is even farther away


[x, fval, info, output, grad, hess] = fminunc (@(x) sum (x.^2), 30*ones
(2,1))


I end up with an info return code of -3 which means "The trust region radius
became excessively small".

It may be a false trail, but investigating why Octave is arriving at a
different return code could be useful.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?57113>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]