On 31 May 2011 09:31, JoanneA <[email protected]> wrote: > Hi everyone, > > I have a little problem of optimisation. Does anyone is doing > optimization and can give me some tips ? > > I am using the package scipy to use the function > scipy.optimize.leastsq. In fact, I have translated a matlab code which > uses the function lsqnonlin to do the optimization. I can then use the > same dataset and compare the results from the matlab and python > codes. > > There doesn't seems to have any bug in the python version and I got a > result but the fit to the data is not very good. Also, the model is > very close to the reference model but can vary some more. > > I've tried to run only the function called by optimize.leastsq > (without optimization, to check if the function does what it is meant > to do) with the same input in the python and matlab version. They both > output the same model. So I am confident with my function. > > My problem is that I don't know which (and how) parameters I should > use to the optimization. Maybe the function leastsq is not the correct > one to use anyway...
Your problem might be that Matlab's lsqnonlin is closer to something like numpy.polyfit, i.e. a non linear fit of a polynomial. http://docs.scipy.org/doc/numpy/reference/generated/numpy.polyfit.html http://www.scipy.org/Cookbook/FittingData Michael -- You received this message because you are subscribed to the Google Groups "Python Ireland" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/pythonireland?hl=en.
