[math] ConvergenceChecker

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[math] ConvergenceChecker

ole ersoy
Hi,

The LeastSquaresProblem supports dropping in a custom ConvergenceChecker<Evaluation> checker.  Does anyone do this? Can you help me better understand the value of it?

TIA,
Ole


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [math] ConvergenceChecker

Evan Ward
Yes, I use it. In some cases it is useful to watch the RMS residuals, in
other cases to watch the change in the states. I think it is there from
an acknowledgement that we can't enumerate all possible convergence
criteria, so we provide a way for the user to define their own.

Regards,
Evan

On 02/05/2016 05:33 PM, Ole Ersoy wrote:

> Hi,
>
> The LeastSquaresProblem supports dropping in a custom
> ConvergenceChecker<Evaluation> checker.  Does anyone do this? Can you
> help me better understand the value of it?
>
> TIA,
> Ole
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [math] ConvergenceChecker

ole ersoy


On 02/05/2016 04:42 PM, Evan Ward wrote:
> Yes, I use it. In some cases it is useful to watch the RMS residuals
So if it were modularized and supported logging then this might satisfy the same requirement?
> , in
> other cases to watch the change in the states. I think it is there from
> an acknowledgement that we can't enumerate all possible convergence
> criteria,
Has there ever been a case where the 'standard' convergence approach has been insufficient?

Also could you please look at this:

     public static LeastSquaresProblem countEvaluations(final LeastSquaresProblem problem,
                                                        final Incrementor counter) {
         return new LeastSquaresAdapter(problem) {

             /** {@inheritDoc} */
             @Override
             public Evaluation evaluate(final RealVector point) {
                 counter.incrementCount();
                 return super.evaluate(point);
             }

             // Delegate the rest.
         };
     }

Should this exist?

Thanks,
Ole


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [math] ConvergenceChecker

Evan Ward
Hi Ole,

On 02/05/2016 06:40 PM, Ole Ersoy wrote:
>
>
> On 02/05/2016 04:42 PM, Evan Ward wrote:
>> Yes, I use it. In some cases it is useful to watch the RMS residuals
> So if it were modularized and supported logging then this might
> satisfy the same requirement?

I'm not sure if I understand what you mean by logging, but I'm not
trying to put the values in a file, I'm making application flow
decisions based the values.

>> , in
>> other cases to watch the change in the states. I think it is there from
>> an acknowledgement that we can't enumerate all possible convergence
>> criteria,
> Has there ever been a case where the 'standard' convergence approach
> has been insufficient?

I think this depends on what is included in the standard convergence
checker. I think 90% of uses could be handled by watching the change in
cost or state. I like the option of specifying my own condition, so I
can control exactly when the algorithm stops.

>
> Also could you please look at this:
>
>     public static LeastSquaresProblem countEvaluations(final
> LeastSquaresProblem problem,
>                                                        final
> Incrementor counter) {
>         return new LeastSquaresAdapter(problem) {
>
>             /** {@inheritDoc} */
>             @Override
>             public Evaluation evaluate(final RealVector point) {
>                 counter.incrementCount();
>                 return super.evaluate(point);
>             }
>
>             // Delegate the rest.
>         };
>     }
>
> Should this exist?
Looks useful for counting evaluations, but I think all of the LS
optimizers already do this. Anyone have a use case for countEvaluations?

>
> Thanks,
> Ole
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>



smime.p7s (6K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [math] ConvergenceChecker

ole ersoy
Hi Evan,

On 02/08/2016 08:10 AM, Evan Ward wrote:
> Hi Ole,
>
> On 02/05/2016 06:40 PM, Ole Ersoy wrote:
>>
>> On 02/05/2016 04:42 PM, Evan Ward wrote:
>>> Yes, I use it. In some cases it is useful to watch the RMS residuals
>> So if it were modularized and supported logging then this might
>> satisfy the same requirement?
> I'm not sure if I understand what you mean by logging,
One of the reasons I'm refactoring and modularizing (Making it a standalone jar) the LM optimizer is that I'd like to be able to watch certain steps in action, in the event that issues crop up.  So since you mentioned that you were 'watching' the residuals I assumed it had a similar purpose that aligned well with logging.

[...]  Has there ever been a case where the 'standard' convergence approach
has been insufficient?

> I think this depends on what is included in the standard convergence
> checker. I think 90% of uses could be handled by watching the change in
> cost or state. I like the option of specifying my own condition, so I
> can control exactly when the algorithm stops.
If it's useful to you then I'm sure it's useful to other as well. Just want to make sure that you definitely need more flexibility than what comes with relaxing or tightening the relative and absolute tolerance parameters.  I'm also curious whether the cases that you do need flexibility for could be parameterized in such a way that it makes it simpler to write up to user documentation?

>> Also could you please look at this:
>>
>>      public static LeastSquaresProblem countEvaluations(final
>> LeastSquaresProblem problem,
>>                                                         final
>> Incrementor counter) {
>>          return new LeastSquaresAdapter(problem) {
>>
>>              /** {@inheritDoc} */
>>              @Override
>>              public Evaluation evaluate(final RealVector point) {
>>                  counter.incrementCount();
>>                  return super.evaluate(point);
>>              }
>>
>>              // Delegate the rest.
>>          };
>>      }
>>
>> Should this exist?
> Looks useful for counting evaluations, but I think all of the LS
> optimizers already do this. Anyone have a use case for countEvaluations?
I think you are right.  I think it's code that was accidentally left in...Anyone...?

Cheers,
Ole


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Math] Counters in "LeastSquaresProblem" (Was: [...] ConvergenceChecker)

