[SciPy-user] Cannot get optimize.fmin_bfgs to work

Bastian Weber bastian.weber@gmx-topmail...
Tue Mar 3 04:05:08 CST 2009

Hi Ross,

as I am a scipy beginner I doubt that I can help but nevertheless I will

> ValueError: setting an array element with a sequence.

I recently had a similar error in my own script, when a function
returned an array where it should have returned a scalar value only.
The return value was broadcasted to an array by a multplication - normal
behaviour which I simply did not consider at the beginning.

I found the reason by examining the traceback. Thereby I found it really
useful to see the call arguments for each function and to invoke the
debugger right where the exception happened.

(To achieve this, I use something like

import IPython.ultraTB
import sys
sys.excepthook = IPython.ultraTB.FormattedTB(mode='Verbose',
                       color_scheme='Linux', call_pdb=1)

in almost every script I write)

If you dont get it workin: Do you have considered to reformulate your
optimization problem to one with unbounded parameters by introducing
something like a penalty term in errfunc or by mapping parameters into a
finite interval (via arctan for example)?

As I said: maybe I am completely off the track.


More information about the SciPy-user mailing list