cpie
Clustering-based Promising Individual Enclosre(CPIE) in Python.
CPIE is an evolutionary computation algorithm which aims to search best parameters minimizing black-box function, especially UV-function.
UV-function has U-valley, which occupies large search space but contains only local optima, and V-valley, which occupies small search space but contains global optima.
e.g. Double-sphere: f(x) = min((x-2)^2 + 0.1, 10*(x+2)^2)
Installation
$ pip install cpie
CPIE depends on numpy, so please install numpy if needed.
Example of usage
First, you can import CPIE module as below.
from cpie import CPie
Then, you need to prepare objective function to be minimized.
def sphere(x):
return sum(xi*xi for xi in x)
def objective_func(x):
return min(sphere(x-2)+0.1, 10*sphere(x+2))
You can minimize objective function like below.
dimension = 2
bounds_min = [-10.0] * dimension
bounds_max = [ 10.0] * dimension
cpie = CPie(bounds_min, bounds_max, Ns=7*dimension)
for i in range(2000):
solution = cpie.sample()
f_value = objective_func(solution)
cpie.update(f_value)
cpie.print()
"bounds_min" and "bounds_max" means search space.
CPIE starts optimization with Ns solutions sampled unimormally in the search space.
After optimization loop, you can get optimized solution.
print("global best x", cpie.best.x)
print("global best f", cpie.best.f)
CPIE is niching algorithm, so you can also get best solutions from each mode.
bests = cpie.get_bests()
for i, b in enumerate(bests):
print("mode", i, " f", b.f)
example_main.py shows full example code.
Metadata
Release files for cpie 1.0.0
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 | |
|---|---|---|---|---|
| cpie-1.0.0.tar.gz | 8.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cpie-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.7 kB
Release files / cpie-1.0.0.tar.gz
| Download URL | cpie-1.0.0.tar.gz |
|---|---|
| Size | 8.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7ba85f1822e60ce16384fa1fd727b472e5e169e0639111951020c12ea327300a
|
|
BLAKE2b-256 checksum How to use checksums |
d43b6f715fcbdd16d01779cb07c768814babc67b333bf44cf363fb55d59dd6b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6
|
Release files / cpie-1.0.0-py3-none-any.whl
| Download URL | cpie-1.0.0-py3-none-any.whl |
|---|---|
| Size | 10.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
033aae641b146781e36ebc9c3e0123910be074d13d1b53090b32844eabef112a
|
|
BLAKE2b-256 checksum How to use checksums |
4de185075e05055c5fb2f648571474fc06b1e1ae91d96c990260a1edc678562f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6
|
Security for cpie 1.0.0
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.