pythonnumpyscipymathematical-optimizationhessian-matrix

Retrieve approximate Hessian inverse from L-BFGS-B


With the L-BFGS-B minimizer in scipy, is it possible to retrieve the approximate inverse Hessian that's calculated internally?

Having it in the implicit factored form, so that it's possible to compute arbitrary inverse Hessian matrix - vector products, would be fine.


Solution

  • There's now a way to do this in SciPy.

    Example:

    from scipy.optimize import minimize, rosen
    result = minimize(rosen, x0=[0] * 10, method='L-BFGS-B')
    print(result.hess_inv.todense())
    

    Seems to have been added in SciPy 0.16.0. See the PR for this feature.