All Projects → paulknysh → Blackbox

paulknysh / Blackbox

Licence: mit
A Python module for parallel optimization of expensive black-box functions

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Blackbox

Yabox
Yet another black-box optimization library for Python
Stars: ✭ 103 (-72.75%)
Mutual labels:  parallel, optimization
Eaopt
🍀 Evolutionary optimization library for Go (genetic algorithm, partical swarm optimization, differential evolution)
Stars: ✭ 718 (+89.95%)
Mutual labels:  parallel, optimization
Hybridizer Basic Samples
Examples of C# code compiled to GPU by hybridizer
Stars: ✭ 186 (-50.79%)
Mutual labels:  parallel, optimization
Dsp
An open-source parallel optimization solver for structured mixed-integer programming
Stars: ✭ 53 (-85.98%)
Mutual labels:  parallel, optimization
Ray
An open source framework that provides a simple, universal API for building distributed applications. Ray is packaged with RLlib, a scalable reinforcement learning library, and Tune, a scalable hyperparameter tuning library.
Stars: ✭ 18,547 (+4806.61%)
Mutual labels:  parallel, optimization
Run Parallel
Run an array of functions in parallel
Stars: ✭ 324 (-14.29%)
Mutual labels:  parallel
Pipelines
An experimental programming language for data flow
Stars: ✭ 354 (-6.35%)
Mutual labels:  parallel
Cvxpy
A Python-embedded modeling language for convex optimization problems.
Stars: ✭ 3,645 (+864.29%)
Mutual labels:  optimization
Webclgl
GPGPU Javascript library 🐸
Stars: ✭ 313 (-17.2%)
Mutual labels:  parallel
Awesome Wp Speed Up
Plugins and resources to speed up and optimize your WordPress site.
Stars: ✭ 375 (-0.79%)
Mutual labels:  optimization
Asyncenumerable
Defines IAsyncEnumerable, IAsyncEnumerator, ForEachAsync(), ParallelForEachAsync(), and other useful stuff to use with async-await
Stars: ✭ 367 (-2.91%)
Mutual labels:  parallel
Experiments with python
experiments with python
Stars: ✭ 342 (-9.52%)
Mutual labels:  optimization
Tick
Module for statistical learning, with a particular emphasis on time-dependent modelling
Stars: ✭ 326 (-13.76%)
Mutual labels:  optimization
Multipages Generator
🥇 generator for multiple pages webpack application
Stars: ✭ 354 (-6.35%)
Mutual labels:  optimization
Structurae
Data structures for high-performance JavaScript applications.
Stars: ✭ 323 (-14.55%)
Mutual labels:  optimization
Ifopt
An Eigen-based, light-weight C++ Interface to Nonlinear Programming Solvers (Ipopt, Snopt)
Stars: ✭ 372 (-1.59%)
Mutual labels:  optimization
React Scope
Visualize your React components as you interact with your application.
Stars: ✭ 316 (-16.4%)
Mutual labels:  optimization
Ojalgo
oj! Algorithms
Stars: ✭ 336 (-11.11%)
Mutual labels:  optimization
Reflective Bind
Eliminate wasteful re-rendering in React components caused by inline functions
Stars: ✭ 366 (-3.17%)
Mutual labels:  optimization
Zoopt
A python package of Zeroth-Order Optimization (ZOOpt)
Stars: ✭ 331 (-12.43%)
Mutual labels:  optimization

blackbox: A Python module for parallel optimization of expensive black-box functions

What is this?

A minimalistic and easy-to-use Python module that efficiently searches for a global minimum of an expensive black-box function (e.g. optimal hyperparameters of simulation, neural network or anything that takes significant time to run). User needs to provide a function, a search domain (ranges of each input parameter) and a total number of function calls available. A code scales well on multicore CPUs and clusters: all function calls are divided into batches and each batch is evaluated in parallel.

A mathematical method behind the code is described in this arXiv note (there were few updates to the method recently): https://arxiv.org/pdf/1605.00998.pdf

Don't forget to cite this note if you are using method/code.

Demo

(a) - demo function (unknown to a method).

(b) - running a procedure using 15 evaluations.

(c) - running a procedure using 30 evaluations.

Installation

pip3 install black-box

Objective function

Simply needs to be wrapped into a Python function.

def fun(par):
    ...
    return output

par is a vector of input parameters (a Python list), output is a scalar value to be minimized.

Running the procedure

import black_box as bb


def fun(par):
    return par[0]**2 + par[1]**2  # dummy example


best_params = bb.search_min(f = fun,  # given function
                            domain = [  # ranges of each parameter
                                [-10., 10.],
                                [-10., 10.]
                                ],
                            budget = 40,  # total number of function calls available
                            batch = 4,  # number of calls that will be evaluated in parallel
                            resfile = 'output.csv')  # text file where results will be saved

Important:

  • All function calls are divided into batches and each batch is evaluated in parallel. Total number of batches is budget/batch. The value of batch should correspond to the number of available computational units.
  • An optional parameter executor = ... should be specified within bb.search_min() in case when custom parallel engine is used (ipyparallel, dask.distributed, pathos etc). executor should be an object that has a map method.

Intermediate results

In addition to search_min() returning list of optimal parameters, all trials are sorted by function value (best ones at the top) and saved in a text file with the following structure:

Parameter #1 Parameter #2 ... Parameter #n Function value
+1.6355e+01 -4.7364e+03 ... +6.4012e+00 +1.1937e-04
... ... ... ... ...

Author

Paul Knysh ([email protected])

Feel free to email me if you have any questions or comments.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].