[SciPy-user] bug in optimize.lbfgsb

el corto elcortostrash at gmx.net
Sun Jun 13 14:17:29 CDT 2004


Hi

I'm running scipy 0.3.0_266.4242 on Win32, Python 2.3.4.

I think I found a bug in scipy.optimize.lbfgsb (in fmin_l_bfgs_b()). I hope
this is the right place to post this.

With the call

  fit = fmin_l_bfgs_b(n,initial_guess,args=(t,y),...)

I get this error

============================================================================
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
  File "findMin.py", line 66, in findMin
    fit = fmin_l_bfgs_b(n,initial_guess,args=(t,y),approx_grad=True,
    bounds=rewriteLimits(limits),m=20,maxfun=15000)
  File "C:\Programme\Python23\lib\site-packages\scipy\optimize\lbfgsb.py",
line 179, in fmin_l_bfgs_b
    f[0], g = func_and_grad(x, *args)
TypeError: func_and_grad() takes exactly 1 argument (3 given)
============================================================================

In lbfgsb.py 'func_and_grad()' is defined as follows.

    if approx_grad:
        def func_and_grad(x):
            f = func(x, *args)
            g = approx_fprime(x, func, epsilon, *args)
            return f, g
    elif fprime is None:
        def func_and_grad(x):
            f, g = func(x, *args)
            return f, g
    else:
        def func_and_grad(x):
            f = func(x, *args)
            g = fprime(x, *args)
            return f, g

'func_and_grad()' is defined to take exactly one argument but the definition
should read

  ...
        def func_and_grad(x, *args):
  ...

I changed it and it works :)

bye.



-- 
"People will accept your ideas much more
readily if you tell them that Benjamin
Franklin said it first."

"Sie haben neue Mails!" - Die GMX Toolbar informiert Sie beim Surfen!
Jetzt aktivieren unter http://www.gmx.net/info



More information about the SciPy-user mailing list