[SciPy-Dev] optimize ncg approx_fhess_p bug?
Tue Apr 6 08:00:24 CDT 2010
On Tue, Apr 6, 2010 at 1:15 AM, <firstname.lastname@example.org> wrote:
> is this a bug?
> why is there a `*p` in the approx_fhess
> def approx_fhess_p(x0,p,fprime,epsilon,*args):
> f2 = fprime(*((x0+epsilon*p,)+args))
> f1 = fprime(*((x0,)+args))
> return (f2 - f1)/epsilon
> from a quick search this function is only used in fmin_ncg, which has
> convergence problem if epsilon is small.
> convergence to solution looks ok when I set epsilon to 1e-4 or 1e-6.
> but with predefined epsilon the step in the approx hessian calculation
> looks to small:
> array([ 0.00000000e+00, -7.71175966e-16, -6.94483304e-15])
> non-convergence was a test failure reported by Alan with scipy 0.7.2
> I'm not sure about this because I never looked at the optimize code
> before, and I only did some quick checking.
> dropping the p in the approx fhess, I get a very fast solution
> (full_output) of the test problem in optimize/tests/optimize.py
> (array([ 1.46693016e-07, -5.24869440e-01, 4.87527692e-01]), 1.55913216727411
> 23, 5, 18, 0, 0)
I think we can ignore this, I made some mistakes with my changes (too
late at night).
The p is necessary to produce correct results, and I cannot reproduce
the convergence failure on my computer today.
> Any ideas?
More information about the SciPy-Dev