Re: [SciPy-Dev] Consideration of differential evolution minimizer being added to scipy.optimize.
Stealing that function would be great. That pattern needs more exposure. Thanks Robert Gaël <div>-------- Original message --------</div><div>From: Robert Kern <robert.kern@gmail.com> </div><div>Date:04/03/2014 12:33 (GMT+01:00) </div><div>To: SciPy Developers List <scipy-dev@scipy.org> </div><div>Subject: Re: [SciPy-Dev] Consideration of differential evolution minimizer being added to scipy.optimize. </div><div> </div>On Tue, Mar 4, 2014 at 2:21 AM, Andrew Nelson <andyfaff@gmail.com> wrote:
I have written some code implementing the differential evolution minimization algorithm, as invented by Storn and Price. It's a stochastic technique, not gradient based, but it's quite good at finding global minima of functions.
(see http://www1.icsi.berkeley.edu/~storn/code.html, http://en.wikipedia.org/wiki/Differential_evolution)
I'd like it to be considered for inclusion in scipy.optimize, and have tried to write it as such. Can anyone give advice of how to go about polishing the code, such that it's suitable for inclusion in scipy.optimize?
Looks good! A couple of minor nits: - Use PEP8-compliant names for methods, attributes and variables. - You don't need double-underscore-private methods. Single-underscores will do. - Don't seed a new RandomState instance every time. Instead, take a RandomState instance (defaulting to the global numpy.random if not specified). This lets you integrate well with other code that may also be using random numbers. For example, see what sklearn does: https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/utils/valid... Actually, since this is such a common pattern, I may steal that function to put into numpy.random so everyone can use it. -- Robert Kern _______________________________________________ SciPy-Dev mailing list SciPy-Dev@scipy.org http://mail.scipy.org/mailman/listinfo/scipy-dev
Le 04/03/2014 15:40, Gael Varoquaux a écrit :
Stealing that function would be great. That pattern needs more exposure.
I agree, I had never heard of it. Maybe the function could have a name like get_... instead of check_... It could also be a classmethod "from_seed" of RandomState, but then it can make confusion with the __init__ which also takes a seed param... best, Pierre
On Tue, Mar 04, 2014 at 07:37:31PM +0100, Pierre Haessig wrote:
Maybe the function could have a name like get_... instead of check_...
Or 'make_random_gen' which would be much more explicit. I don't really care about the name :). G
On Tue, Mar 4, 2014 at 6:54 PM, Gael Varoquaux <gael.varoquaux@normalesup.org> wrote:
On Tue, Mar 04, 2014 at 07:37:31PM +0100, Pierre Haessig wrote:
Maybe the function could have a name like get_... instead of check_...
Or 'make_random_gen' which would be much more explicit.
I don't really care about the name :).
Or a classmethod: RandomState.get, RandomState.coerce, ... -- Nathaniel J. Smith Postdoctoral researcher - Informatics - University of Edinburgh http://vorpus.org
On Tue, Mar 4, 2014 at 11:37 AM, Pierre Haessig <pierre.haessig@crans.org>wrote:
Le 04/03/2014 15:40, Gael Varoquaux a écrit :
Stealing that function would be great. That pattern needs more exposure.
I agree, I had never heard of it.
I did use Storn's original back in 2001 to see if it could design filters, don't recall exactly how well it worked though. <snip> Chuck
participants (4)
-
Charles R Harris -
Gael Varoquaux -
Nathaniel Smith -
Pierre Haessig