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
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.
Metadata
Release files for PyDE 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| PyDE-1.0.1.tar.gz | 2.6 kB | Without provenance | Details |
Release files / PyDE-1.0.1.tar.gz
| Download URL | PyDE-1.0.1.tar.gz |
|---|---|
| Size | 2.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
45a56ffa91fb3dcdf3df9cf26f9ec681e6e0401f1dcf137638b700b0822d7bfd
|
|
BLAKE2b-256 checksum How to use checksums |
7fe12d1467ad0dea7340fb4d3441e9b47c23f5860b2ceb57465239073e04ae19
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for PyDE 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.