[SciPy-Dev] minimize(): being strict on options
Ralf Gommers
ralf.gommers at googlemail.com
Sun May 20 17:25:11 EDT 2012
On Sat, May 19, 2012 at 11:08 AM, Pauli Virtanen <pav at iki.fi> wrote:
> Hi,
>
> Currently, the minimize() solvers silently accept unknown (= mistyped or
> inapplicable) options. It might be useful to change this so that it
> raises an error if unknown options are passed to a solver.
>
> Alternatively, it could raise a warning instead --- when trying out
> different solvers an error could be a PITA.
>
A warning would indeed be useful here.
Ralf
> Code changes:
>
> tol = options.get('ftol', 1.48e-8)
> maxiter = options.get('maxiter', 500)
>
> change to
>
> tol = options.pop('ftol', 1.48e-8)
> maxiter = options.pop('maxiter', 500)
> if options:
> warnings.warn("Unknown solver options: %r"
> % sorted(options.keys()),
> scipy.optimize.OptimizationWarning)
>
> and
>
> class OptimizationWarning(UserWarning):
> pass
>
> --
> Pauli Virtanen
>
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20120520/6f0b306c/attachment.html>
More information about the SciPy-Dev
mailing list