commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Neidhart <>
Subject Re: [math] stalls
Date Thu, 31 May 2012 17:00:58 GMT
On 05/31/2012 06:12 PM, Gilles Sadowski wrote:
> Hi.
>> Hi, in certain cases I ran into the problem that the
>> 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 ;-)

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).

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)));

In fact the LM optimizer uses two different convergence criteria (the
provided ConvergenceChecker and additional ones that are provided at
construction time) and uses both in the optimization process.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message