[SciPy-user] Fitting with global parameters optimize.leastsq
elcorto at gmx.net
Wed Nov 8 11:25:31 CST 2006
Iain Day wrote:
> what is the difference between (length,) and (length,1)?
# numpy 1D array
In : numpy.random.randn(5)
Out: array([-1.56082001, 0.60259947, -1.54174779, -1.0866519 ,
# Matlab-style 1D-arrays
# column vector (Nx1)
In : numpy.random.randn(5,1)
[ 1.0227412 ],
# row vector (1xN)
In : numpy.random.randn(1,5)
Out: array([[-0.82907498, 0.00139096, -0.34764322, -0.4300095 ,
>> 2) You're trying to fit all data sets (t == data_points, y ==
>> raw_signals[:, i]) at once and I guess that won't work. You have to loop
>> over A (or C or raw_signals[:, i]) building one data set and one initial
>> guess (x0 = numpy.array([A[i], B, C[i]])) per loop.
> That sounds similar to fitting each trace separately, and wouldn't give
> you the global B?
Well, yes. Taking a closer look at the cookbook example I see that this
is indeed the right thing to do :)
Although, I'm curious as to how this works if you don't fit 2 data sets
but, say 100 with respect to local mimima in a such a high-dimensional
Random number generation is the art of producing pure gibberish as
quickly as possible.
More information about the SciPy-user