[SciPy-User] leastsq not converging to optimal solution, fmin won't accept parameters
Charles R Harris
Sat Sep 25 18:30:53 CDT 2010
On Wed, Sep 8, 2010 at 3:54 PM, Joses Ho <firstname.lastname@example.org> wrote:
> I am trying to fit to my qPCR data an exponential function where each
> successive y-value depends on the previous v-value in the following fashion:
> y[n] = y[n-1] + k ln (1 + (y[n-1]/k) + b
> where y[n] = current y-value being evaluated
> and y[n-1] = previous y-value
> I therefore have three values to fit - y0 (starting value of y), k, and b.
> I define a residuals function where I compute 20 values of y, given an
> initial estimate of y0, k and b, and then subtract these from my 20 measured
> values of y.
> I have tried to use scipy.optimize.leastsq on the above residuals function,
> but it doesn't seem to be converging on the correct values of y0,k and b.
> I have tried scipy.optimize.fmin on the same function, but I get the
> following error:
> ...fsim = func(x0)
> ...ValueError: setting an array element with a sequence.
> which seems to me that it refuses to accept the x0 array I give to it,
> consisting of [y0,k,b].
> Basically, I am trying to implement the recent method of Boggy and Woolf
> (PLoS 2010) [doi:10.1371/ journal.pone.0012355] in Python.
> I am using SciPy 0.8.0b1 and NumPy 1.4.0 on Python 2.6.5 of the Enthought
> Python Distribution 6.2-2.
> Any help here would be very much appreciated!
Can you supply 20 data values so that we can play with the problem? Is it
real data or synthesized test data?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SciPy-User