GithubHelp home page GithubHelp logo

hpparvi / pyde Goto Github PK

View Code? Open in Web Editor NEW
33.0 4.0 8.0 60 KB

Differential evolution global optimization in Python.

License: GNU General Public License v2.0

Python 100.00%
python optimization minimization differential-evolution global-optimization

pyde's Introduction

PyDE

Global optimization using differential evolution in Python [Storn97].

Installation

git clone https://github.com/hpparvi/PyDE.git
cd PyDE
python setup.py install [--user]

Basic usage

Import the class from the package

from pyde.de import DiffEvol

Create a DiffEvol instance

de = DiffEvol(minfun, bounds, npop)

where minfun is the function to be optimized, bounds is an initialization array, and npop is the size of the parameter vector population.

Now, you can run the optimizer ngen generations:

res = de.optimize(ngen=100)

or run the optimizer as a generator:

for res in de(ngen=100):
    do something

Usage with emcee

The PyDE parameter vector population can be used to initialize the affine-invariant MCMC sampler emcee when a simple point estimate of the function minimum (or maximum) is not sufficient:

de = DiffEvol(lnpost, bounds, npop, maximize=True)
de.optimize(ngen)

sampler = emcee.EnsembleSampler(npop, ndim, lnpost)
sampler.run_mcmc(de.population, 1000)

References

[Storn97]Storn, R., Price, K., Journal of Global Optimization 11: 341--359, 1997

API

pyde.de.DiffEvol (minfun, bounds, npop, F=0.5, C=0.5, seed=0, maximize=False)

Parameters

minfun:Function to be minimized.
bounds:Parameter space bounds as [npar,2] array.
npop:Size of the parameter vector population.
F:Difference amplification factor. Values between 0.5-0.8 are good in most cases.
C:Cross-over probability. Use 0.9 to test for fast convergence, and smaller values (~0.1) for a more elaborate search.
seed:Random seed.
maximize:An optional switch telling whether we want maximize or minimize the function. Defaults to minimization.

pyde's People

Contributors

hpparvi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pyde's Issues

ImportError: No module named 'de_f'

When I try to import pyde.de, I get the error:

---> 14 from pyde.de import DiffEvol
     15 import emcee
     16 import corner

/home/marko/anaconda3/lib/python3.5/site-packages/pyde/de.py in <module>()
      9 import numpy as np
     10 from numpy.random import random, randint
---> 11 from de_f import de_f
     12 
     13 class DiffEvol(object):

ImportError: No module named 'de_f'

Is there something else I need to do during installation?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.