Gilles Sadowski
Hi.

On Mon, 8 Feb 2016 15:18:37 -0600, Ole Ersoy wrote:

> [...]
>
>>> Also could you please look at this:
>>>
>>>      public static LeastSquaresProblem countEvaluations(final
>>> LeastSquaresProblem problem,
>>>                                                         final
>>> Incrementor counter) {
>>>          return new LeastSquaresAdapter(problem) {
>>>
>>>              /** {@inheritDoc} */
>>>              @Override
>>>              public Evaluation evaluate(final RealVector point) {
>>>                  counter.incrementCount();
>>>                  return super.evaluate(point);
>>>              }
>>>
>>>              // Delegate the rest.
>>>          };
>>>      }
>>>
>>> Should this exist?
>> Looks useful for counting evaluations, but I think all of the LS
>> optimizers already do this. Anyone have a use case for
>> countEvaluations?
> I think you are right.  I think it's code that was accidentally left
> in...Anyone...?

No it was not accidentally left in, it was added on purpose with the
new design.
Now, I seem to recall that it was an example of how information could
be passed from the optimization algorithm to the user, by wrapping the
"basic" context ("LeastSquaresProblem") within an extended one (here an
evaluation counter context).

The "maxEvaluations" and "maxEvaluations" settings are currently passed
at construction of the "LocalLeastSquaresProblem"; maybe it is that
which
was supposed to go in the new design: "LevenbergMarquardtOptimizer"
increments the counters but otherwise does not use them (for loop
control, that is).

Was it something that waited for the refactoring of the rest of the
optimizers?  Indeed, the "LeastSquareProblem interface" extends
"OptimizationProblem" that defines "getEvaluationCounter()",
"getIterationCounter()" and ... "getConvergenceChecker()".

So the wrapper/adapter provides external control of what happens (e.g.
raising an exception) when the counter is exhausted.
IOW, the counter(s) are not part of the standard algorithm, and the
new design is able to make that clear.


Regards,
Gilles

> Cheers,
> Ole


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [Math] Counters in "LeastSquaresProblem" (Was: [...] ConvergenceChecker)

sebb-2-2
On 8 February 2016 at 23:11, Gilles <[hidden email]> wrote:

> Hi.
>
> On Mon, 8 Feb 2016 15:18:37 -0600, Ole Ersoy wrote:
>>
>> [...]
>>
>>>> Also could you please look at this:
>>>>
>>>>      public static LeastSquaresProblem countEvaluations(final
>>>> LeastSquaresProblem problem,
>>>>                                                         final
>>>> Incrementor counter) {
>>>>          return new LeastSquaresAdapter(problem) {
>>>>
>>>>              /** {@inheritDoc} */
>>>>              @Override
>>>>              public Evaluation evaluate(final RealVector point) {
>>>>                  counter.incrementCount();
>>>>                  return super.evaluate(point);
>>>>              }
>>>>
>>>>              // Delegate the rest.
>>>>          };
>>>>      }
>>>>
>>>> Should this exist?
>>>
>>> Looks useful for counting evaluations, but I think all of the LS
>>> optimizers already do this. Anyone have a use case for countEvaluations?
>>
>> I think you are right.  I think it's code that was accidentally left
>> in...Anyone...?
>
>
> No it was not accidentally left in, it was added on purpose with the
> new design.
> Now, I seem to recall that it was an example of how information could
> be passed from the optimization algorithm to the user, by wrapping the
> "basic" context ("LeastSquaresProblem") within an extended one (here an
> evaluation counter context).
>
> The "maxEvaluations" and "maxEvaluations" settings are currently passed
> at construction of the "LocalLeastSquaresProblem"; maybe it is that which
> was supposed to go in the new design: "LevenbergMarquardtOptimizer"
> increments the counters but otherwise does not use them (for loop
> control, that is).
>
> Was it something that waited for the refactoring of the rest of the
> optimizers?  Indeed, the "LeastSquareProblem interface" extends
> "OptimizationProblem" that defines "getEvaluationCounter()",
> "getIterationCounter()" and ... "getConvergenceChecker()".
>
> So the wrapper/adapter provides external control of what happens (e.g.
> raising an exception) when the counter is exhausted.
> IOW, the counter(s) are not part of the standard algorithm, and the
> new design is able to make that clear.

However clearly the purpose of the method(s) is not immediately
obvious from the source code.
Perhaps it was in the commit message or mailing list discussions?
Such external documentation is rarely sufficient, so if would be very
helpful if the code could be updated with the rationale as explained
above.

>
> Regards,
> Gilles
>
>> Cheers,
>> Ole
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]