public inbox for gsl-discuss@sourceware.org
 help / color / mirror / Atom feed
* multifit_nlin on linear data
@ 2002-07-12 13:24 tlb
  2002-07-14 14:05 ` Brian Gough
  0 siblings, 1 reply; 2+ messages in thread
From: tlb @ 2002-07-12 13:24 UTC (permalink / raw)
  To: gsl-discuss


I have a multiparameter fitting problem which is nonlinear in general,
but has linear behavior in some regions where I can exactly calculate
the derivatives. So sometimes when I use gsl_multifit_fdfsolver it's
able to jump to the correct solution in a single jump, as you'd expect
it to.

But, when this happens, the second iteration of
gsl_multifit_fdfsolver_iterate returns GSL_ETOLF, because after the
first step it can neither predict nor achieve any further reduction.
To paraphrase the code in gtl/multifit/lmiterate.c

  prered is predicted reduction from step*jacobians [0]
  actred is result of taking that step [also 0]
 
  if (prered > 0)
      ratio = actred / prered;
  else
      ratio = 0;

  ...

  if (ratio >= 0.0001) {
     ... update answer ...

  else if (fabs(actred) <= GSL_DBL_EPSILON  && 
           prered <= GSL_DBL_EPSILON && 
           p5 * ratio <= 1.0) {
    return GSL_ETOLF;

Does this need rethinking, or does my problem need re-posing? My
function has regions of linearity and nonlinearity and it's hard for
me to know in advance if it's going to admit a single-step solution or
not, so it's not easy to just switch to a linear multifit algorithm
instead.

Should I be using a different termination critereon than
gsl_multifit_test_delta?

One workaround is to set the elements of the Jacobian matrix to 0.99 *
the actual derivative; it then converges nicely in 2-3 steps. 

Or, I could just accept ETOLF as an indication of being done.

--
Trevor Blackwell         tlb@tlb.org          (650) 776-7870

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: multifit_nlin on linear data
  2002-07-12 13:24 multifit_nlin on linear data tlb
@ 2002-07-14 14:05 ` Brian Gough
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Gough @ 2002-07-14 14:05 UTC (permalink / raw)
  To: tlb; +Cc: gsl-discuss

tlb@tlb.org writes:
 > I have a multiparameter fitting problem which is nonlinear in general,
 > but has linear behavior in some regions where I can exactly calculate
 > the derivatives. So sometimes when I use gsl_multifit_fdfsolver it's
 > able to jump to the correct solution in a single jump, as you'd expect
 > it to.
 > 
 > Should I be using a different termination critereon than
 > gsl_multifit_test_delta?

I'd recommend using a different termination criterion.  The step size
is not a reliable indicator on its own.  ETOLF indicates that the
algorithm can't go any further downhill, so you can usually
take that as signalling a minimum if you know that the behavior
of the function is reasonable.

regards
Brian Gough


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-07-14 21:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-12 13:24 multifit_nlin on linear data tlb
2002-07-14 14:05 ` Brian Gough

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).