On Friday, 08 March 2013, Carl Michal wrote:
> Hi,
>
> A couple of years ago (March 2011) I submitted a very small patch against fit.c
> to improve the way gnuplot's fit function works in cases where fit parameters
> vary in size dramatically. The problem is that if you are doing fits where some
> parameters are, say 10^7, but others are 10^-7, the fit routine basically
> collapses.
>
> The patch does a trivial rescaling of the parameters by their initial guess
> values before the meat of the fitting routine is called. With this rescaling
> these cases don't cause any problems.
>
> The patch and a description are here:
> http://sourceforge.net/p/gnuplot/patches/507/
> and this still applies cleanly to gnuplot 4.6.
>
> After applying this patch, most of the examples in fit.dem actually converge in
> fewer iterations than without it.
>
> Is there any hope of having this tiny patch (it touches a total of 20 lines)
> accepted?
The code in the patch does not do what it is described as doing.
1)
The test of this form will never be true: (foo == NEARLY_ZERO)
You would have to test (favs(foo) <= NEARLY_ZERO)
2)
The description/comment says
"If any variables were 0, then don't do it, since it causes more harm than
good then."
But the actual code applies scaling to all parameters except ones
with (foo == NEARLY_ZERO), which aside from being the wrong test is
not what is described ("if any ...").
Also, do you have any reason to believe the current definition of
NEARLY_ZERO as 10^{-30} is the right place to make a cutoff?
3)
Please make this an option, probably
set fit [no]prescale
Ethan
> Thanks,
>
> Carl
|