Re: Re: global fit
- To: mathgroup at smc.vnet.net
- Subject: [mg57572] Re: Re: global fit
- From: "Pascal" <Pascal.Plaza at ens.fr>
- Date: Wed, 1 Jun 2005 06:02:35 -0400 (EDT)
- References: <200505280938.FAA21631@smc.vnet.net><d7bj84$ojm$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
In fact, let's define a "fitting" matrix depending on two parameters:
imax = 6;
fT[t1_, t2_] = {Table[Exp[-i/t1], {i, 0, imax}], Table[Exp[-i/t2], {i,
0, imax}]};
and create a data matrix (U = B0.fT[t10, t20] + noise) like this :
t10 = 0.5;
t20 = 4;
jmax = 12;
B0 = Table[Random[], {j, 1, jmax}, {k, 1, 2}];
T0 = fT[t10, t20];
noise = 0.03 Table[Random[], {j, 1, jmax}, {i, 0, imax}];
U = B0.T0 + noise;
Knowing U, I want to find t1, t2 and B in order to minimize U -
B.fT[t1,t2], hence to minimize:
h[t1_, t2_] := (
T = fT[t1, t2];
invT = PseudoInverse[T];
B = U.invT;
residue = U - B.T;
Norm[Flatten[residue]]
)
Indeed, FindMinimum[h[x, y],{x,0.6},{y,6}] works fine. It more or less
gives t1=t10 and t2=t20, as expected.
The problem comes when the dimensions are a lot larger, like:
imax = 60;
jmax = 500;
t10 = 5;
t20 = 40;
Then rapidly all the memory available is used even if I only try
FindMinimum along one coordinate at a time.
Maybe at each step does the Kernel create too many new big matrices and
gets overloaded?
Would there be a way to write this in a better way?
Many thanks.