commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Dunning <ted.dunn...@gmail.com>
Subject Re: [math] Problem using the LevenbergMarquardtOptimizer
Date Sun, 03 Feb 2013 19:41:26 GMT
The key distinction here is that there are two situations.

- the first is where suggestions are ignored.  For instance, a clustering
algorithm that ignored initial cluster locations or an optimizer that
ignores an initial data point.  These behaviors should be documented, but
ignoring these suggestions does not compromise the correctness of the
result so execution should proceed.

- the second is where constraints are ignored.  For instance, with a
constrained optimization problem, ignoring the constraints produces an
incorrect answer.  These behaviors should cause exceptions since correct
behavior is not possible.

As Luca points out, different responses are necessary to retain correct
behavior.

On Sun, Feb 3, 2013 at 3:22 AM, <luca.marchetti@univr.it> wrote:

> Dear Gilles,
> thank you for the very complete answer. This finally solves the question I
> raised!
> As a developer, I understand why you chose to maintain a simple API.
> Despite this, I agree with you that, at the moment, the situation is quite
> confusing. As you suggested, a simple solution can be to update the javadoc
> page of each optimizer with few lines that warns developers on which
> options are really functional and which ones will be functional in
> future... This little update will be a big help for all those developers
> that are not familiar with the Java library.
> In addition to this, I suggest also to update the code for throwing an
> exception when the optimizer is run with options that it cannot handle. I
> understand that this may led to other problems... but I think that,
> especially when we need to solve very hard mathematical problems, it is
> dangerous to not catch this situation. At the end, an optimizer that is run
> with a bound option and that does not care about this, returns a solution
> that may be very distant from the desired one...
>
>
> Have a nice day,
>
>
> Luca
>
>
> ----- Messaggio originale -----
> Da: Gilles <gilles@harfang.homelinux.org>
> Data: Saturday, February 2, 2013 12:24
> Oggetto: Re: [math] Problem using the LevenbergMarquardtOptimizer
> A: luca.marchetti@univr.it
> Cc: user@commons.apache.org, dev@commons.apache.org
>
> > Hello.
> >
> > > Dear all,
> > > I'm using the commons math library for solving least-squares
> > problems> using the LevenbergMarquardtOptimizer.
> > > I have a problem when I specify bounds for the estimation (by means
> > > of a SimpleBounds object). I don't understand why, but the estimate
> > > seems to not care about the bounds.
> > > I attach to the mail a simple code which gives the problem.
> > This code
> > > is inspired to the one published on the web-site for
> > explaining how
> > > the LevenbergMarquardtOptimizer works...
> > > The code at the end perform two estimates:
> > > 1) the first one without bounds is correct;
> > > 2) the second one, instead, should take care of the bounds,
> > but I
> > > obtain the same values as in the first case... :-(
> >
> > Actually, the "LevenbergMarquardtOptimizer" does not support bounds,
> > even though the API accepts that you pass them.
> > In fact, all "options" can be passed to all optimizers but not all
> > optimizers will use all of the options, if you see what I mean.
> > :-)
> >
> > I agree that this is confusing. [The issue was already raised but
> > perhaps you could file a report on the project's bug-tracking system
> > so that we can gather all opinions on how to best deal with it.
> > I chose the current behaviour because it allows a much simpler API.
> > One way would be to just document which options are ignored by a
> > given optimizer implementation (and that would leave room to add
> > support later).]
> >
> > Currently, only the "CMAESOptimizer" implementation supports bounds.
> > However, Commons Math provides function wrappers which you can
> > use to
> > approximate support for simple bounds:
> >
> >
> http://commons.apache.org/math/apidocs/org/apache/commons/math3/optim/nonlinear/scalar/MultivariateFunctionMappingAdapter.html
> >
> >
> http://commons.apache.org/math/apidocs/org/apache/commons/math3/optim/nonlinear/scalar/MultivariateFunctionPenaltyAdapter.html
> > [But note the caveat indicated there (which might require that
> > you use
> > a "custom" convergence checker).]
> >
> > HTH,
> > Gilles
> >
> >
> > -----------------------------------------------------------------
> > ----
> > To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> > For additional commands, e-mail: user-help@commons.apache.org
> >
>
> ---
> Dr. Luca Marchetti, PhD
> Research associate
> Center for BioMedical Computing
> University of Verona, Department of Computer Science
> Strada Le Grazie 15, 37134 Verona, Italy
> e-mail: luca.marchetti@univr.it
>
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message