[SciPy-user] optimization question

Robert Kern robert.kern@gmail....
Tue Jul 3 17:35:18 CDT 2007


Volker Lorrmann wrote:
> Hello list,
> 
> i wanna fit a function to some measured datapoints T_m(x_i). The 
> function i wanna fit  is something like that,T_fit(a,b,c,d,x_i), where 
> a,b,c are the fitting-parameters. Fitting this with 
> scipy.optimize.leastsq would be easy (btw. is there anoterh way to fit 
> this, like fmin, fmin_powell, ...?).

All leastsq() really adds to fmin*() is that you return the residuals instead of
summing up the squares of the residuals. You can do that manually and use
whichever minimizer you need.

> The problem is, that a is a and b are _fixed_ scalar parameters. But c 
> and d are variables, that depend on x_i, c=c(x_i) and d=d(x_i). And in 
> fact, c(x_i) and d(x_i) are the variables i´m mainly interested in. (a 
> and b are nearly exactly known, so i can reduce the fitting_function to 
> T(c(x_i),d(x_i),x_i)).

Well, that's a big problem. You have twice as many variables to fit as you have
datapoints. There are possibly an infinite number of solutions that exactly(!)
fit your data.

Is it possible that you can reparameterize your problem? Perhaps c(.) and d(.)
could be formulated as functions that depend on some small number of parameters
besides x_i in order to smooth things out. You would then do least-squares to
optimize those parameters.

You might also be interested in some non-parametric inverse theory techniques,
but that requires a reasonably substantial investment in reading up on the topic
and examining your model.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco


More information about the SciPy-user mailing list