help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bfgsmin


From: Michael Creel
Subject: Re: bfgsmin
Date: Tue, 17 Mar 2009 02:43:06 -0700 (PDT)



Bertrand Roessli wrote:
> 
> Hello,
> 
> 
> I compiled everything (mkoctifle) from the SVN repository but it is not
> better. The bfgsmin_example.m works perfectly, but my function not.
> 
> The funny thing is that bfgsmin makes a few cycles, chi2 is not modified
> as the parameters are not varied and then crashes as soon as there is a
> change in the parameters.
> 
> 
> octave:1> leasqrexamp
> chisq =  1.8953
> p =
> 
>    11
>     1
> 
> chisq =  1.8953
> p =
> 
>    11
>     1
> 
> chisq =  1.8953
> p =
> 
>    11.0000
>     1.0000
> 
> chisq =  1.8953
> p =
> 
>    11.0000
>     1.0000
> 
> chisq =  1.8953
> p =
> 
>    11.0000
>     1.0000
> 
> chisq =  1.8953
> p =
> 
>    11.00000
>     0.99999
> 
> error: __bfgsmin_gradient: gradient contains NaNs or Inf
> error: feval: function `chi2' not found
> error: octave_base_value::double_value (): wrong type argument `<unknown
> type>'
> warning: __bfgsmin_obj: objective function could not be evaluated -
> setting to DBL_MAX
> error: feval: function `chi2' not found
> 
> Thanks,
> 
> Bertrand
> 
> On Mon, 2009-03-16 at 10:02 -0700, Michael Creel wrote:
>> 
>> 
>> Bertrand Roessli wrote:
>> > 
>> > Sorry I do not get it,
>> > 
>> > "Just download that file to your working directory," 
>> > 
>> > which file? 
>> > 
>> > If you mean from optim-1.04, it is what I did before.
>> > 
>> > Bertrand
>> > 
>> > On Mon, 2009-03-16 at 07:00 -0700, Michael Creel wrote:
>> >> 
>> >> Bertrand Roessli wrote:
>> >> > 
>> >> > Hello,
>> >> > 
>> >> > Thanks for trying the code. 
>> >> > 
>> >> > I have the latest package from octave sourceforge (optim 1.04) and
>> >> > octave 3.1.54.
>> >> > 
>> >> > 
>> >> 
>> >> It seems that the optim package was last released in August of 2008,
>> >> while
>> >> the last change to __bfgsmin.cc was in October 2008. I just ran your
>> code
>> >> 10
>> >> times without problems, so I think that the problem is a bug in the
>> old
>> >> version of __bfgsmin.cc. Just download that file to your working
>> >> directory,
>> >> run mkoctfile __bfgsmin.cc, and I think you'll be set.
>> >> Michael
>> >> 
>> >> p.s., I have not tested it with Octave 3.1.x, 
>> >> 
>> > 
>> > _______________________________________________
>> > Help-octave mailing list
>> > address@hidden
>> > https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>> > 
>> > 
>> 
>> You can browse the SVN repository to get individual files. __bfgsmin.cc
>> is
>> here:
>> http://octave.svn.sourceforge.net/viewvc/octave/trunk/octave-forge/main/optim/src/__bfgsmin.cc?view=log
>> 
>> Just click on that, then download the latest version. You can browse
>> around
>> the SNV repo to see the stucture, if you're curious. Because __bfgsmin.cc
>> is
>> written in C++, it needs to be compiled before it can be used by Octave.
>> That's why you need the mkoctfile step I mentioned before.
>> Cheers, Michael
>> 
> 
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
> 
> 

I have run the code again several times, and it alway works for me  running
Octave 3.0.3 on 64 bit Kubuntu 8.10. However, I just tried it on PelicanHPC
64 bit version (essentially, Debian Lenny, with Octave 3.0.1) and it
crashes, even though __bfgsmin is identical on both machines. Sooo,
something is going on here.  

The gradient at the initial parameter values has elements that differ by 3
orders of magnitude. That is never a good thing for a gradient-based
minimizer. Nevertheless, it should not cause a crash, just a failure to
converge at worst. I'll look into it. I'm not much of a C++ programmer,
though, so if any experts would like to look at __bfgsmin.cc, help is
welcome.

Michael



-- 
View this message in context: 
http://www.nabble.com/Nonlinear-fitting-with-lg%28a%2Bx%29-tp22492005p22555518.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]