Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #1325

Re: specifying further options to NMinimize method when using NonlinearModelFit

From Darren Glosemeyer <darreng@wolfram.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: specifying further options to NMinimize method when using NonlinearModelFit
Date 2011-03-31 09:01 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <in1ftf$4hs$1@smc.vnet.net> (permalink)

Show all headers | View raw


On 3/30/2011 4:15 AM, Peter Pein wrote:
> Am 29.03.2011 13:56, schrieb Alex Gittens:
>> I'm using NonlinearModelFit to fit a model with UnitStep statements in it, so my only option seems to be to use the NMinimize method (judging from the errors I get, all the other options seem to need symbolic gradient information).
>>
>> The results are poor, so I'd like to specify that NonlinearModelFit use NMinimize with the Differential Evolution method. How do I go about doing that?
>>
> Hi Alex,
>
> are you sure that NlMFit uses NMinimize? I constructed a hard-to-fit
> example and tried to set different methods for NMinimize; to no avail:
>
> In[1]:= data=Table[{x,Exp[-x]+.1Sin[Pi x]},{x,0,1,1/50}]//N;
> In[2]:= model=a+b/(x+c);
> In[3]:=
> Table[SetOptions[NMinimize,Method->met];NonlinearModelFit[data,model,{a,b,c},x]//Normal,{met,{Automatic,
> "DifferentialEvolution", "NelderMead", "RandomSearch",
> "SimulatedAnnealing"}}]
>
> ... some warnings (each the same) ...
>
> Out[3]= {
>     -7.50222+108.153/(12.7003 +x),
>     -7.50222+108.153/(12.7003 +x),
>     -7.50222+108.153/(12.7003 +x),
>     -7.50222+108.153/(12.7003 +x),
>     -7.50222+108.153/(12.7003 +x)}
>
>
> I see no difference, do you?
>
> Hmm... an Option Method is not documented for NlMFit under "Options".
> But who will give up as soon? Using Method->"foo" will give the possible
> valuses for NlMNFit:
>
> using
>
> In[6]:= Table[
>    NonlinearModelFit[data, model, {a, b, c}, x, Method ->  met] //
>     Normal, {met, {Automatic, "Gradient", "ConjugateGradient",
>      "InteriorPoint", "QuasiNewton", "Newton", "NMinimize",
>      "LevenbergMarquardt"}}]
>
> ...some warnings ...
>
> Out[6]= {
>     -7.50222 + 108.153/(12.7003 + x),
>     -3.58119 + 29.3825/( 6.38402 + x),
>     -1.13263 + 5.36751/(2.46604 + x),
>      2.02043 - 172.578/(129.759 + x),
>     -3.16362 + 24.1187/(5.76332 + x),
>     -5.39831 + 59.8129/(9.32438 + x),
>     -15.3664 + 414.781/(25.3272 + x),
>      -7.50222 + 108.153/(12.7003 + x)}
>
> gives us a broader range to choose of :-)
>
> Whatever fits your needs best...
>
> Peter
>

The version 8 docs for NonlinearModelFit now state:

"Possible settings for Method include "ConjugateGradient", "Gradient", 
"LevenbergMarquardt", "Newton", "NMinimize", and "QuasiNewton", with the 
default being Automatic."


That note was absent in version 7, though, so perhaps you were looking 
in the version 7 docs.

It does not use NMinimize by default, but use of NMinimize can be set 
optionally. Options to NMinimize can be passed in as suboptions to the 
Method option, e.g.

NonlinearModelFit[data, model, {a, b, c}, x,  Method -> {"NMinimize", 
Method -> "DifferentialEvolution"}]

I seem to recall that there were some issues with processing when Method 
was set to "NMinimize" in version 7, but those should all be 
straightened out in version 8.

Darren Glosemeyer
Wolfram Research

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: specifying further options to NMinimize method when using NonlinearModelFit Darren Glosemeyer <darreng@wolfram.com> - 2011-03-31 09:01 +0000

csiph-web