commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilles Sadowski <gil...@harfang.homelinux.org>
Subject Re: [math] PolynomialFitter.fit() stalls
Date Thu, 31 May 2012 17:44:56 GMT
On Thu, May 31, 2012 at 07:00:58PM +0200, Thomas Neidhart wrote:
> On 05/31/2012 06:12 PM, Gilles Sadowski wrote:
> > Hi.
> > 
> >> Hi, in certain cases I ran into the problem that the PolynomialFitter.fit()
> >> method stalls, meaning that it does not return, nor throw an Exception. Is
> >> there a way to tell the PolynomialFitter to iterate only N-times to ensure
> >> that my program does not stall?
> > 
> > My guess is that it will throw an exception if you wait long enough. ;-)
> 
> In fact it will run forever ;-)

No it shouldn't. If the convergence criterion is never met it will throw an
exception after exhausting all the evaluations (which in the
"PolynomialFitter" is set to Integer.MAX_VALUE). Will be long but not
forever. :-)

> 
> With the default settings there is no criteria to stop the optimization
> process (but you can provide your own ConvergenceChecker which takes
> also iterations into account).

There is a default criterion: it is defined by a default instance of
"SimpleVectorValueChecker".

> 
> After further digging into this, I have seen that the two optimizers
> (GaussNewton, LevenbergMarquardt) use different convergence criteria,
> with the Gauss one being stricter.
> 
> So when providing your test case with the same default settings as for
> the LM than it works also for the GN case:
> 
> PolynomialFitter RshuntFitter =
>    new PolynomialFitter(1, new GaussNewtonOptimizer(
>      new SimplePointChecker(10e-10, Precision.SAFE_MIN)));

Here the checker use the "point" while the default one uses the "value".
It doesn't give an explanation as to why one works and the other not.
One can just deduce that, if there is no bug in optimizer, the convergence
criterion is too stringent for the problem at hand.

> [...]

Best,
Gilles

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message