[SciPy-user] Optimization Working only with a Specific Expression of the input Parameters
Lorenzo Isella
lorenzo.isella@gmail....
Fri Mar 2 07:25:29 CST 2007
Dear All,
I was trying to fit some data using the leastsq package in
scipy.optimize. The function I would like to use to fit my data is:
log(10.0)*A1/sqrt(2.0*pi)/log(myvar1)*exp(-((log(x/mu1))**2.0)/2.0/log(myvar1)/log(myvar1)))
where A1, mu1 and myvar1 are fitting parameters.
For some reason, I used to get an error message from scipy.optimize
telling me that I was not working with an array of floats.
I suppose that this is due to the fact that the optimizer also tries
solving for negative values of mu1 and myvar1, for which the log
function (x is always positive) does not exist.
In fact, if I use the fitting function:
log(10.0)*A1/sqrt(2.0*pi)/log(myvar1**2.0)*exp(-((log(x/mu1**2.0))**2.0)/2.0/log(myvar1**2.0)/log(myvar1**2.0)))
Where mu1 and myvar1 appear squared, then the problem does not exist
any longer and the results are absolutely ok.
Can anyone enlighten me here and confirm this is what is really going on?
Kind Regards
Lorenzo
More information about the SciPy-user
mailing list