A collection and visualization of black-box objective functions
Project description
Black-box Objective-functions
A collection and visualization of black-box objective functions
Visualizations
Objective Function | Heatmap | Surface Plot |
---|---|---|
Sphere function |
||
Rastrigin function |
||
Ackley function |
||
Rosenbrock function |
||
Beale function |
||
Himmelblaus function |
||
Hölder Table function |
||
Cross-In-Tray function |
Installation
The most recent version of Black-box Objective-functions is available on PyPi:
pip install black-box-objective-functions
Example
import numpy as np
from bbox_functions.convex import SphereFunction
from bbox_functions.non_convex import AckleyFunction
from bbox_functions.visualize import plotly_surface
sphere_function = SphereFunction(n_dim=2, metric="score")
ackley_function = AckleyFunction(metric="loss")
step_ = 0.05
min_ = 10
max_ = 10
search_space = {
"x0": np.arange(-min_, max_, step_),
"x1": np.arange(-min_, max_, step_),
}
plotly_surface(sphere_function, search_space).show()
plotly_surface(ackley_function, search_space).show()
API reference
Objective Function Classes
All objective function classes have the following parameters:
- metric: "score" or "loss"
- input_type: "dictionary" or "arrays"
Each objective function class has the following parameters:
SphereFunction
- A = 1
AckleyFunction
- A = 20
- B = 2 * pi
RastriginFunction
- A = 10
- B = 2 * pi
RosenbrockFunction
- A = 1
- B = 100
BealeFunction
- A = 1.5
- B = 2.25
- C = 2.652
HimmelblausFunction
- A = -11
- B = -7
HölderTableFunction
- A = 10
- B = 1
CrossInTrayFunction
- A = -0.0001
- B = 100
- C = 1
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.