MathGroup Archive 2013

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: constrained FindFit is extremely slow?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg131758] Re: constrained FindFit is extremely slow?
  • From: Joe Gwinn <joegwinn at comcast.net>
  • Date: Sat, 28 Sep 2013 21:25:08 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-outx@smc.vnet.net
  • Delivered-to: mathgroup-newsendx@smc.vnet.net
  • References: <l143o7$pqn$1@smc.vnet.net>

In article <l143o7$pqn$1 at smc.vnet.net>, dantimatter
<google at dantimatter.com> wrote:

> hi all
> i'm trying to use FindFit to find parameters in a differential equation
> model, and give it a bit of help by adding constraints.  But i'm finding that
> as soon as i add a single constraint, Mathematica grinds to a halt.  is this
> something specifically to do with the differential equation model?

Yes, it changes algorithm.  I use EvaluationMonitor to follow the moves
the solver is making.  This is from the online documentation of
FindFit:

Block[{count=0},{FindFit[data,60+70 Exp[-a
x],a,x,EvaluationMonitor:>count++],count}]

If you see it bouncing along a line, the solver is doing
linear-programming tricks, walking along the intersection of two
constraint hyperplanes.

Figuring this all out can be pretty fiddly.  Good Luck

Joe Gwinn


> code is:
> 
>
> model[a_?NumberQ,b_?NumberQ,c_?NumberQ,d_?NumberQ,f_?NumberQ,Km1_?NumberQ,Km2_?
> NumberQ,Km3_?NumberQ,NTP0_?NumberQ]:=(model[a,b,c,d, f,
> Km1,Km2,Km3,NTP0]=First[MG/.NDSolve[{
> MG'[t]==a*DNA*NTP[t]/(Sqrt[Km1^2]+NTP[t])-b MG[t],
> NTP'[t]==-f*a*DNA*NTP[t]/(Sqrt[Km1^2]+NTP[t])-d MG[t]
> NTP[t]/(Sqrt[Km2^2]+NTP[t])-c NTP[t]/(Sqrt[Km3^2]+NTP[t]),
> NTP[0]==NTP0,MG[0]==0},{MG,NTP},{t,0,800},Method->StiffnessSwitching]]);
> 
> fit = FindFit[data,
>   model[a, b, c, d, f, Km1, Km2, Km3, NTP0][
>    t], {{a, 10}, {b, 0.0737}, {c, 7}, {d, .99}, {f, 18}, {Km1,
>     12893.842}, {Km2, 8663.477}, {Km3, 1946}, {NTP0, 1500000}}, t]
> 
> thanks!
>



  • Prev by Date: Re: a queue
  • Next by Date: Problem with Integrate
  • Previous by thread: constrained FindFit is extremely slow?
  • Next by thread: very odd failure of Solve