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...

Here are some pieces of my codes :

# ------------------------------- main program
# Nopt : the number of parameters to sample the data ( Nopt=35)
# path : directory where are the data
# bgmodel : object that contain all the informations about the model
# input : object that contain all the informatinos about the data.

# The model can vary by 0.05 with the data

x0=array(Nopt*[0.0])
[x,cov_x,infodict,mesg,ier]=optimize.leastsq(inv_scipy_LR_fct,x0,args=path,bgmodel,input),full_output=1,maxfev=80,epsfcn=0.05**2)

# ------------------------------- inv_scipy_LR_fct.py
# the model are wave velocities and the data are phase velocities
# the function will vary the reference model a little bit, compute the
corresponding phase velocities and then compare them with the data
(phase velocities)
# it outputs the difference between the model and the data and also
some other weights parameters (len = 175)

Sorry, it is the first time I am asking for help on the web so I don't
know which pieces of code are usefull or not...

Thanks very much...
Joanne

-- 
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.

Reply via email to