Skip to main content

A Python toolbox for performing Black-Box Optimization.

Project description


XBBO is an an effective, modular, reproducible and flexible black-box optimization (BBO) codebase, which aims to provide a common framework and benchmark for the BBO community.

This project is now supported by PengCheng Lab.


Overview | Links |Installation | Quick Start | Benchmark |Contributing | License

For more information and API usages, please refer to our Documentation.


Overview

XBBO decouples the search algorithm from the search space and provides a unified search space interface, allowing developers to focus on the search algorithm.

We provide these black box optimization algorithms as follows:

Search Algorithm Docs Official Links multi-fideility transfer multi-obj
Random
BORE
Anneal
Diffenential Evolution
CMA-ES
NSGA-II
Regularized EA
PBT
TuRBO
LaMCTS
HyperBand
BOHB
DEHB
MFES-BO
TST-R
TAF
TAF(RGPE)
RMoGP
RGPE(mean)
PSO
XNES
LFBO lfbo-ml/lfbo

Links

Installation

Python >= 3.7 is required.

Installation from PyPI

To install XBBO from PyPI:

pip install xbbo

For detailed instructions, please refer to Installation.md

Search Space

XBBO uses ConfigSpace as a tool to define search space. Please see ConfigSpace for how to define a search space.

Quick Start

note:XBBO default minimize black box function. All examples can be found in examples/ folder.

Here we take optimizing a quadratic function as a toy example:

from ConfigSpace import ConfigurationSpace
from ConfigSpace.hyperparameters import \
    CategoricalHyperparameter, UniformFloatHyperparameter, UniformIntegerHyperparameter

from xbbo.search_algorithm.bo_optimizer import BO

def custom_black_box_func(config):
    '''
    define black box function:
    y = x^2
    '''
    return config['x'] ** 2

def custom_search_space():
    '''
    define search space
    '''
    configuration_space = ConfigurationSpace()
    configuration_space.add_hyperparameter(UniformFloatHyperparameter('x', -10, 10, default_value=-3))
    return configuration_space

if __name__ == "__main__":
    MAX_CALL = 30

    cs = custom_search_space()

    # specify black box optimizer
    hpopt = BO(space=cs, suggest_limit=MAX_CALL)
    # ---- Begin BO-loop ----
    for i in range(MAX_CALL):
        # suggest
        trial_list = hpopt.suggest() # defalut suggest one trial
        # evaluate 
        obs = custom_black_box_func(trial_list[0].config_dict)
        # observe
        trial_list[0].add_observe_value(obs)
        hpopt.observe(trial_list=trial_list)
        
        print(obs)
    
    print('find best (value, config):{}'.format(hpopt.trials.get_best()))

Please refer to Quick Start.md for more information.

Benchmark

XBBO provides an easy-to-use benchmark tool, users can easily and quickly test the performance of the variety black-box algorithms on each test problem. Clik here for more information.

Contributing

We welcome contributions to the library along with any potential issues or suggestions.

Please refer to Contributing.md in our docs for more information.

License

This project is released under the MIT license.

TODO

  • 文档完善
  • Logger
  • parallel

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

XBBO-0.3.1.tar.gz (136.0 kB view details)

Uploaded Source

Built Distribution

XBBO-0.3.1-py2.py3-none-any.whl (188.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file XBBO-0.3.1.tar.gz.

File metadata

  • Download URL: XBBO-0.3.1.tar.gz
  • Upload date:
  • Size: 136.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.7.13

File hashes

Hashes for XBBO-0.3.1.tar.gz
Algorithm Hash digest
SHA256 ac450adcaa05201ef86b2e56d4267968ce084ac92ba2ef0e1fa7fba616e4fab8
MD5 727f7ed2e14e5fd18123437240455520
BLAKE2b-256 8742bdfe64c593bc70a8571a811972a639505eb810add265750b6d23b5b9bfb0

See more details on using hashes here.

File details

Details for the file XBBO-0.3.1-py2.py3-none-any.whl.

File metadata

  • Download URL: XBBO-0.3.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 188.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.7.13

File hashes

Hashes for XBBO-0.3.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 eb1cca72b1312280a0ef36dbe28e286a499d9f14e17e7886a1f41f85b7c2d771
MD5 d7947d7fa50d4749664c6d189adc1cf0
BLAKE2b-256 02f48c796012c5754fb556667525a37f2fedcea17f0fb797723847a25f5dd30a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page