[SciPy-User] ftol and xtol

pfeldman Phillip.M.Feldman@gmail....
Sat Jul 6 02:32:05 CDT 2013


If one uses relative error, it is unclear how to handle the situation where
the minimum is at zero.  So, absolute error seems more practical.

On Fri, Jul 5, 2013 at 4:38 AM, GRBChaser [via Scipy-User] <
ml-node+s10969n18518h56@n7.nabble.com> wrote:

> On the subject of ftol and xtol,  the  help for fmin describes these
> parameters as :
>
>     xtol : float
>         Relative error in xopt acceptable for convergence.
>     ftol : number
>         Relative error in func(xopt) acceptable for convergence.
>
>
> The use of the word "Relative" here has always implied to me that the
> convergence tests calculated by fmin refer to fractional changes in
> parameters or function values. However, I had difficulties trying to
> minimize a function in which the two parameters defer by many orders or
> magnitude (e.g. 1 and 1e10) and I've come to the conclusion it is because
> the large parameter never passes the convergence test.
>
> The code in fmin which tests for convergence is :
>
>         if (max(numpy.ravel(abs(sim[1:]-sim[0]))) <= xtol \
>             and max(abs(fsim[0]-fsim[1:])) <= ftol):
>             break
>
> This does not look like a test for the relative change in parameters or
> function values to me, but rather a test for their absolute changes. A
> relative change would surely be something like
>
>         if (max(numpy.ravel(abs((sim[1:]-sim[0])/sim[0]))) <= xtol \
>             and max(abs((fsim[0]-fsim[1:])/fsim[0])) <= ftol):
>             break
>
> (though care should really be taken for possible divide by zero errors).
>
>
> Either the docstring needs changing so "Relative" is replaced with
> "Absolute" to make it clear, or the convergence test needs to be changed so
> it truly is a relative error test.
>
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
> http://scipy-user.10969.n7.nabble.com/ftol-and-xtol-tp18355p18518.html
>  To unsubscribe from ftol and xtol, click here<http://scipy-user.10969.n7.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=18355&code=UGhpbGxpcC5NLkZlbGRtYW5AZ21haWwuY29tfDE4MzU1fC0zOTE4NzA0MQ==>
> .
> NAML<http://scipy-user.10969.n7.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://scipy-user.10969.n7.nabble.com/ftol-and-xtol-tp18355p18520.html
Sent from the Scipy-User mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20130706/924855dc/attachment.html 


More information about the SciPy-User mailing list